From 942823db091c0b10a80cbfc5994008624f18d318 Mon Sep 17 00:00:00 2001 From: "Boroondas Gupte (patch by Aleric Inglewood)" Date: Sun, 3 Apr 2011 14:34:44 +0200 Subject: OPEN-38: Fixes for viewer-autobuild for standalone Reviewed at https://codereview.secondlife.com/r/167/ (The patch to create this commit was taken from there, too. That patch was made relative to 5f0ab9443ece. Applied cleanly to the (earlier) 43b4b7927c00.) Also fixes OPEN-36 --- indra/cmake/FindGLH.cmake | 30 ++++++++++++++++++++++++++++++ indra/cmake/GLH.cmake | 11 +++++++++++ indra/cmake/LLRender.cmake | 2 ++ indra/cmake/LLSharedLibs.cmake | 24 +++++++++++------------- indra/cmake/Linking.cmake | 29 +++++++++++++---------------- indra/linux_crash_logger/CMakeLists.txt | 1 + 6 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 indra/cmake/FindGLH.cmake create mode 100644 indra/cmake/GLH.cmake diff --git a/indra/cmake/FindGLH.cmake b/indra/cmake/FindGLH.cmake new file mode 100644 index 0000000000..3d16adaf03 --- /dev/null +++ b/indra/cmake/FindGLH.cmake @@ -0,0 +1,30 @@ +# -*- cmake -*- + +# - Find GLH +# Find the Graphic Library Helper includes. +# This module defines +# GLH_INCLUDE_DIR, where to find glh/glh_linear.h. +# GLH_FOUND, If false, do not try to use GLH. + +find_path(GLH_INCLUDE_DIR glh/glh_linear.h + NO_SYSTEM_ENVIRONMENT_PATH + ) + +if (GLH_INCLUDE_DIR) + set(GLH_FOUND "YES") +else (GLH_INCLUDE_DIR) + set(GLH_FOUND "NO") +endif (GLH_INCLUDE_DIR) + +if (GLH_FOUND) + if (NOT GLH_FIND_QUIETLY) + message(STATUS "Found GLH: ${GLH_INCLUDE_DIR}") + set(GLH_FIND_QUIETLY TRUE) # Only alert us the first time + endif (NOT GLH_FIND_QUIETLY) +else (GLH_FOUND) + if (GLH_FIND_REQUIRED) + message(FATAL_ERROR "Could not find GLH") + endif (GLH_FIND_REQUIRED) +endif (GLH_FOUND) + +mark_as_advanced(GLH_INCLUDE_DIR) diff --git a/indra/cmake/GLH.cmake b/indra/cmake/GLH.cmake new file mode 100644 index 0000000000..911dbe4017 --- /dev/null +++ b/indra/cmake/GLH.cmake @@ -0,0 +1,11 @@ +# -*- cmake -*- +include(Prebuilt) + +set(GLH_FIND_REQUIRED TRUE) +set(GLH_FIND_QUIETLY TRUE) + +if (STANDALONE) + include(FindGLH) +else (STANDALONE) + use_prebuilt_binary(glh_linear) +endif (STANDALONE) diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index c47e8878e9..8427928151 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -1,9 +1,11 @@ # -*- cmake -*- include(FreeType) +include(GLH) set(LLRENDER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llrender + ${GLH_INCLUDE_DIR} ) if (SERVER AND LINUX) diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index e29076c738..cafaf1ca3f 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -38,18 +38,17 @@ endmacro(ll_deploy_sharedlibs_command) # ll_stage_sharedlib # Performs config and adds a copy command for a sharedlib target. macro(ll_stage_sharedlib DSO_TARGET) - if(SHARED_LIB_STAGING_DIR) - # target gets written to the DLL staging directory. - # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. - set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) - if(NOT WINDOWS) - get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) - get_filename_component(DSO_FILE ${DSO_PATH} NAME) - if(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) - else(DARWIN) - set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) - endif(DARWIN) + # target gets written to the DLL staging directory. + # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. + set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) + if(NOT WINDOWS) + get_target_property(DSO_PATH ${DSO_TARGET} LOCATION) + get_filename_component(DSO_FILE ${DSO_PATH} NAME) + if(DARWIN) + set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources) + else(DARWIN) + set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) + endif(DARWIN) # *TODO - maybe make this a symbolic link? -brad add_custom_command( @@ -63,7 +62,6 @@ macro(ll_stage_sharedlib DSO_TARGET) COMMENT "Copying llcommon to the staging folder." ) endif(NOT WINDOWS) - endif(SHARED_LIB_STAGING_DIR) if (DARWIN) set_target_properties(${DSO_TARGET} PROPERTIES diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 07db6ab257..c5f9e2c579 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -2,22 +2,19 @@ include(Variables) - -if (NOT STANDALONE) - set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) - set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) - set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) - if (WINDOWS) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - elseif (LINUX) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) - set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) - elseif (DARWIN) - set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) - set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)") - endif (WINDOWS) -endif (NOT STANDALONE) +set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib) +set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release) +set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug) +if (WINDOWS) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) +elseif (LINUX) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib) + set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin) +elseif (DARWIN) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs) + set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)") +endif (WINDOWS) # Autobuild packages must provide 'release' versions of libraries, but may provide versions for # specific build types. AUTOBUILD_LIBS_INSTALL_DIRS lists first the build type directory and then diff --git a/indra/linux_crash_logger/CMakeLists.txt b/indra/linux_crash_logger/CMakeLists.txt index ab62a0d0af..98ebdc7487 100644 --- a/indra/linux_crash_logger/CMakeLists.txt +++ b/indra/linux_crash_logger/CMakeLists.txt @@ -3,6 +3,7 @@ project(linux_crash_logger) include(00-Common) +include(GLH) include(LLCommon) include(LLCrashLogger) include(LLMath) -- cgit v1.2.3 From 13458a96c7f9b77fe22f831baf418633cc38fad6 Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Wed, 6 Apr 2011 03:33:53 +0200 Subject: contributions.txt entry for OPEN-38 --- doc/contributions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index 4e91bbdd36..d604cc0d15 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -61,6 +61,7 @@ Aimee Trescothick Alejandro Rosenthal VWR-1184 Aleric Inglewood + OPEN-38 SNOW-240 SNOW-522 SNOW-626 -- cgit v1.2.3 From ef0057909fcf7eaee6bdff4a58492fd17ffdd9a4 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 11 May 2011 12:19:36 -0400 Subject: SH-1522 FIX removed old debugging code that generated avatar_lad_log.txt Old debugging code, should be very low risk to remove. --- indra/newview/llvoavatar.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4767ba2bed..68637a7ed9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5414,18 +5414,6 @@ BOOL LLVOAvatar::loadAvatar() } } - // Uncomment to enable avatar_lad.xml debugging. - std::ofstream file; - file.open("avatar_lad.log"); - for( LLViewerVisualParam* param = (LLViewerVisualParam*) getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) getNextVisualParam() ) - { - param->getInfo()->toStream(file); - file << std::endl; - } - - file.close(); return TRUE; } -- cgit v1.2.3 From 2b05aeca410a421ae3d8fc78ede29c1933a86272 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 29 Jun 2011 14:03:29 -0400 Subject: STORM-1446 Imported Stone Linden's fix for testing. --- indra/llmessage/lliosocket.cpp | 26 +++++++++++++++++++++----- indra/llmessage/lliosocket.h | 11 +++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index ca84fa8bb8..8c752fbe30 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -191,7 +191,7 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port) port = PORT_EPHEMERAL; } rv->mPort = port; - rv->setOptions(); + rv->setNonBlocking(); return rv; } @@ -206,7 +206,7 @@ LLSocket::ptr_t LLSocket::create(apr_socket_t* socket, apr_pool_t* pool) } rv = ptr_t(new LLSocket(socket, pool)); rv->mPort = PORT_EPHEMERAL; - rv->setOptions(); + rv->setNonBlocking(); return rv; } @@ -227,10 +227,10 @@ bool LLSocket::blockingConnect(const LLHost& host) { return false; } - apr_socket_timeout_set(mSocket, 1000); + setBlocking(1000); ll_debug_socket("Blocking connect", mSocket); if(ll_apr_warn_status(apr_socket_connect(mSocket, sa))) return false; - setOptions(); + setNonBlocking(); return true; } @@ -258,11 +258,27 @@ LLSocket::~LLSocket() } } -void LLSocket::setOptions() +// See http://dev.ariel-networks.com/apr/apr-tutorial/html/apr-tutorial-13.html#ss13.4 +// for an explanation of how to get non-blocking sockets and timeouts with +// consistent behavior across platforms. + +void LLSocket::setBlocking(S32 timeout) +{ + LLMemType m1(LLMemType::MTYPE_IO_TCP); + // set up the socket options + ll_apr_warn_status(apr_socket_timeout_set(mSocket, timeout)); + ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_NONBLOCK, 0)); + ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_SNDBUF, LL_SEND_BUFFER_SIZE)); + ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_RCVBUF, LL_RECV_BUFFER_SIZE)); + +} + +void LLSocket::setNonBlocking() { LLMemType m1(LLMemType::MTYPE_IO_TCP); // set up the socket options ll_apr_warn_status(apr_socket_timeout_set(mSocket, 0)); + ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_NONBLOCK, 1)); ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_SNDBUF, LL_SEND_BUFFER_SIZE)); ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_RCVBUF, LL_RECV_BUFFER_SIZE)); diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 6806e5084a..e0f6c1e34d 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -153,9 +153,16 @@ protected: LLSocket(apr_socket_t* socket, apr_pool_t* pool); /** - * @brief Set default socket options. + * @brief Set default socket options, with SO_NONBLOCK = 0 and a timeout in us. + * @param timeout Number of microseconds to wait on this socket. Any + * negative number means block-forever. TIMEOUT OF 0 IS NON-PORTABLE. */ - void setOptions(); + void setBlocking(S32 timeout); + + /** + * @brief Set default socket options, with SO_NONBLOCK = 1 and timeout = 0. + */ + void setNonBlocking(); public: /** -- cgit v1.2.3 From 44d7267cd9bddfe0e5e382db5f1d5a83a832b6ff Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 29 Jun 2011 17:22:39 -0400 Subject: Got indra/test to build. Fails to run due to missing .so files. --- indra/CMakeLists.txt | 5 +++ indra/test/CMakeLists.txt | 18 +++++----- indra/test/llsdmessagebuilder_tut.cpp | 7 ++-- indra/test/lltemplatemessagebuilder_tut.cpp | 55 +++++++++++++++-------------- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index d1042d6e86..f96fe59326 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -62,6 +62,7 @@ if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) add_subdirectory(${LIBS_CLOSED_PREFIX}copy_win_scripts) endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) + add_custom_target(viewer) if (VIEWER) add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger) @@ -70,6 +71,10 @@ if (VIEWER) add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml) add_subdirectory(${LIBS_OPEN_PREFIX}viewer_components) + if (LL_TESTS) + add_subdirectory(${VIEWER_PREFIX}test) + endif (LL_TESTS) + # viewer media plugins add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins) diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index e9eb3c1884..708ceeac42 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -4,7 +4,7 @@ project (test) include(00-Common) include(LLCommon) -include(LLDatabase) +#include(LLDatabase) include(LLInventory) include(LLMath) include(LLMessage) @@ -48,13 +48,11 @@ set(test_SOURCE_FILES llscriptresource_tut.cpp llsdmessagebuilder_tut.cpp llsdmessagereader_tut.cpp - llsd_new_tut.cpp +# llsd_new_tut.cpp # Fails [LLSD(new), 4] fail: 'NaN to string: expected 'nan' actual '-nan'' llsdutil_tut.cpp llservicebuilder_tut.cpp llstreamtools_tut.cpp lltemplatemessagebuilder_tut.cpp - lltimestampcache_tut.cpp - lltranscode_tut.cpp lltut.cpp lluuidhashmap_tut.cpp message_tut.cpp @@ -76,11 +74,11 @@ if (NOT WINDOWS) ) endif (NOT WINDOWS) -if (NOT DARWIN) - list(APPEND test_SOURCE_FILES - lldatabase_tut.cpp - ) -endif (NOT DARWIN) +#if (NOT DARWIN) +# list(APPEND test_SOURCE_FILES +# lldatabase_tut.cpp +# ) +#endif (NOT DARWIN) set_source_files_properties(${test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) @@ -100,7 +98,7 @@ target_link_libraries(test ${LLCOMMON_LIBRARIES} ${EXPAT_LIBRARIES} ${GOOGLEMOCK_LIBRARIES} - ${APRICONV_LIBRARIES} +# ${APRICONV_LIBRARIES} ${PTHREAD_LIBRARY} ${WINDOWS_LIBRARIES} ${BOOST_PROGRAM_OPTIONS_LIBRARY} diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index cc6f78decd..09100f59af 100644 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -33,6 +33,7 @@ #include "llsdmessagebuilder.h" #include "llsdmessagereader.h" #include "llsdtraits.h" +#include "llmath.h" #include "llquaternion.h" #include "u64.h" #include "v3dmath.h" @@ -83,7 +84,7 @@ namespace tut static LLMessageBlock* defaultTemplateBlock(const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) { - return createTemplateBlock(_PREHASH_Test0, type, size, block); + return createTemplateBlock(const_cast(_PREHASH_Test0), type, size, block); } static LLMessageBlock* createTemplateBlock(char* name, const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) @@ -91,12 +92,12 @@ namespace tut LLMessageBlock* result = new LLMessageBlock(name, block); if(type != MVT_NULL) { - result->addVariable(_PREHASH_Test0, type, size); + result->addVariable(const_cast(_PREHASH_Test0), type, size); } return result; } - static LLTemplateMessageBuilder* defaultTemplateBuilder(LLMessageTemplate& messageTemplate, char* name = _PREHASH_Test0) + static LLTemplateMessageBuilder* defaultTemplateBuilder(LLMessageTemplate& messageTemplate, char* name = const_cast(_PREHASH_Test0)) { templateNameMap[_PREHASH_TestMessage] = &messageTemplate; LLTemplateMessageBuilder* builder = new LLTemplateMessageBuilder(templateNameMap); diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index 09beb53869..6e1c82bb24 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -31,6 +31,7 @@ #include "llapr.h" #include "llmessagetemplate.h" +#include "llmath.h" #include "llquaternion.h" #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" @@ -75,7 +76,7 @@ namespace tut static LLMessageBlock* defaultBlock(const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) { - return createBlock(_PREHASH_Test0, type, size, block); + return createBlock(const_cast(_PREHASH_Test0), type, size, block); } static LLMessageBlock* createBlock(char* name, const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE) @@ -83,12 +84,12 @@ namespace tut LLMessageBlock* result = new LLMessageBlock(name, block); if(type != MVT_NULL) { - result->addVariable(_PREHASH_Test0, type, size); + result->addVariable(const_cast(_PREHASH_Test0), type, size); } return result; } - static LLTemplateMessageBuilder* defaultBuilder(LLMessageTemplate& messageTemplate, char* name = _PREHASH_Test0) + static LLTemplateMessageBuilder* defaultBuilder(LLMessageTemplate& messageTemplate, char* name = const_cast(_PREHASH_Test0)) { nameMap[_PREHASH_TestMessage] = &messageTemplate; LLTemplateMessageBuilder* builder = new LLTemplateMessageBuilder(nameMap); @@ -403,11 +404,11 @@ namespace tut // build template: Test0 before Test1 LLMessageTemplate messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb - LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); builder->nextBlock(_PREHASH_Test1); builder->addU32(_PREHASH_Test0, 0xbbbb); @@ -416,11 +417,11 @@ namespace tut // build template: Test1 before Test0 messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb - builder = defaultBuilder(messageTemplate, _PREHASH_Test1); + builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test1)); builder->addU32(_PREHASH_Test0, 0xaaaa); builder->nextBlock(_PREHASH_Test0); builder->addU32(_PREHASH_Test0, 0xbbbb); @@ -443,11 +444,11 @@ namespace tut // build template: Test0 before Test1 LLMessageTemplate messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb - LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); builder->nextBlock(_PREHASH_Test1); builder->addU32(_PREHASH_Test0, 0xbbbb); @@ -455,7 +456,7 @@ namespace tut delete builder; // build message: 1st declared block var == 0xaaaa, 2nd declared block var == 0xbbbb - builder = defaultBuilder(messageTemplate, _PREHASH_Test1); + builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test1)); builder->addU32(_PREHASH_Test0, 0xbbbb); builder->nextBlock(_PREHASH_Test0); builder->addU32(_PREHASH_Test0, 0xaaaa); @@ -478,21 +479,21 @@ namespace tut // Build template: Test0 only LLMessageTemplate messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); // Build message - LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); bufferSize1 = builder->buildMessage(buffer1, MAX_BUFFER_SIZE, 0); delete builder; // Build template: Test0 before Test1 messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); // Build message - builder = defaultBuilder(messageTemplate, _PREHASH_Test0); + builder = defaultBuilder(messageTemplate, const_cast(_PREHASH_Test0)); builder->addU32(_PREHASH_Test0, 0xaaaa); builder->nextBlock(_PREHASH_Test1); builder->addU32(_PREHASH_Test0, 0xbbbb); @@ -511,8 +512,8 @@ namespace tut U32 inTest00 = 0, inTest01 = 1, inTest1 = 2; U32 outTest00, outTest01, outTest1; LLMessageTemplate messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4)); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4)); LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addU32(_PREHASH_Test0, inTest00); builder->nextBlock(_PREHASH_Test0); @@ -536,15 +537,15 @@ namespace tut U32 inTest = 1, outTest; LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock( - createBlock(_PREHASH_Test0, MVT_U32, 4, MBT_SINGLE)); - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4)); LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addU32(_PREHASH_Test0, inTest); LLTemplateMessageReader* reader = setReader(messageTemplate, builder); reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outTest); - S32 blockCount = reader->getNumberOfBlocks(_PREHASH_Test1); + S32 blockCount = reader->getNumberOfBlocks(const_cast(_PREHASH_Test1)); ensure_equals("Ensure block count", blockCount, 0); ensure_equals("Ensure Test0", inTest, outTest); delete reader; @@ -556,7 +557,7 @@ namespace tut { // build template LLMessageTemplate messageTemplate = defaultTemplate(); - messageTemplate.addBlock(createBlock(_PREHASH_Test0, MVT_U32, 4)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test0), MVT_U32, 4)); // build message LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); @@ -881,7 +882,7 @@ namespace tut delete builder; // add block to reader template - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4, MBT_SINGLE)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE)); // read message value and default value numberMap[1] = &messageTemplate; @@ -914,7 +915,7 @@ namespace tut delete builder; // add variable block to reader template - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4)); + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_U32, 4)); // read message value and check block repeat count numberMap[1] = &messageTemplate; @@ -947,7 +948,7 @@ namespace tut delete builder; // add variable block to reader template - messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_VARIABLE, 4, + messageTemplate.addBlock(createBlock(const_cast(_PREHASH_Test1), MVT_VARIABLE, 4, MBT_SINGLE)); // read message value and default string -- cgit v1.2.3 From 45b1b6ff3b030c0372f1efff2baad989b02725a9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 3 Aug 2011 16:04:45 -0400 Subject: CHOP-763: Remove redundant KEY string names from llwindowlistener.cpp. A couple of the lookup tables in llwindowlistener.cpp essentially duplicated LLKeyboard::keyFromString() and maskFromString(). Remove those tables and use LLKeyboard lookup methods instead. --- indra/llwindow/llwindowlistener.cpp | 135 +++++++++--------------------------- 1 file changed, 31 insertions(+), 104 deletions(-) diff --git a/indra/llwindow/llwindowlistener.cpp b/indra/llwindow/llwindowlistener.cpp index 91b99d83c6..006aaa75e7 100644 --- a/indra/llwindow/llwindowlistener.cpp +++ b/indra/llwindow/llwindowlistener.cpp @@ -41,10 +41,10 @@ LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGett std::string keySomething = "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified "; std::string keyExplain = - "(integer keycode values, or keysym \"XXXX\" from any KEY_XXXX, in\n" - "http://hg.secondlife.com/viewer-development/src/tip/indra/llcommon/indra_constants.h )"; + "(integer keycode values, or keysym string from any addKeyName() call in\n" + "http://hg.secondlife.com/viewer-development/src/tip/indra/llwindow/llkeyboard.cpp )"; std::string mask = - "Specify optional [\"mask\"] as an array containing any of \"CONTROL\", \"ALT\",\n" + "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n" "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n" "to form the mask used with the event."; @@ -104,118 +104,41 @@ protected: } }; -// for WhichKeysym. KeyProxy is like the typedef KEY, except that KeyProxy() -// (default-constructed) is guaranteed to have the value KEY_NONE. -class KeyProxy +// helper for getMask() +static MASK lookupMask_(const std::string& maskname) { -public: - KeyProxy(KEY k): mKey(k) {} - KeyProxy(): mKey(KEY_NONE) {} - operator KEY() const { return mKey; } - -private: - KEY mKey; -}; - -struct WhichKeysym: public StringLookup -{ - WhichKeysym(): StringLookup("keysym") + // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not + // supported by maskFromString(). Handle that specially. + if (maskname == "MAC_CONTROL") { - add("RETURN", KEY_RETURN); - add("LEFT", KEY_LEFT); - add("RIGHT", KEY_RIGHT); - add("UP", KEY_UP); - add("DOWN", KEY_DOWN); - add("ESCAPE", KEY_ESCAPE); - add("BACKSPACE", KEY_BACKSPACE); - add("DELETE", KEY_DELETE); - add("SHIFT", KEY_SHIFT); - add("CONTROL", KEY_CONTROL); - add("ALT", KEY_ALT); - add("HOME", KEY_HOME); - add("END", KEY_END); - add("PAGE_UP", KEY_PAGE_UP); - add("PAGE_DOWN", KEY_PAGE_DOWN); - add("HYPHEN", KEY_HYPHEN); - add("EQUALS", KEY_EQUALS); - add("INSERT", KEY_INSERT); - add("CAPSLOCK", KEY_CAPSLOCK); - add("TAB", KEY_TAB); - add("ADD", KEY_ADD); - add("SUBTRACT", KEY_SUBTRACT); - add("MULTIPLY", KEY_MULTIPLY); - add("DIVIDE", KEY_DIVIDE); - add("F1", KEY_F1); - add("F2", KEY_F2); - add("F3", KEY_F3); - add("F4", KEY_F4); - add("F5", KEY_F5); - add("F6", KEY_F6); - add("F7", KEY_F7); - add("F8", KEY_F8); - add("F9", KEY_F9); - add("F10", KEY_F10); - add("F11", KEY_F11); - add("F12", KEY_F12); - - add("PAD_UP", KEY_PAD_UP); - add("PAD_DOWN", KEY_PAD_DOWN); - add("PAD_LEFT", KEY_PAD_LEFT); - add("PAD_RIGHT", KEY_PAD_RIGHT); - add("PAD_HOME", KEY_PAD_HOME); - add("PAD_END", KEY_PAD_END); - add("PAD_PGUP", KEY_PAD_PGUP); - add("PAD_PGDN", KEY_PAD_PGDN); - add("PAD_CENTER", KEY_PAD_CENTER); // the 5 in the middle - add("PAD_INS", KEY_PAD_INS); - add("PAD_DEL", KEY_PAD_DEL); - add("PAD_RETURN", KEY_PAD_RETURN); - add("PAD_ADD", KEY_PAD_ADD); // not used - add("PAD_SUBTRACT", KEY_PAD_SUBTRACT); // not used - add("PAD_MULTIPLY", KEY_PAD_MULTIPLY); // not used - add("PAD_DIVIDE", KEY_PAD_DIVIDE); // not used - - add("BUTTON0", KEY_BUTTON0); - add("BUTTON1", KEY_BUTTON1); - add("BUTTON2", KEY_BUTTON2); - add("BUTTON3", KEY_BUTTON3); - add("BUTTON4", KEY_BUTTON4); - add("BUTTON5", KEY_BUTTON5); - add("BUTTON6", KEY_BUTTON6); - add("BUTTON7", KEY_BUTTON7); - add("BUTTON8", KEY_BUTTON8); - add("BUTTON9", KEY_BUTTON9); - add("BUTTON10", KEY_BUTTON10); - add("BUTTON11", KEY_BUTTON11); - add("BUTTON12", KEY_BUTTON12); - add("BUTTON13", KEY_BUTTON13); - add("BUTTON14", KEY_BUTTON14); - add("BUTTON15", KEY_BUTTON15); + return MASK_MAC_CONTROL; } -}; -static WhichKeysym keysyms; - -struct WhichMask: public StringLookup -{ - WhichMask(): StringLookup("shift mask") + else { - add("NONE", MASK_NONE); - add("CONTROL", MASK_CONTROL); // Mapped to cmd on Macs - add("ALT", MASK_ALT); - add("SHIFT", MASK_SHIFT); - add("MAC_CONTROL", MASK_MAC_CONTROL); // Un-mapped Ctrl key on Macs, not used on Windows + // In case of lookup failure, return MASK_NONE, which won't affect our + // caller's OR. + MASK mask(MASK_NONE); + LLKeyboard::maskFromString(maskname, &mask); + return mask; } -}; -static WhichMask masks; +} static MASK getMask(const LLSD& event) { - MASK mask(MASK_NONE); LLSD masknames(event["mask"]); + if (! masknames.isArray()) + { + // If event["mask"] is a single string, perform normal lookup on it. + return lookupMask_(masknames); + } + + // Here event["mask"] is an array of mask-name strings. OR together their + // corresponding bits. + MASK mask(MASK_NONE); for (LLSD::array_const_iterator ai(masknames.beginArray()), aend(masknames.endArray()); ai != aend; ++ai) { - mask |= masks.lookup(*ai); + mask |= lookupMask_(*ai); } return mask; } @@ -224,7 +147,11 @@ static KEY getKEY(const LLSD& event) { if (event.has("keysym")) { - return keysyms.lookup(event["keysym"]); + // Initialize to KEY_NONE; that way we can ignore the bool return from + // keyFromString() and, in the lookup-fail case, simply return KEY_NONE. + KEY key(KEY_NONE); + LLKeyboard::keyFromString(event["keysym"], &key); + return key; } else if (event.has("keycode")) { -- cgit v1.2.3 From 14f6bbadef2c39e58a3b54c0c6212949acf50e45 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 8 Aug 2011 15:29:23 -0500 Subject: SH-2242 Work in progress migrating to glVertexAttrib everywhere --- indra/llrender/llgl.cpp | 79 +---- indra/llrender/llgl.h | 12 +- indra/llrender/llglslshader.cpp | 4 + indra/llrender/llrender.cpp | 99 ++++++ indra/llrender/llrender.h | 6 + indra/llrender/llvertexbuffer.cpp | 352 +++++++++++++++++---- indra/llrender/llvertexbuffer.h | 10 + indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/app_settings/settings.xml | 2 +- .../shaders/class1/avatar/avatarSkinV.glsl | 3 +- .../shaders/class1/avatar/avatarV.glsl | 24 +- .../shaders/class1/avatar/eyeballV.glsl | 15 +- .../shaders/class1/avatar/pickAvatarV.glsl | 16 +- .../shaders/class1/deferred/alphaSkinnedV.glsl | 20 +- .../shaders/class1/deferred/alphaV.glsl | 29 +- .../shaders/class1/deferred/attachmentShadowV.glsl | 10 +- .../shaders/class1/deferred/avatarAlphaV.glsl | 32 +- .../shaders/class1/deferred/avatarEyesV.glsl | 12 +- .../shaders/class1/deferred/avatarShadowV.glsl | 23 +- .../shaders/class1/deferred/avatarV.glsl | 25 +- .../shaders/class1/deferred/blurLightV.glsl | 6 +- .../shaders/class1/deferred/bumpSkinnedV.glsl | 16 +- .../shaders/class1/deferred/bumpV.glsl | 16 +- .../shaders/class1/deferred/cloudsV.glsl | 11 +- .../shaders/class1/deferred/diffuseSkinnedV.glsl | 15 +- .../shaders/class1/deferred/diffuseV.glsl | 14 +- .../shaders/class1/deferred/fullbrightV.glsl | 16 +- .../app_settings/shaders/class1/deferred/giV.glsl | 12 +- .../shaders/class1/deferred/impostorV.glsl | 10 +- .../shaders/class1/deferred/luminanceV.glsl | 12 +- .../shaders/class1/deferred/multiPointLightV.glsl | 6 +- .../shaders/class1/deferred/pointLightV.glsl | 12 +- .../shaders/class1/deferred/postDeferredV.glsl | 6 +- .../shaders/class1/deferred/postgiV.glsl | 5 +- .../shaders/class1/deferred/shadowAlphaMaskV.glsl | 10 +- .../shaders/class1/deferred/shadowV.glsl | 4 +- .../app_settings/shaders/class1/deferred/skyV.glsl | 11 +- .../shaders/class1/deferred/softenLightF.glsl | 6 +- .../shaders/class1/deferred/softenLightV.glsl | 13 +- .../shaders/class1/deferred/starsV.glsl | 10 +- .../shaders/class1/deferred/sunLightV.glsl | 16 +- .../shaders/class1/deferred/terrainV.glsl | 14 +- .../shaders/class1/deferred/treeV.glsl | 12 +- .../shaders/class1/deferred/waterV.glsl | 23 +- .../shaders/class1/effects/glowExtractF.glsl | 2 +- .../shaders/class1/effects/glowExtractV.glsl | 6 +- .../app_settings/shaders/class1/effects/glowV.glsl | 21 +- .../shaders/class1/environment/terrainV.glsl | 23 +- .../shaders/class1/environment/waterV.glsl | 13 +- .../shaders/class1/interface/customalphaV.glsl | 9 +- .../shaders/class1/interface/glowcombineV.glsl | 9 +- .../shaders/class1/interface/highlightF.glsl | 4 +- .../shaders/class1/interface/highlightV.glsl | 18 +- .../shaders/class1/interface/occlusionV.glsl | 4 +- .../shaders/class1/interface/solidcolorV.glsl | 10 +- .../shaders/class1/interface/twotextureaddV.glsl | 9 +- .../app_settings/shaders/class1/interface/uiV.glsl | 10 +- .../app_settings/shaders/class1/objects/bumpV.glsl | 13 +- .../class1/objects/fullbrightShinySkinnedV.glsl | 14 +- .../shaders/class1/objects/fullbrightShinyV.glsl | 14 +- .../shaders/class1/objects/fullbrightSkinnedV.glsl | 14 +- .../shaders/class1/objects/fullbrightV.glsl | 13 +- .../class1/objects/shinySimpleSkinnedV.glsl | 15 +- .../shaders/class1/objects/shinyV.glsl | 13 +- .../shaders/class1/objects/simpleSkinnedV.glsl | 15 +- .../shaders/class1/objects/simpleV.glsl | 18 +- .../shaders/class2/avatar/eyeballV.glsl | 16 +- .../shaders/class2/deferred/alphaSkinnedV.glsl | 27 +- .../shaders/class2/deferred/alphaV.glsl | 31 +- .../shaders/class2/deferred/avatarAlphaV.glsl | 31 +- .../shaders/class2/deferred/edgeV.glsl | 5 +- .../shaders/class2/deferred/softenLightV.glsl | 12 +- .../shaders/class2/deferred/sunLightV.glsl | 15 +- .../app_settings/shaders/class2/effects/blurV.glsl | 6 +- .../shaders/class2/effects/drawQuadV.glsl | 10 +- .../shaders/class2/environment/terrainV.glsl | 22 +- .../shaders/class2/lighting/sumLightsV.glsl | 2 - .../shaders/class2/objects/fullbrightShinyV.glsl | 19 +- .../shaders/class2/objects/fullbrightV.glsl | 18 +- .../shaders/class2/objects/shinyV.glsl | 18 +- .../shaders/class2/objects/simpleV.glsl | 20 +- .../shaders/class2/windlight/cloudsV.glsl | 11 +- .../shaders/class2/windlight/skyV.glsl | 10 +- .../shaders/class3/avatar/avatarV.glsl | 27 +- .../shaders/class3/deferred/giDownsampleV.glsl | 6 +- .../shaders/class3/deferred/giFinalV.glsl | 5 +- .../app_settings/shaders/class3/deferred/giV.glsl | 12 +- .../shaders/class3/deferred/luminanceV.glsl | 12 +- .../shaders/class3/deferred/postDeferredV.glsl | 6 +- .../shaders/class3/deferred/postgiV.glsl | 6 +- .../shaders/class3/deferred/softenLightV.glsl | 11 +- .../shaders/class3/lighting/sumLightsV.glsl | 1 - indra/newview/llagent.cpp | 2 +- indra/newview/lldrawpool.cpp | 4 +- indra/newview/lldrawpoolalpha.cpp | 23 +- indra/newview/lldrawpoolalpha.h | 1 + indra/newview/lldrawpoolavatar.cpp | 68 ++-- indra/newview/lldrawpoolbump.cpp | 2 +- indra/newview/lldrawpoolsimple.cpp | 38 +-- indra/newview/lldrawpoolsimple.h | 5 +- indra/newview/lldrawpoolsky.cpp | 6 +- indra/newview/lldrawpoolterrain.cpp | 4 + indra/newview/lldrawpooltree.cpp | 5 +- indra/newview/lldrawpoolwater.cpp | 6 +- indra/newview/lldrawpoolwlsky.cpp | 4 +- indra/newview/lldynamictexture.cpp | 8 + indra/newview/llface.cpp | 48 ++- indra/newview/llface.h | 6 +- indra/newview/llfloaterimagepreview.cpp | 4 +- indra/newview/llfloatermodelpreview.cpp | 16 +- indra/newview/llmanip.cpp | 4 +- indra/newview/llmaniptranslate.cpp | 4 +- indra/newview/llpreviewtexture.cpp | 2 +- indra/newview/llselectmgr.cpp | 4 +- indra/newview/llspatialpartition.cpp | 74 ++--- indra/newview/llspatialpartition.h | 1 - indra/newview/lltexlayer.cpp | 3 + indra/newview/lltextureview.cpp | 4 +- indra/newview/llviewerjointmesh.cpp | 24 +- indra/newview/llviewershadermgr.cpp | 280 +++++++++++++--- indra/newview/llviewershadermgr.h | 25 +- indra/newview/llviewerwindow.cpp | 2 +- indra/newview/llvosurfacepatch.cpp | 6 + indra/newview/llvovolume.cpp | 24 +- indra/newview/pipeline.cpp | 56 ++-- indra/newview/pipeline.h | 4 + 126 files changed, 1570 insertions(+), 874 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 2f6ef2b663..f58d4937d4 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1329,8 +1329,6 @@ void LLGLState::initClass() sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE; glDisable(GL_MULTISAMPLE_ARB); - - glEnableClientState(GL_VERTEX_ARRAY); } //static @@ -1604,7 +1602,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) { - if (!gDebugGL) + if (!gDebugGL || LLGLSLShader::sNoFixedFunction) { return; } @@ -1661,7 +1659,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) }; - for (S32 j = 0; j < 4; j++) + for (S32 j = 1; j < 4; j++) { if (glIsEnabled(value[j])) { @@ -1875,79 +1873,6 @@ void LLGLManager::initGLStates() //////////////////////////////////////////////////////////////////////////////// -void enable_vertex_weighting(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) glEnableVertexAttribArrayARB(index); // vertex weights -#endif -} - -void disable_vertex_weighting(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) glDisableVertexAttribArrayARB(index); // vertex weights -#endif -} - -void enable_binormals(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) - { - glEnableVertexAttribArrayARB(index); // binormals - } -#endif -} - -void disable_binormals(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) - { - glDisableVertexAttribArrayARB(index); // binormals - } -#endif -} - - -void enable_cloth_weights(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) glEnableVertexAttribArrayARB(index); -#endif -} - -void disable_cloth_weights(const S32 index) -{ -#if GL_ARB_vertex_program - if (index > 0) glDisableVertexAttribArrayARB(index); -#endif -} - -void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights) -{ -#if GL_ARB_vertex_program - if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights); - stop_glerror(); -#endif -} - -void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights) -{ -#if GL_ARB_vertex_program - if (index > 0) glVertexAttribPointerARB(index, 4, GL_FLOAT, TRUE, stride, weights); - stop_glerror(); -#endif -} - -void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals) -{ -#if GL_ARB_vertex_program - if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, binormals); - stop_glerror(); -#endif -} - void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific ) { // GL_VERSION returns a null-terminated string with the format: diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index d736133f3f..495e523c31 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -252,7 +252,7 @@ public: static void dumpStates(); static void checkStates(const std::string& msg = ""); static void checkTextureChannels(const std::string& msg = ""); - static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001); + static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0); protected: static boost::unordered_map sStateMap; @@ -419,15 +419,7 @@ extern LLMatrix4 gGLObliqueProjectionInverse; #include "llglstates.h" void init_glstates(); -void enable_vertex_weighting(const S32 index); -void disable_vertex_weighting(const S32 index); -void enable_binormals(const S32 index); -void disable_binormals(const S32 index); -void enable_cloth_weights(const S32 index); -void disable_cloth_weights(const S32 index); -void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights); -void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights); -void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals); + void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific ); extern BOOL gClothRipple; diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index f51d83abe4..b6cb84d10c 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -31,6 +31,7 @@ #include "llshadermgr.h" #include "llfile.h" #include "llrender.h" +#include "llvertexbuffer.h" #if LL_DARWIN #include "OpenGL/OpenGL.h" @@ -386,6 +387,7 @@ void LLGLSLShader::bind() gGL.flush(); if (gGLManager.mHasShaderObjects) { + LLVertexBuffer::unbind(); glUseProgramObjectARB(mProgramObject); sCurBoundShader = mProgramObject; sCurBoundShaderPtr = this; @@ -411,6 +413,7 @@ void LLGLSLShader::unbind() stop_glerror(); } } + LLVertexBuffer::unbind(); glUseProgramObjectARB(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; @@ -420,6 +423,7 @@ void LLGLSLShader::unbind() void LLGLSLShader::bindNoShader(void) { + LLVertexBuffer::unbind(); glUseProgramObjectARB(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index d72918b15d..da85bc202c 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1580,6 +1580,105 @@ void LLRender::color3fv(const GLfloat* c) color4f(c[0],c[1],c[2],1); } +void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttrib3fARB(loc, r,g,b); + } + else + { + glColor3f(r,g,b); + } +} + +void LLRender::diffuseColor3fv(const F32* c) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttrib3fvARB(loc, c); + } + else + { + glColor3fv(c); + } +} + +void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttrib4fARB(loc, r,g,b,a); + } + else + { + glColor4f(r,g,b,a); + } + +} + +void LLRender::diffuseColor4fv(const F32* c) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttrib4fvARB(loc, c); + } + else + { + glColor4fv(c); + } +} + +void LLRender::diffuseColor4ubv(const U8* c) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttrib4ubvARB(loc, c); + } + else + { + glColor4ubv(c); + } +} + + + + void LLRender::debugTexUnits(void) { LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 9eedebe2ce..5f97bff1c4 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -350,6 +350,12 @@ public: void color3fv(const GLfloat* c); void color4ubv(const GLubyte* c); + void diffuseColor3f(F32 r, F32 g, F32 b); + void diffuseColor3fv(const F32* c); + void diffuseColor4f(F32 r, F32 g, F32 b, F32 a); + void diffuseColor4fv(const F32* c); + void diffuseColor4ubv(const U8* c); + void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count); void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count); void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 1180afa631..30f73bf2c6 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -130,6 +130,7 @@ S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] = sizeof(LLVector2), // TYPE_TEXCOORD2, sizeof(LLVector2), // TYPE_TEXCOORD3, sizeof(LLColor4U), // TYPE_COLOR, + sizeof(U8), // TYPE_EMISSIVE sizeof(LLVector4), // TYPE_BINORMAL, sizeof(F32), // TYPE_WEIGHT, sizeof(LLVector4), // TYPE_WEIGHT4, @@ -156,36 +157,79 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) llerrs << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl; }*/ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + if (sLastMask != data_mask) { + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); + static LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; + llassert(sLastMask == 0 || last_shader == shader); + last_shader = shader; + U32 mask[] = { MAP_VERTEX, MAP_NORMAL, MAP_TEXCOORD0, MAP_COLOR, + MAP_EMISSIVE, + MAP_WEIGHT, + MAP_WEIGHT4, + MAP_BINORMAL, + MAP_CLOTHWEIGHT, }; + U32 type[] = + { + TYPE_VERTEX, + TYPE_NORMAL, + TYPE_TEXCOORD0, + TYPE_COLOR, + TYPE_EMISSIVE, + TYPE_WEIGHT, + TYPE_WEIGHT4, + TYPE_BINORMAL, + TYPE_CLOTHWEIGHT, + }; + GLenum array[] = { GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY, + 0, + 0, + 0, + 0, + 0, }; BOOL error = FALSE; - for (U32 i = 0; i < 4; ++i) + for (U32 i = 0; i < 9; ++i) { + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(type[i]); + } + if (sLastMask & mask[i]) { //was enabled - if (!(data_mask & mask[i]) && i > 0) + if (!(data_mask & mask[i])) { //needs to be disabled - glDisableClientState(array[i]); + if (loc >= 0) + { + glDisableVertexAttribArrayARB(loc); + } + else if (!shader) + { + glDisableClientState(array[i]); + } } - else if (gDebugGL) - { //needs to be enabled, make sure it was (DEBUG TEMPORARY) - if (i > 0 && !glIsEnabled(array[i])) + else if (gDebugGL && !shader && array[i]) + { //needs to be enabled, make sure it was (DEBUG) + if (loc < 0 && !glIsEnabled(array[i])) { if (gDebugSession) { @@ -201,11 +245,18 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } else { //was disabled - if (data_mask & mask[i] && i > 0) + if (data_mask & mask[i]) { //needs to be enabled - glEnableClientState(array[i]); + if (loc >= 0) + { + glEnableVertexAttribArrayARB(loc); + } + else if (!shader) + { + glEnableClientState(array[i]); + } } - else if (gDebugGL && i > 0 && glIsEnabled(array[i])) + else if (!shader && array[i] && gDebugGL && glIsEnabled(array[i])) { //needs to be disabled, make sure it was (DEBUG TEMPORARY) if (gDebugSession) { @@ -232,62 +283,71 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) MAP_TEXCOORD3 }; + U32 type_tc[] = + { + TYPE_TEXCOORD1, + TYPE_TEXCOORD2, + TYPE_TEXCOORD3 + }; + for (U32 i = 0; i < 3; i++) { + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(type_tc[i]); + } + if (sLastMask & map_tc[i]) { if (!(data_mask & map_tc[i])) - { - glClientActiveTextureARB(GL_TEXTURE1_ARB+i); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + { //disable + if (loc >= 0) + { + glDisableVertexAttribArrayARB(loc); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE1_ARB+i); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } } else if (data_mask & map_tc[i]) { - glClientActiveTextureARB(GL_TEXTURE1_ARB+i); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + if (loc >= 0) + { + glEnableVertexAttribArrayARB(loc); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE1_ARB+i); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } } - if (sLastMask & MAP_BINORMAL) + if (!shader) { - if (!(data_mask & MAP_BINORMAL)) + if (sLastMask & MAP_BINORMAL) { - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + if (!(data_mask & MAP_BINORMAL)) + { + glClientActiveTextureARB(GL_TEXTURE2_ARB); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } - } - else if (data_mask & MAP_BINORMAL) - { - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glClientActiveTextureARB(GL_TEXTURE0_ARB); - } - - if (sLastMask & MAP_WEIGHT4) - { - if (sWeight4Loc < 0) + else if (data_mask & MAP_BINORMAL) { - llerrs << "Weighting disabled but vertex buffer still bound!" << llendl; - } - - if (!(data_mask & MAP_WEIGHT4)) - { //disable 4-component skin weight - glDisableVertexAttribArrayARB(sWeight4Loc); - } - } - else if (data_mask & MAP_WEIGHT4) - { - if (sWeight4Loc >= 0) - { //enable 4-component skin weight - glEnableVertexAttribArrayARB(sWeight4Loc); + glClientActiveTextureARB(GL_TEXTURE2_ARB); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTextureARB(GL_TEXTURE0_ARB); } } - - + sLastMask = data_mask; } } @@ -1592,6 +1652,10 @@ bool LLVertexBuffer::getColorStrider(LLStrider& strider, S32 index, S { return VertexBufferStrider::get(*this, strider, index, count, map_range); } +bool LLVertexBuffer::getEmissiveStrider(LLStrider& strider, S32 index, S32 count, bool map_range) +{ + return VertexBufferStrider::get(*this, strider, index, count, map_range); +} bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { return VertexBufferStrider::get(*this, strider, index, count, map_range); @@ -1810,46 +1874,166 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; } + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + //assert that fixed function is allowed OR a shader is currently bound + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); + if (data_mask & MAP_NORMAL) { - glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_NORMAL); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); + } + else if (!shader) + { + glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); + } } if (data_mask & MAP_TEXCOORD3) { - glClientActiveTextureARB(GL_TEXTURE3_ARB); - glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3])); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_TEXCOORD3); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3])); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE3_ARB); + glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } if (data_mask & MAP_TEXCOORD2) { - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2])); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_TEXCOORD2); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2])); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE2_ARB); + glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } if (data_mask & MAP_TEXCOORD1) { - glClientActiveTextureARB(GL_TEXTURE1_ARB); - glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1])); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_TEXCOORD1); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1])); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE1_ARB); + glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } if (data_mask & MAP_BINORMAL) { - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL])); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_BINORMAL); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL])); + } + else if (!shader) + { + glClientActiveTextureARB(GL_TEXTURE2_ARB); + glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_BINORMAL], (void*)(base + mOffsets[TYPE_BINORMAL])); + glClientActiveTextureARB(GL_TEXTURE0_ARB); + } } if (data_mask & MAP_TEXCOORD0) { - glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_TEXCOORD0); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); + } + else if (!shader) + { + glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); + } } if (data_mask & MAP_COLOR) { - glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR])); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_COLOR); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR])); + } + else if (!shader) + { + glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR])); + } + } + if (data_mask & MAP_EMISSIVE) + { + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_EMISSIVE); + } + + if (loc >= 0) + { + glVertexAttribPointerARB(loc, 1, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], (void*)(base + mOffsets[TYPE_EMISSIVE])); + } } - if (data_mask & MAP_WEIGHT) { - glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT])); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_WEIGHT); + } + + if (loc < 0) + { //legacy behavior, some shaders have weight hardcoded to location 1 + loc = 1; + } + + glVertexAttribPointerARB(loc, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT])); + } if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1) @@ -1859,17 +2043,47 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const if (data_mask & MAP_CLOTHWEIGHT) { - glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT])); + S32 loc = -1; + if (shader) + { + loc = shader->getAttribLocation(TYPE_CLOTHWEIGHT); + } + + if (loc < 0) + { //legacy behavior, some shaders have weight hardcoded to location 4 + loc = 4; + } + glVertexAttribPointerARB(loc, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT])); } if (data_mask & MAP_VERTEX) { - if (data_mask & MAP_TEXTURE_INDEX) + S32 loc = -1; + if (shader) { - glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + loc = shader->getAttribLocation(TYPE_VERTEX); } - else + + if (loc >= 0) { - glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + if (data_mask & MAP_TEXTURE_INDEX) + { + glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } + else + { + glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } + } + else if (!shader) + { + if (data_mask & MAP_TEXTURE_INDEX) + { + glVertexPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } + else + { + glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); + } } } diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index cc5d11e1c2..3cccdf62ec 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -133,6 +133,12 @@ public: static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices); + //WARNING -- when updating these enums you MUST + // 1 - update LLVertexBuffer::sTypeSize + // 2 - add a strider accessor + // 3 - modify LLVertexBuffer::setupVertexBuffer + // 4 - modify LLVertexBuffer::setupClientArray + // 5 - modify LLViewerShaderMgr::mReservedAttribs enum { TYPE_VERTEX, TYPE_NORMAL, @@ -141,6 +147,7 @@ public: TYPE_TEXCOORD2, TYPE_TEXCOORD3, TYPE_COLOR, + TYPE_EMISSIVE, // These use VertexAttribPointer and should possibly be made generic TYPE_BINORMAL, TYPE_WEIGHT, @@ -160,6 +167,7 @@ public: MAP_TEXCOORD2 = (1<& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getBinormalStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getColorStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getEmissiveStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + BOOL isEmpty() const { return mEmpty; } BOOL isLocked() const { return mVertexLocked || mIndexLocked; } S32 getNumVerts() const { return mNumVerts; } diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ae72dee900..a76eb3cd37 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -43,7 +43,7 @@ tags - + diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9bb320d882..ed1e3c2057 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7565,7 +7565,7 @@ Type Boolean Value - 0 + 1 RenderDebugNormalScale diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index d9f29ced4f..81b632e7fa 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -6,8 +6,7 @@ */ - -attribute vec4 weight; //1 +attribute vec4 weight; uniform vec4 matrixPalette[45]; diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index 2796222c68..ec7359d565 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -5,7 +5,9 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -13,31 +15,33 @@ void calcAtmospherics(vec3 inPositionEye); void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; + vec4 pos_in = vec4(position.xyz, 1.0); + mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); gl_Position = gl_ProjectionMatrix * pos; - //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + //gl_Position = gl_ModelViewProjectionMatrix * position; gl_FogFragCoord = length(pos.xyz); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0)); + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); gl_FrontColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 2eb814bd91..0b075feef5 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -13,16 +17,17 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + vec3 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)).xyz; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0)); + vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); gl_FrontColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index 86b189b282..dcc891b16f 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -5,21 +5,23 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; mat4 getSkinnedTransform(); void main() { vec4 pos; - + vec4 pos_in = vec4(position, 1.0); mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - gl_FrontColor = gl_Color; - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_FrontColor = diffuse_color; + gl_TexCoord[0] = vec4(texcoord0,0,1); gl_Position = gl_ProjectionMatrix * pos; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index ac3f7189c2..eeebae4464 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getObjectSkinnedTransform(); @@ -59,7 +63,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; @@ -67,9 +71,9 @@ void main() mat4 trans = getObjectSkinnedTransform(); trans = gl_ModelViewMatrix * trans; - pos = trans * gl_Vertex; + pos = trans * vec4(position.xyz, 1.0); - norm = gl_Vertex.xyz + gl_Normal.xyz; + norm = position.xyz + normal.xyz; norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz); vec4 frag_pos = gl_ProjectionMatrix * pos; @@ -80,7 +84,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -90,17 +94,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = min(col.rgb*gl_Color.rgb, 1.0); + col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 44cb78e914..3a17f6a709 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec4 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -62,22 +65,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz, 1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix * vert; + vec4 vert = vec4(position.xyz, 1.0); + vary_texture_index = position.w; + vec4 pos = (gl_ModelViewMatrix * vert); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec4 pos = (gl_ModelViewMatrix * vert); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(gl_NormalMatrix * normal); float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -87,7 +90,7 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); @@ -96,10 +99,10 @@ void main() vary_light = gl_LightSource[0].position.xyz; - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = col.rgb*gl_Color.rgb; + col.rgb = col.rgb*diffuse_color.rgb; gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl index c7a4f86727..df61785aa1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -5,21 +5,23 @@ * $License$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0); p.z = max(p.z, -p.w+0.01); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 68e4055cf2..842931ec17 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -59,20 +62,21 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + vec4 pos_in = vec4(position.xyz, 1.0); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); vec4 frag_pos = gl_ProjectionMatrix * pos; @@ -82,9 +86,9 @@ void main() calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -94,17 +98,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = min(col.rgb*gl_Color.rgb, 1.0); + col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl index 7bc78fe407..bdea3d2b57 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -6,16 +6,20 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec3 vary_normal; void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vary_normal = normalize(gl_NormalMatrix * gl_Normal); + vary_normal = normalize(gl_NormalMatrix * normal); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index f177fcd8f1..cf6fc1c0ed 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -9,26 +9,31 @@ mat4 getSkinnedTransform(); -attribute vec4 weight; +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; + varying vec4 post_pos; void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; + vec4 pos_in = vec4(position.xyz, 1.0); mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); pos = gl_ProjectionMatrix * pos; @@ -36,7 +41,7 @@ void main() gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 7eac11287a..e66f8c8483 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; mat4 getSkinnedTransform(); @@ -15,28 +18,28 @@ varying vec3 vary_normal; void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; + vec4 pos_in = vec4(position.xyz, 1.0); mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); vary_normal = norm; gl_Position = gl_ProjectionMatrix * pos; - //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - - gl_FrontColor = gl_Color; + + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index 862f809de5..016b5e1008 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl index dc69519a85..93e00fe523 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -5,7 +5,11 @@ * $License$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; +attribute vec2 texcoord2; varying vec3 vary_mat0; varying vec3 vary_mat1; @@ -15,17 +19,17 @@ mat4 getObjectSkinnedTransform(); void main() { - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); - vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); + vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz); + vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz); vec3 t = cross(b, n); vary_mat0 = vec3(t.x, b.x, n.x); @@ -33,5 +37,5 @@ void main() vary_mat2 = vec3(t.z, b.z, n.z); gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 5b6726488b..3c28776045 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -5,7 +5,11 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; +attribute vec2 texcoord2; varying vec3 vary_mat0; varying vec3 vary_mat1; @@ -14,16 +18,16 @@ varying vec3 vary_mat2; void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec3 n = normalize(gl_NormalMatrix * gl_Normal); - vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz); + vec3 n = normalize(gl_NormalMatrix * normal); + vec3 b = normalize(gl_NormalMatrix * vec4(texcoord2,0,1).xyz); vec3 t = cross(b, n); vary_mat0 = vec3(t.x, b.x, n.x); vary_mat1 = vec3(t.y, b.y, n.y); vary_mat2 = vec3(t.z, b.z, n.z); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 3eac63076c..9ba5e97a95 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -5,7 +5,8 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec2 texcoord0; ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky @@ -41,12 +42,12 @@ void main() { // World / view / projection - gl_Position = ftransform(); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) @@ -142,7 +143,7 @@ void main() // Texture coords - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); gl_TexCoord[0].xy -= 0.5; gl_TexCoord[0].xy /= cloud_scale.x; gl_TexCoord[0].xy += 0.5; diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl index 2c4caea109..fadbe5b9ef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -7,27 +7,32 @@ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; + varying vec3 vary_normal; mat4 getObjectSkinnedTransform(); void main() { - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); vary_normal = norm.xyz; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index b56d1493c3..e424737702 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -6,6 +6,10 @@ */ +attribute vec4 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; varying vec3 vary_normal; varying float vary_texture_index; @@ -13,11 +17,11 @@ varying float vary_texture_index; void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vary_texture_index = gl_Vertex.w; - vary_normal = normalize(gl_NormalMatrix * gl_Normal); + vary_texture_index = position.w; + vary_normal = normalize(gl_NormalMatrix * normal); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 2eed044b7c..3e5fc7a36b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -6,6 +6,9 @@ */ +attribute vec4 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -19,18 +22,17 @@ varying float vary_texture_index; void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz, 1.0); - vary_texture_index = gl_Vertex.w; + vec4 vert = vec4(position.xyz, 1.0); + vec4 pos = (gl_ModelViewMatrix * vert); + vary_texture_index = position.w; - gl_Position = gl_ModelViewProjectionMatrix*vert; + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec4 pos = (gl_ModelViewMatrix * vert); - calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl index e86f2896da..d97d7ea82d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl @@ -5,6 +5,9 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec2 vary_fragcoord; @@ -14,11 +17,12 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; + vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 723777bd3a..cb47f62bbf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -5,13 +5,15 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index 4baf1fc65a..6a53644723 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -5,8 +5,9 @@ * $/LicenseInfo$ */ - - + +attribute vec3 position; +attribute vec4 diffuse_color; varying vec2 vary_fragcoord; @@ -15,9 +16,10 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index 434fb6f534..7db577c07a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -6,15 +6,17 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; varying vec4 vary_fragcoord; void main() { //transform vertex - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); vary_fragcoord = pos; gl_Position = pos; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index c510d8ad77..ac3170d16d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -5,7 +5,9 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec4 vary_light; varying vec4 vary_fragcoord; @@ -13,15 +15,15 @@ varying vec4 vary_fragcoord; void main() { //transform vertex - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); vary_fragcoord = pos; - vec4 tex = gl_MultiTexCoord0; + vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - vary_light = gl_MultiTexCoord0; + vary_light = vec4(texcoord0,0,1); gl_Position = pos; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 876f65ee3a..30dbe3f75e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl index eebe930666..38525044ba 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl @@ -5,6 +5,7 @@ * $/LicenseInfo$ */ +attribute vec3 position; varying vec2 vary_fragcoord; @@ -13,7 +14,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 58e9bcec58..6bbbfdd8ee 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -5,19 +5,21 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec4 post_pos; void main() { //transform vertex - vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); post_pos = pos; gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_FrontColor = gl_Color; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index d40c2d9f78..7a8ac14f5e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -5,14 +5,14 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec4 post_pos; void main() { //transform vertex - vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); post_pos = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 1ea00f723a..8dfb466e88 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -5,7 +5,8 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec2 texcoord0; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky @@ -39,12 +40,12 @@ void main() { // World / view / projection - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); - //vec3 P = gl_Vertex.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + //vec3 P = position.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index d327216a0c..3ba5ee5bd2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -45,7 +45,7 @@ uniform vec3 env_mat[3]; //uniform vec4 shadow_clip; uniform mat3 ssao_effect_mat; -varying vec4 vary_light; +uniform vec3 sun_dir; varying vec2 vary_fragcoord; vec3 vary_PositionEye; @@ -265,7 +265,7 @@ void main() norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; - float da = max(dot(norm.xyz, vary_light.xyz), 0.0); + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); @@ -286,7 +286,7 @@ void main() // the old infinite-sky shiny reflection // vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float sa = dot(refnormpersp, vary_light.xyz); + float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a; // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 745cc01992..5b3f655edf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -6,21 +6,16 @@ */ +attribute vec3 position; uniform vec2 screen_res; -varying vec4 vary_light; varying vec2 vary_fragcoord; void main() { //transform vertex - gl_Position = ftransform(); - - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; - vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; - vec4 tex = gl_MultiTexCoord0; - tex.w = 1.0; - - vary_light = gl_MultiTexCoord0; + vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index c43125dad9..7cdfe445df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -6,12 +6,14 @@ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 814deb3677..65fa288e88 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec4 vary_light; varying vec2 vary_fragcoord; @@ -15,13 +18,14 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; + vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - vary_light = gl_MultiTexCoord0; + vary_light = vec4(texcoord0,0,1); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 3038fd2966..33b379d70c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -5,7 +5,11 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; +attribute vec2 texcoord1; varying vec3 vary_normal; @@ -26,14 +30,14 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - vary_normal = normalize(gl_NormalMatrix * gl_Normal); + vary_normal = normalize(gl_NormalMatrix * normal); // Transform and pass tex coords - gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; + gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; - vec4 t = gl_MultiTexCoord1; + vec4 t = vec4(texcoord1,0,1); gl_TexCoord[0].zw = t.xy; gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index a9bef4292d..07e56e84db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -6,16 +6,20 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; + varying vec3 vary_normal; void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vary_normal = normalize(gl_NormalMatrix * gl_Normal); + vary_normal = normalize(gl_NormalMatrix * normal); - gl_FrontColor = gl_Color; + gl_FrontColor = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 5397290b11..b5869e6cb2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -6,6 +6,8 @@ */ +attribute vec3 position; + void calcAtmospherics(vec3 inPositionEye); @@ -29,25 +31,25 @@ float wave(vec2 v, float t, float f, vec2 d, float s) void main() { //transform vertex - vec4 position = gl_Vertex; + vec4 pos = vec4(position.xyz, 1.0); mat4 modelViewProj = gl_ModelViewProjectionMatrix; vec4 oPosition; //get view vector vec3 oEyeVec; - oEyeVec.xyz = position.xyz-eyeVec; + oEyeVec.xyz = pos.xyz-eyeVec; float d = length(oEyeVec.xy); float ld = min(d, 2560.0); - position.xy = eyeVec.xy + oEyeVec.xy/d*ld; + pos.xy = eyeVec.xy + oEyeVec.xy/d*ld; view.xyz = oEyeVec; d = clamp(ld/1536.0-0.5, 0.0, 1.0); d *= d; - oPosition = position; + oPosition = vec4(position, 1.0); oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); vary_position = gl_ModelViewMatrix * oPosition; oPosition = modelViewProj * oPosition; @@ -55,17 +57,16 @@ void main() refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); //get wave position parameter (create sweeping horizontal waves) - vec3 v = position.xyz; + vec3 v = pos.xyz; v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; //push position for further horizon effect. - position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); - position.w = 1.0; - position = position*gl_ModelViewMatrix; - - calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); - + pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); + pos.w = 1.0; + pos = gl_ModelViewMatrix*pos; + calcAtmospherics(pos.xyz); + //pass wave parameters to pixel shader vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055; //get two normal map (detail map) texture coordinates diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 32f5f5f236..1ec0836dcc 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -19,7 +19,6 @@ uniform float warmthAmount; void main() { vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy); - /// CALCULATING LUMINANCE (Using NTSC lum weights) /// http://en.wikipedia.org/wiki/Luma_%28video%29 float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) ); @@ -27,4 +26,5 @@ void main() gl_FragColor.rgb = col.rgb; gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha); + } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index 76736fed53..b8881e0b19 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -5,11 +5,13 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec2 texcoord0; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0); - gl_TexCoord[0].xy = gl_MultiTexCoord0.xy; + gl_TexCoord[0].xy = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index 9bb41626ae..a05449a77c 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -5,20 +5,21 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec2 texcoord0; uniform vec2 glowDelta; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0); - gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5); - gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5); - gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5); - gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5); - gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5); - gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5); - gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5); - gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5); + gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5); + gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5); + gl_TexCoord[2].xy = texcoord0 + glowDelta*(-1.5); + gl_TexCoord[3].xy = texcoord0 + glowDelta*(-0.5); + gl_TexCoord[0].zw = texcoord0 + glowDelta*(0.5); + gl_TexCoord[1].zw = texcoord0 + glowDelta*(1.5); + gl_TexCoord[2].zw = texcoord0 + glowDelta*(2.5); + gl_TexCoord[3].zw = texcoord0 + glowDelta*(3.5); } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 8af981915b..d0d8aed67e 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -5,6 +5,13 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; +attribute vec2 texcoord1; +attribute vec2 texcoord2; +attribute vec2 texcoord3; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -26,17 +33,17 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - vec4 pos = gl_ModelViewMatrix * gl_Vertex; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec4 pos = gl_ModelViewMatrix * position; + vec3 norm = normalize(gl_NormalMatrix * normal); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color); + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color); gl_FrontColor = color; - gl_TexCoord[0] = texgen_object(gl_Vertex,gl_MultiTexCoord0,gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); - gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1; - gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); - gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3; + gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); + gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(texcoord1,0,1); + gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); + gl_TexCoord[3] = gl_TextureMatrix[3]*vec4(texcoord3,0,1); } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 831d6a761c..92d4759fe8 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -6,6 +6,7 @@ */ +attribute vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -27,7 +28,6 @@ float wave(vec2 v, float t, float f, vec2 d, float s) void main() { //transform vertex - vec4 position = gl_Vertex; mat4 modelViewProj = gl_ModelViewProjectionMatrix; vec4 oPosition; @@ -45,7 +45,7 @@ void main() d = clamp(ld/1536.0-0.5, 0.0, 1.0); d *= d; - oPosition = position; + oPosition = vec4(position, 1.0); oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); oPosition = modelViewProj * oPosition; refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); @@ -55,11 +55,12 @@ void main() v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; //push position for further horizon effect. - position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); - position.w = 1.0; - position = position*gl_ModelViewMatrix; + vec4 pos; + pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); + pos.w = 1.0; + pos = gl_ModelViewMatrix*pos; - calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); + calcAtmospherics(pos.xyz); //pass wave parameters to pixel shader diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl index 04bfff22c1..22095bc611 100644 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl @@ -5,12 +5,15 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl index ce183ec154..46be1c45d3 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl @@ -5,11 +5,14 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec2 texcoord1; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_TexCoord[1] = gl_MultiTexCoord1; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_TexCoord[1] = vec4(texcoord1,0,1); } diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl index f6c6d945de..a0cbdaafb8 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl @@ -6,10 +6,10 @@ */ - +uniform vec4 highlight_color; uniform sampler2D diffuseMap; void main() { - gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = highlight_color*texture2D(diffuseMap, gl_TexCoord[0].xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl index f114f766bf..0547c44093 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl @@ -5,23 +5,13 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec2 texcoord0; void main() { //transform vertex - gl_Position = ftransform(); - vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; - pos = normalize(pos); - float d = dot(pos, normalize(gl_NormalMatrix * gl_Normal)); - d *= d; - d = 1.0 - d; - d *= d; - - d = min(d, gl_Color.a*2.0); - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_FrontColor.rgb = gl_Color.rgb; - gl_FrontColor.a = max(d, gl_Color.a); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); } diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl index 5a5d0ec506..9c528750eb 100644 --- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl @@ -5,8 +5,10 @@ * $/LicenseInfo$ */ +attribute vec3 position; + void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl index 8401208e28..18c8e394c6 100644 --- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl @@ -5,12 +5,14 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_FrontColor = gl_Color; - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_FrontColor = diffuse_color; + gl_TexCoord[0] = vec4(texcoord0,0,1); } diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl index f685b112b4..dde4e87c63 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl @@ -6,11 +6,14 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec2 texcoord1; void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_TexCoord[1] = gl_MultiTexCoord1; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_TexCoord[1] = vec4(texcoord1,0,1); } diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl index 9ca6cae5c5..ebf2361da4 100644 --- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl @@ -6,11 +6,15 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; + void main() { - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl index 056d1a9582..438a9bec85 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl @@ -6,11 +6,16 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; +attribute vec2 texcoord1; + void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1; - gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + gl_TexCoord[1] = gl_TextureMatrix[1] * vec4(texcoord1,0,1); + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index 5283e80407..5ed2b38f42 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -15,21 +19,21 @@ void main() mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index 31e0f0a429..4063294c51 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -14,18 +18,18 @@ uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(gl_NormalMatrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index 1db79791de..316c93c36a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -6,6 +6,9 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -13,21 +16,16 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; - norm.xyz = (mat*norm).xyz; - norm.xyz = normalize(norm.xyz-pos.xyz); - calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index 3382384c99..d88612765c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -5,21 +5,24 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); + calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index eea41bb4f0..41a9cd2fe6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -5,7 +5,10 @@ * $License$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -16,21 +19,21 @@ void main() mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); gl_FrontColor = color; gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 68a086dbc1..4757295470 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -14,14 +17,14 @@ uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; vec3 ref = reflect(pos.xyz, -norm); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index af92e5e002..fbda2e70d2 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -5,7 +5,10 @@ * $License$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -14,21 +17,21 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); gl_FrontColor = color; gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index b493f76fcc..39fad42acb 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -13,16 +16,15 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); gl_FrontColor = color; gl_FogFragCoord = pos.z; diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 3e8b719f93..e6d5c00c4d 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -13,17 +17,17 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)).xyz; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); // vec4 specular = specularColor; vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0)); + vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); gl_FrontColor = color; gl_FogFragCoord = pos.z; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index 948a52da5b..97fe7029e1 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -5,7 +5,10 @@ * $License$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -59,18 +62,18 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + vec3 pos = (mat*position).xyz; gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0); - vec4 n = gl_Vertex; - n.xyz += gl_Normal.xyz; + vec4 n = position; + n.xyz += normal.xyz; n.xyz = (mat*n).xyz; n.xyz = normalize(n.xyz-pos.xyz); @@ -81,8 +84,8 @@ void main() calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -92,23 +95,23 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = min(col.rgb*gl_Color.rgb, 1.0); + col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); gl_FrontColor = col; gl_FogFragCoord = pos.z; - pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz; + pos.xyz = (gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0)).xyz; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index f616ecc872..91dcca4607 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -5,7 +5,10 @@ * $/LicenseInfo$ */ - +attribute vec4 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -61,22 +64,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz, 1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix * vert; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - + vec4 vert = vec4(position.xyz, 1.0); + vary_texture_index = position.w; vec4 pos = (gl_ModelViewMatrix * vert); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec3 norm = normalize(gl_NormalMatrix * normal); float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -86,17 +89,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = col.rgb*gl_Color.rgb; + col.rgb = col.rgb*diffuse_color.rgb; gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 01e40afc4f..65c3e5da10 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -61,20 +65,21 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + vec4 pos_in = vec4(position.xyz, 1.0); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); gl_Position = gl_ProjectionMatrix * pos; @@ -84,9 +89,9 @@ void main() calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -96,17 +101,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = min(col.rgb*gl_Color.rgb, 1.0); + col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl index 393084a3db..5e19a3b043 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl @@ -6,6 +6,7 @@ */ +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +14,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index 745cc01992..d2e3415d91 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -6,6 +6,8 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; uniform vec2 screen_res; @@ -14,13 +16,11 @@ varying vec2 vary_fragcoord; void main() { //transform vertex - gl_Position = ftransform(); + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; - tex.w = 1.0; - - vary_light = gl_MultiTexCoord0; + vary_light = vec4(texcoord0,0,1); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 814deb3677..6795b55dc6 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -5,6 +5,10 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec4 vary_light; @@ -15,13 +19,14 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; + vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - vary_light = gl_MultiTexCoord0; + vary_light = vec4(texcoord0,0,1); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl index de469542f9..68f79fba82 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl @@ -6,6 +6,8 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; uniform vec2 texelSize; uniform vec2 blurDirection; @@ -14,10 +16,10 @@ uniform float blurWidth; void main(void) { // Transform vertex - gl_Position = ftransform(); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth); - vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0); + vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0); // for (int i = 0; i < 7; i++) { // gl_TexCoord[i].st = s + (i * blurDelta); diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl index 9c52b8dd5d..7dd2ead200 100644 --- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl @@ -6,11 +6,15 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec2 texcoord1; + void main(void) { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_TexCoord[1] = gl_MultiTexCoord1; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_TexCoord[1] = vec4(texcoord1,0,1); } diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl index 2658bee88d..b5367b5dae 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl @@ -6,6 +6,12 @@ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; +attribute vec2 texcoord1; + void calcAtmospherics(vec3 inPositionEye); @@ -28,24 +34,24 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) void main() { //transform vertex - gl_Position = ftransform(); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + + vec4 pos = gl_ModelViewMatrix * vec4(position.xyz, 1.0); + vec3 norm = normalize(gl_NormalMatrix * normal); - vec4 pos = gl_ModelViewMatrix * gl_Vertex; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + calcAtmospherics(pos.xyz); /// Potentially better without it for water. pos /= pos.w; - calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); - - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0)); gl_FrontColor = color; // Transform and pass tex coords - gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; + gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; - vec4 t = gl_MultiTexCoord1; + vec4 t = vec4(texcoord1,0,1); gl_TexCoord[0].zw = t.xy; gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0); diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl index 3d43a1813a..bc927cfdb6 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl @@ -5,8 +5,6 @@ * $/LicenseInfo$ */ - - float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index f49e74406f..72a18c6858 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -13,23 +13,28 @@ uniform vec4 origin; varying float vary_texture_index; +attribute vec4 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; + void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz,1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix*vert; - + vec4 vert = vec4(position.xyz,1.0); + vary_texture_index = position.w; vec4 pos = (gl_ModelViewMatrix * vert); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + + vec3 norm = normalize(gl_NormalMatrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index 3076fa3260..cf8ea23c36 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -5,6 +5,11 @@ * $/LicenseInfo$ */ + +attribute vec4 position; +attribute vec2 texcoord0; +attribute vec3 normal; +attribute vec4 diffuse_color; void calcAtmospherics(vec3 inPositionEye); @@ -14,16 +19,15 @@ varying float vary_texture_index; void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz,1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix*vert; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - + vec4 vert = vec4(position.xyz,1.0); + vary_texture_index = position.w; vec4 pos = (gl_ModelViewMatrix * vert); - + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 49992d3535..5d633f53d5 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -6,6 +6,10 @@ */ +attribute vec4 position; +attribute vec2 texcoord0; +attribute vec3 normal; +attribute vec4 diffuse_color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -18,20 +22,20 @@ uniform vec4 origin; void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz,1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix*vert; - + vec4 vert = vec4(position.xyz,1.0); + vary_texture_index = position.w; vec4 pos = (gl_ModelViewMatrix * vert); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + + vec3 norm = normalize(gl_NormalMatrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); calcAtmospherics(pos.xyz); - gl_FrontColor = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0)); + gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 5e02391767..4f53cde40c 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -7,6 +7,11 @@ +attribute vec4 position; +attribute vec2 texcoord0; +attribute vec3 normal; +attribute vec4 diffuse_color; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -15,18 +20,19 @@ varying float vary_texture_index; void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz,1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix*vert; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - + vec4 vert = vec4(position.xyz,1.0); + vary_texture_index = position.w; vec4 pos = (gl_ModelViewMatrix * vert); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); + + - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); gl_FrontColor = color; gl_FogFragCoord = pos.z; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 3eac63076c..9ba5e97a95 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -5,7 +5,8 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec2 texcoord0; ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky @@ -41,12 +42,12 @@ void main() { // World / view / projection - gl_Position = ftransform(); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) @@ -142,7 +143,7 @@ void main() // Texture coords - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); gl_TexCoord[0].xy -= 0.5; gl_TexCoord[0].xy /= cloud_scale.x; gl_TexCoord[0].xy += 0.5; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 1ea00f723a..31c995a542 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -6,6 +6,8 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky @@ -39,12 +41,12 @@ void main() { // World / view / projection - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); - //vec3 P = gl_Vertex.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + //vec3 P = position.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index 3d970d252c..f65dfff42f 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -5,38 +5,39 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; +attribute vec4 clothing; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); -attribute vec4 clothing; //4 - -attribute vec4 gWindDir; //7 -attribute vec4 gSinWaveParams; //3 -attribute vec4 gGravity; //5 +uniform vec4 gWindDir; +uniform vec4 gSinWaveParams; +uniform vec4 gGravity; const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542); // #minimax-generated coefficients const vec4 gPiConstants = vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); // # {1/2PI, 2PI, PI, PI/2} void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; mat4 trans = getSkinnedTransform(); vec3 norm; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); //wind vec4 windEffect; windEffect = vec4(dot(norm, gWindDir.xyz)); - pos.x = dot(trans[2].xyz, gl_Vertex.xyz); + pos.x = dot(trans[2].xyz, position.xyz); windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015) + windEffect.xyz; windEffect.w = windEffect.w * 2.0 + 1.0; // move wind offset value to [-1, 3] @@ -83,7 +84,7 @@ void main() sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0)); // clamp to underlying body shape offsetPos = clothing * sinWave.x; // multiply wind effect times clothing displacement temp2 = gWindDir*sinWave.z + vec4(norm,0); // calculate normal offset due to wind oscillation - offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+gl_Vertex; // add to offset vertex position, and zero out effect from w + offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+vec4(position.xyz, 1.0); // add to offset vertex position, and zero out effect from w norm += temp2.xyz*2.0; // add sin wave effect on normals (exaggerated) //add "backlighting" effect @@ -101,7 +102,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0)); + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0)); gl_FrontColor = color; gl_Position = gl_ProjectionMatrix * pos; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl index eebe930666..b769e1ee1d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl index 7e20d71529..057d36ed22 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl @@ -5,6 +5,7 @@ * $/LicenseInfo$ */ +attribute vec3 position; varying vec2 vary_fragcoord; @@ -13,7 +14,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl index e86f2896da..d97d7ea82d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl @@ -5,6 +5,9 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; varying vec2 vary_fragcoord; @@ -14,11 +17,12 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; + vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl index 9afeac6ddf..5bdb69fb6f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl @@ -5,18 +5,20 @@ * $/LicenseInfo$ */ - - varying vec2 vary_fragcoord; uniform vec2 screen_res; +attribute vec3 position; +attribute vec4 diffuse_color; + void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; + vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl index 876f65ee3a..2581098609 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl index eebe930666..ed6fd1ee80 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl @@ -5,7 +5,7 @@ * $/LicenseInfo$ */ - +attribute vec3 position; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res; void main() { //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl index 745cc01992..9872c9f366 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl @@ -6,6 +6,8 @@ */ +attribute vec3 position; +attribute vec2 texcoord0; uniform vec2 screen_res; @@ -14,13 +16,10 @@ varying vec2 vary_fragcoord; void main() { //transform vertex - gl_Position = ftransform(); + vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_Position = pos; - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; - vec4 tex = gl_MultiTexCoord0; - tex.w = 1.0; - - vary_light = gl_MultiTexCoord0; + vary_light = vec4(texcoord0,0,1); } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 24bbc0a1a1..9144b8361f 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -6,7 +6,6 @@ */ - float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 492cfe7c1b..e3be6b0402 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3925,7 +3925,7 @@ void LLAgent::renderAutoPilotTarget() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // lovely green - glColor4f(0.f, 1.f, 1.f, 1.f); + gGL.diffuseColor4f(0.f, 1.f, 1.f, 1.f); target_global = mAutoPilotTargetGlobal; diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 286284f828..0c572def72 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -384,7 +384,7 @@ BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE; void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color) { - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); } void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color) @@ -394,7 +394,7 @@ void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color) void LLFacePool::LLOverrideFaceColor::setColor(F32 r, F32 g, F32 b, F32 a) { - glColor4f(r,g,b,a); + gGL.diffuseColor4f(r,g,b,a); } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 9719140a37..ef8819d9b5 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -54,7 +54,7 @@ static BOOL deferred_render = FALSE; LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) : LLRenderPass(type), current_shader(NULL), target_shader(NULL), - simple_shader(NULL), fullbright_shader(NULL), + simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL), mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF), mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF) { @@ -175,11 +175,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass) { simple_shader = &gObjectSimpleWaterAlphaMaskProgram; fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram; + emissive_shader = &gObjectEmissiveWaterProgram; } else { simple_shader = &gObjectSimpleAlphaMaskProgram; fullbright_shader = &gObjectFullbrightAlphaMaskProgram; + emissive_shader = &gObjectEmissiveProgram; } if (mVertexShaderLevel > 0) @@ -319,20 +321,22 @@ void LLDrawPoolAlpha::render(S32 pass) BOOL shaders = gPipeline.canUseVertexShaders(); if(shaders) { - gObjectFullbrightNonIndexedProgram.bind(); + gHighlightProgram.bind(); + gHighlightProgram.uniform4f("highlight_color", 1,0,0,1); } else { gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); + gGL.diffuseColor4f(1,0,0,1); } - glColor4f(1,0,0,1); + LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f); gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ; renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); if(shaders) { - gObjectFullbrightNonIndexedProgram.unbind(); + gHighlightProgram.unbind(); } } } @@ -489,22 +493,25 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha. if (draw_glow_for_this_partition && - params.mGlowColor.mV[3] > 0) + params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE)) { // install glow-accumulating blend mode gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow) + emissive_shader->bind(); + // glow doesn't use vertex colors from the mesh data - params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR); - glColor4ubv(params.mGlowColor.mV); - + params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE); + // do the actual drawing, again params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); // restore our alpha blend mode gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor); + + current_shader->bind(); } if (tex_setup) diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index 12a7ae92b1..a4245e561d 100644 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -78,6 +78,7 @@ private: LLGLSLShader* target_shader; LLGLSLShader* simple_shader; LLGLSLShader* fullbright_shader; + LLGLSLShader* emissive_shader; // our 'normal' alpha blend function for this pass LLRender::eBlendFactor mColorSFactor; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 694b7dcedd..dae995e1f5 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -263,7 +263,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha() gPipeline.bindDeferredShader(*sVertexProgram); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); } void LLDrawPoolAvatar::beginDeferredRiggedAlpha() @@ -314,8 +313,7 @@ void LLDrawPoolAvatar::endPostDeferredAlpha() // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done sRenderingSkinned = FALSE; sSkipOpaque = FALSE; - disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); - + gPipeline.unbindDeferredShader(*sVertexProgram); sDiffuseChannel = 0; sShaderLevel = mVertexShaderLevel; @@ -362,13 +360,12 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) } //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); if ((sShaderLevel > 0)) // for hardware blending { sRenderingSkinned = TRUE; sVertexProgram->bind(); - enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); } } else @@ -389,7 +386,6 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass) { sRenderingSkinned = FALSE; sVertexProgram->unbind(); - disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); } } else @@ -492,11 +488,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) //reset vertex buffer mappings LLVertexBuffer::unbind(); - if (pass == 0) - { //make sure no stale colors are left over from a previous render - glColor4f(1,1,1,1); - } - if (LLPipeline::sImpostorRender) { //impostor render does not have impostors or rigid rendering pass += 2; @@ -535,6 +526,11 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) beginRiggedGlow(); break; } + + if (pass == 0) + { //make sure no stale colors are left over from a previous render + gGL.diffuseColor4f(1,1,1,1); + } } void LLDrawPoolAvatar::endRenderPass(S32 pass) @@ -604,11 +600,11 @@ void LLDrawPoolAvatar::beginRigid() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram; + sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram; } else { - sVertexProgram = &gObjectAlphaMaskNonIndexedProgram; + sVertexProgram = &gObjectAlphaMaskNoColorProgram; } if (sVertexProgram != NULL) @@ -692,11 +688,11 @@ void LLDrawPoolAvatar::beginSkinned() { if (LLPipeline::sUnderWaterRender) { - sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram; + sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram; } else { - sVertexProgram = &gObjectAlphaMaskNonIndexedProgram; + sVertexProgram = &gObjectAlphaMaskNoColorProgram; } } @@ -705,17 +701,6 @@ void LLDrawPoolAvatar::beginSkinned() sRenderingSkinned = TRUE; sVertexProgram->bind(); - if (sShaderLevel >= SHADER_LEVEL_CLOTH) - { - enable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]); - } - enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); - - if (sShaderLevel >= SHADER_LEVEL_BUMP) - { - enable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]); - } - sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP); gGL.getTexUnit(0)->activate(); } @@ -743,16 +728,6 @@ void LLDrawPoolAvatar::endSkinned() sRenderingSkinned = FALSE; sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP); gGL.getTexUnit(0)->activate(); - disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); - if (sShaderLevel >= SHADER_LEVEL_BUMP) - { - disable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]); - } - if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) - { - disable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]); - } - sVertexProgram->unbind(); sShaderLevel = mVertexShaderLevel; } @@ -1027,8 +1002,6 @@ void LLDrawPoolAvatar::beginDeferredSkinned() sVertexProgram->bind(); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); - gGL.getTexUnit(0)->activate(); } @@ -1036,7 +1009,6 @@ void LLDrawPoolAvatar::endDeferredSkinned() { // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done sRenderingSkinned = FALSE; - disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]); sVertexProgram->unbind(); sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); @@ -1150,10 +1122,10 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view + /*if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view { gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f)); - } + }*/ if (pass == 1) { @@ -1262,16 +1234,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) wind = wind * rot_mat; wind.mV[VW] = avatarp->mWindVec.mV[VW]; - sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_WIND, wind.mV); + sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV); F32 phase = -1.f * (avatarp->mRipplePhase); F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f); LLVector4 sin_params(freq, freq, freq, phase); - sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_SINWAVE, sin_params.mV); + sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV); LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f); gravity = gravity * rot_mat; - sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_GRAVITY, gravity.mV); + sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV); } if( !single_avatar || (avatarp == single_avatar) ) @@ -1509,7 +1481,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (glow) { - glColor4f(0,0,0,face->getTextureEntry()->getGlow()); + gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow()); } gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture()); @@ -1662,7 +1634,7 @@ LLVertexBufferAvatar::LLVertexBufferAvatar() void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const { - if (sRenderingSkinned) + /*if (sRenderingSkinned) { U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData; @@ -1686,8 +1658,8 @@ void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const } } else - { + {*/ LLVertexBuffer::setupVertexBuffer(data_mask); - } + //} } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index d801f6df18..a0990ca645 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -762,7 +762,7 @@ void LLDrawPoolBump::renderBump(U32 pass) LLGLDisable fog(GL_FOG); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL); LLGLEnable blend(GL_BLEND); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); /// Get rid of z-fighting with non-bump pass. LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -1.0f); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index eec4ee6bac..582e462871 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -80,6 +80,18 @@ void LLDrawPoolGlow::endPostDeferredPass(S32 pass) LLRenderPass::endRenderPass(pass); } +S32 LLDrawPoolGlow::getNumPasses() +{ + if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) + { + return 1; + } + else + { + return 0; + } +} + void LLDrawPoolGlow::render(S32 pass) { LLFastTimer t(FTM_RENDER_GLOW); @@ -93,39 +105,29 @@ void LLDrawPoolGlow::render(S32 pass) U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); - if (shader_level > 0 && fullbright_shader) - { - fullbright_shader->bind(); - } - else - { - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - } + //should never get here without basic shaders enabled + llassert(shader_level > 0); + + LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram; + shader->bind(); LLGLDepthTest depth(GL_TRUE, GL_FALSE); gGL.setColorMask(false, true); - if (shader_level > 1) - { - pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - } - else - { - renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask()); - } + pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gGL.setColorMask(true, false); gGL.setSceneBlendType(LLRender::BT_ALPHA); if (shader_level > 0 && fullbright_shader) { - fullbright_shader->unbind(); + shader->unbind(); } } void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures) { - glColor4ubv(params.mGlowColor.mV); + //gGL.diffuseColor4ubv(params.mGlowColor.mV); LLRenderPass::pushBatch(params, mask, texture, batch_textures); } diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h index 3811b3d398..bd62bc7502 100644 --- a/indra/newview/lldrawpoolsimple.h +++ b/indra/newview/lldrawpoolsimple.h @@ -118,7 +118,8 @@ public: enum { VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | - LLVertexBuffer::MAP_TEXCOORD0 + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_EMISSIVE }; virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } @@ -130,6 +131,8 @@ public: /*virtual*/ void endPostDeferredPass(S32 pass); /*virtual*/ void renderPostDeferred(S32 pass); + /*virtual*/ S32 getNumPasses(); + void render(S32 pass = 0); void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE); diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index efffb2df9e..d1c8fa5fc9 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -84,7 +84,7 @@ void LLDrawPoolSky::render(S32 pass) } else if (LLGLSLShader::sNoFixedFunction) { //just use the UI shader (generic single texture no lighting) - gUIProgram.bind(); + gOneTextureNoColorProgram.bind(); } else { @@ -118,7 +118,7 @@ void LLDrawPoolSky::render(S32 pass) S32 face_count = (S32)mDrawFace.size(); LLVertexBuffer::unbind(); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); for (S32 i = 0; i < llmin(6, face_count); ++i) { @@ -146,7 +146,7 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side) LLGLEnable blend(GL_BLEND); mSkyTex[side].bindTexture(FALSE); - glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled + gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled face.renderIndexed(); } } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 3daa0f8261..8d6b31912a 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -106,6 +106,10 @@ U32 LLDrawPoolTerrain::getVertexDataMask() { return LLVertexBuffer::MAP_VERTEX; } + else if (LLGLSLShader::sCurBoundShaderPtr) + { + return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3); + } else { return VERTEX_DATA_MASK; diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index a6e0151114..50a52ac4cf 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -65,17 +65,18 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) if (LLPipeline::sUnderWaterRender) { - shader = &gObjectAlphaMaskNonIndexedWaterProgram; + shader = &gTreeWaterProgram; } else { - shader = &gObjectAlphaMaskNonIndexedProgram; + shader = &gTreeProgram; } if (gPipeline.canUseVertexShaders()) { shader->bind(); shader->setAlphaRange(0.5f, 1.f); + gGL.diffuseColor4f(1,1,1,1); } else { diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 31c14361b5..ae1598907b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -219,7 +219,7 @@ void LLDrawPoolWater::render(S32 pass) water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); } - glColor4fv(water_color.mV); + gGL.diffuseColor4fv(water_color.mV); // Automatically generate texture coords for detail map glEnable(GL_TEXTURE_GEN_S); //texture unit 1 @@ -383,7 +383,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - glColor3f(1.f, 1.f, 1.f); + gGL.diffuseColor3f(1.f, 1.f, 1.f); for (std::vector::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) @@ -623,8 +623,6 @@ void LLDrawPoolWater::shade() water_color.mV[3] = 0.9f; } - glColor4fv(water_color.mV); - { LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); LLGLDisable cullface(GL_CULL_FACE); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 79a835fd14..e4de92490e 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -100,12 +100,12 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass ) { sky_shader = LLPipeline::sUnderWaterRender ? - &gObjectSimpleWaterProgram : + &gObjectFullbrightNoColorWaterProgram : &gWLSkyProgram; cloud_shader = LLPipeline::sUnderWaterRender ? - &gObjectSimpleWaterProgram : + &gObjectFullbrightNoColorWaterProgram : &gWLCloudProgram; } diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index f781d5f3ff..799866091b 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -40,6 +40,7 @@ #include "llvertexbuffer.h" #include "llviewerdisplay.h" #include "llrender.h" +#include "llglslshader.h" // static LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ]; @@ -206,6 +207,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances() return TRUE; } + LLGLSLShader::bindNoShader(); + LLVertexBuffer::unbind(); + //allow fixed function when rendering dynamic textures + bool no_fixed = LLGLSLShader::sNoFixedFunction; + LLGLSLShader::sNoFixedFunction = false; + BOOL result = FALSE; BOOL ret = FALSE ; for( S32 order = 0; order < ORDER_COUNT; order++ ) @@ -236,6 +243,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() } } + LLGLSLShader::sNoFixedFunction = no_fixed; return ret; } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 432e61f6d8..f5a8013f4d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -362,8 +362,8 @@ void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align) { if (align) { - //allocate vertices in blocks of 4 for alignment - num_vertices = (num_vertices + 0x3) & ~0x3; + //allocate vertices in blocks of 16 for alignment + num_vertices = (num_vertices + 0xF) & ~0xF; } if (mGeomCount != num_vertices || @@ -503,7 +503,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); } - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); if (mDrawablep->isState(LLDrawable::RIGGED)) { @@ -1055,6 +1055,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color"); +static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal"); static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index"); @@ -1124,6 +1125,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION); bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR); + bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE); bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD); bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL); @@ -1758,6 +1760,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } + if (rebuild_emissive) + { + LLFastTimer t(FTM_FACE_GEOM_EMISSIVE); + LLStrider emissive; + mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range); + + U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); + + LLVector4a src; + + + U32 glow32 = glow | + (glow << 8) | + (glow << 16) | + (glow << 24); + + U32 vec[4]; + vec[0] = vec[1] = vec[2] = vec[3] = glow32; + + src.loadua((F32*) vec); + + LLVector4a* dst = (LLVector4a*) emissive.get(); + S32 num_vecs = num_vertices/16; + if (num_vertices%16 > 0) + { + ++num_vecs; + } + + for (S32 i = 0; i < num_vecs; i++) + { + dst[i] = src; + } + + if (map_range) + { + mVertexBuffer->setBuffer(0); + } + } if (rebuild_tcoord) { mTexExtents[0].setVec(0,0); @@ -2095,7 +2135,7 @@ void LLFace::renderSetColor() const { const LLColor4* color = &(getRenderColor()); - glColor4fv(color->mV); + gGL.diffuseColor4fv(color->mV); } } diff --git a/indra/newview/llface.h b/indra/newview/llface.h index b5eaeecd60..82e4ab61b7 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -329,13 +329,9 @@ public: { return lhs->getTexture() < rhs->getTexture(); } - else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright()) - { - return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright(); - } else { - return lte->getGlow() < rte->getGlow(); + return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright(); } } }; diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index e4d8e3513d..dc4c15316a 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -691,7 +691,7 @@ BOOL LLImagePreviewAvatar::render() LLVertexBuffer::unbind(); avatarp->updateLOD(); - + if (avatarp->mDrawable.notNull()) { LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); @@ -699,7 +699,7 @@ BOOL LLImagePreviewAvatar::render() LLGLDisable no_blend(GL_BLEND); LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); - + gPipeline.enableLightsPreview(); avatarPoolp->renderAvatars(avatarp); // renders only one avatar } diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ab6753b4be..9f9bbee4b5 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4826,7 +4826,7 @@ BOOL LLModelPreview::render() if (textures) { - glColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); if (i < instance.mMaterial.size() && instance.mMaterial[i].mDiffuseMap.notNull()) { if (instance.mMaterial[i].mDiffuseMap->getDiscardLevel() > -1) @@ -4838,12 +4838,12 @@ BOOL LLModelPreview::render() } else { - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); } buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor3f(0.4f, 0.4f, 0.4f); + gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); if (edges) { @@ -4945,11 +4945,11 @@ BOOL LLModelPreview::render() buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(0.4f, 0.4f, 0.0f, 0.4f); + gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - glColor3f(1.f, 1.f, 0.f); + gGL.diffuseColor3f(1.f, 1.f, 0.f); glLineWidth(2.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -4969,7 +4969,7 @@ BOOL LLModelPreview::render() //show degenerate triangles LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); LLGLDisable cull(GL_CULL_FACE); - glColor4f(1.f,0.f,0.f,1.f); + gGL.diffuseColor4f(1.f,0.f,0.f,1.f); const LLVector4a scale(0.5f); for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) @@ -5133,10 +5133,10 @@ BOOL LLModelPreview::render() } buffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0); - glColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); - glColor3f(0.4f, 0.4f, 0.4f); + gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); if (edges) { diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 85e0043651..d10f6562f7 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -466,11 +466,11 @@ void LLManip::renderXYZ(const LLVector3 &vec) feedback_string = llformat("X: %.3f", vec.mV[VX]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); - glColor3f(0.5f, 1.f, 0.5f); + gGL.diffuseColor3f(0.5f, 1.f, 0.5f); feedback_string = llformat("Y: %.3f", vec.mV[VY]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); - glColor3f(0.5f, 0.5f, 1.f); + gGL.diffuseColor3f(0.5f, 0.5f, 1.f); feedback_string = llformat("Z: %.3f", vec.mV[VZ]); hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index f871df0c36..c4f8369cd0 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1665,7 +1665,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, glStencilFunc(GL_ALWAYS, 0, stencil_mask); gGL.setColorMask(false, false); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); //setup clip plane normal = normal * grid_rotation; @@ -2239,7 +2239,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ break; } - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]); glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f); diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 18d6731fcb..3ff5a05d81 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -169,7 +169,7 @@ void LLPreviewTexture::draw() saveAs(); } // Draw the texture - glColor3f( 1.f, 1.f, 1.f ); + gGL.diffuseColor3f( 1.f, 1.f, 1.f ); gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 26b2b0f5c3..8aa24e9261 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5638,7 +5638,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); { - glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); pushWireframe(drawable); } } @@ -5646,7 +5646,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); - glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); + gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); glLineWidth(3.f); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index e23b431457..064eaa49dd 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2503,7 +2503,7 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask) { params = *j; LLRenderPass::applyModelMatrix(*params); - glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f); + gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f); params->mVertexBuffer->setBuffer(mask); params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES, params->mStart, params->mEnd, params->mCount, params->mOffset); @@ -2560,11 +2560,11 @@ void renderOctree(LLSpatialGroup* group) { if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f) { - glColor4f(0, 1, 0, group->mBuilt); + gGL.diffuseColor4f(0, 1, 0, group->mBuilt); } else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f) { - glColor4f(1, 0, 0, group->mBuilt); + gGL.diffuseColor4f(1, 0, 0, group->mBuilt); } else { @@ -2661,7 +2661,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) if (render_objects) { LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER); - glColor4f(0, 0.5f, 0, 0.5f); + gGL.diffuseColor4f(0, 0.5f, 0, 0.5f); gGL.color4f(0, 0.5f, 0, 0.5f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } @@ -2671,7 +2671,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) if (render_objects) { - glColor4f(0.f, 0.5f, 0.f,1.f); + gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f); gGL.color4f(0.f, 0.5f, 0.f, 1.f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } @@ -2680,7 +2680,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) if (render_objects) { - glColor4f(0.f, 0.75f, 0.f,0.5f); + gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f); gGL.color4f(0.f, 0.75f, 0.f, 0.5f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX); } @@ -2689,11 +2689,11 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) LLVertexBuffer::unbind(); group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX); - glColor4f(1.0f, 0.f, 0.f, 0.5f); + gGL.diffuseColor4f(1.0f, 0.f, 0.f, 0.5f); group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0])); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glColor4f(1.0f, 1.f, 1.f, 1.0f); + gGL.diffuseColor4f(1.0f, 1.f, 1.f, 1.0f); group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0])); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); }*/ @@ -2726,23 +2726,23 @@ void renderUpdateType(LLDrawable* drawablep) switch (vobj->getLastUpdateType()) { case OUT_FULL: - glColor4f(0,1,0,0.5f); + gGL.diffuseColor4f(0,1,0,0.5f); break; case OUT_TERSE_IMPROVED: - glColor4f(0,1,1,0.5f); + gGL.diffuseColor4f(0,1,1,0.5f); break; case OUT_FULL_COMPRESSED: if (vobj->getLastUpdateCached()) { - glColor4f(1,0,0,0.5f); + gGL.diffuseColor4f(1,0,0,0.5f); } else { - glColor4f(1,1,0,0.5f); + gGL.diffuseColor4f(1,1,0,0.5f); } break; case OUT_FULL_CACHED: - glColor4f(0,0,1,0.5f); + gGL.diffuseColor4f(0,0,1,0.5f); break; default: llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl; @@ -2936,7 +2936,7 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo { if (!decomp->mBaseHullMesh.empty()) { - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions, decomp->mBaseHullMesh.mNormals); } else @@ -2956,13 +2956,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color) { - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals); LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonOffset(3.f, 3.f); glLineWidth(3.f); - glColor4fv(line_color.mV); + gGL.diffuseColor4fv(line_color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals); glLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -3044,11 +3044,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) else if (!decomp->mPhysicsShapeMesh.empty()) { //decomp has physics mesh, render that mesh - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glColor4fv(line_color.mV); + gGL.diffuseColor4fv(line_color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } @@ -3174,7 +3174,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glColor4fv(line_color.mV); + gGL.diffuseColor4fv(line_color.mV); LLVertexBuffer::unbind(); llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0); @@ -3182,7 +3182,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); } @@ -3216,7 +3216,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) volume_params.setShear ( 0, 0 ); LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); pushVerts(sphere); LLPrimitive::sVolumeManager->unrefVolume(sphere); } @@ -3230,7 +3230,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) volume_params.setShear ( 0, 0 ); LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); pushVerts(cylinder); LLPrimitive::sVolumeManager->unrefVolume(cylinder); } @@ -3242,10 +3242,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glColor4fv(line_color.mV); + gGL.diffuseColor4fv(line_color.mV); pushVerts(phys_volume); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); pushVerts(phys_volume); LLPrimitive::sVolumeManager->unrefVolume(phys_volume); @@ -3263,10 +3263,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0); LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); - glColor4fv(line_color.mV); + gGL.diffuseColor4fv(line_color.mV); glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); } @@ -3290,10 +3290,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.popMatrix(); /*{ //analytical shape, just push visual rep. - glColor3fv(color.mV); + gGL.diffuseColor3fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); pushVerts(drawable, data_mask); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); pushVerts(drawable, data_mask); }*/ @@ -3335,10 +3335,10 @@ void renderPhysicsShapes(LLSpatialGroup* group) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - glColor3f(0.2f, 0.5f, 0.3f); + gGL.diffuseColor3f(0.2f, 0.5f, 0.3f); buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0); - glColor3f(0.2f, 1.f, 0.3f); + gGL.diffuseColor3f(0.2f, 1.f, 0.3f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0); } @@ -3430,7 +3430,7 @@ void renderTextureAnim(LLDrawInfo* params) } LLGLEnable blend(GL_BLEND); - glColor4f(1,1,0,0.5f); + gGL.diffuseColor4f(1,1,0,0.5f); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } @@ -3456,22 +3456,22 @@ void renderShadowFrusta(LLDrawInfo* params) if (gPipeline.mShadowCamera[4].AABBInFrustum(center, size)) { - glColor3f(1,0,0); + gGL.diffuseColor3f(1,0,0); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } if (gPipeline.mShadowCamera[5].AABBInFrustum(center, size)) { - glColor3f(0,1,0); + gGL.diffuseColor3f(0,1,0); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } if (gPipeline.mShadowCamera[6].AABBInFrustum(center, size)) { - glColor3f(0,0,1); + gGL.diffuseColor3f(0,0,1); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } if (gPipeline.mShadowCamera[7].AABBInFrustum(center, size)) { - glColor3f(1,0,1); + gGL.diffuseColor3f(1,0,1); pushVerts(params, LLVertexBuffer::MAP_VERTEX); } @@ -3489,7 +3489,7 @@ void renderLights(LLDrawable* drawablep) if (drawablep->getNumFaces()) { LLGLEnable blend(GL_BLEND); - glColor4f(0,1,1,0.5f); + gGL.diffuseColor4f(0,1,1,0.5f); for (S32 i = 0; i < drawablep->getNumFaces(); i++) { @@ -3657,7 +3657,7 @@ void renderRaycast(LLDrawable* drawablep) { //render face positions LLVertexBuffer::unbind(); - glColor4f(0,1,1,0.5f); + gGL.diffuseColor4f(0,1,1,0.5f); glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions); glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 54d5d36f6e..077d0fed65 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -93,7 +93,6 @@ public: LLPointer mTexture; std::vector > mTextureList; - LLColor4U mGlowColor; S32 mDebugColor; const LLMatrix4* mTextureMatrix; const LLMatrix4* mModelMatrix; diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index e8abee2fb7..87e7a57ae8 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -295,6 +295,8 @@ BOOL LLTexLayerSetBuffer::render() BOOL success = TRUE; + LLVertexBuffer::unbind(); + //hack to use fixed function when updating tex layer sets bool no_ff = LLGLSLShader::sNoFixedFunction; LLGLSLShader::sNoFixedFunction = false; @@ -304,6 +306,7 @@ BOOL LLTexLayerSetBuffer::render() success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight ); gGL.flush(); + LLVertexBuffer::unbind(); LLGLSLShader::sNoFixedFunction = no_ff; if(upload_now) diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 0115115a23..f4b01a6bab 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -571,7 +571,7 @@ void LLGLTexMemBar::draw() color = (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) ? LLColor4::green : (total_mem < max_total_mem) ? LLColor4::yellow : LLColor4::red; color[VALPHA] = .75f; - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); gl_rect_2d(left, top, right, bottom); // red/yellow/green @@ -594,7 +594,7 @@ void LLGLTexMemBar::draw() color = (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) ? LLColor4::green : (bound_mem < max_bound_mem) ? LLColor4::yellow : LLColor4::red; color[VALPHA] = .75f; - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); gl_rect_2d(left, top, right, bottom); #else diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 77c8bb0329..5e4c124c45 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -527,9 +527,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) // setup current color //---------------------------------------------------------------- if (is_dummy) - glColor4fv(LLVOAvatar::getDummyColor().mV); + gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV); else - glColor4fv(mColor.mV); + gGL.diffuseColor4fv(mColor.mV); stop_glerror(); @@ -547,11 +547,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) if (mIsTransparent) { - glColor4f(1.f, 1.f, 1.f, 1.f); + gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f); } else { - glColor4f(0.7f, 0.6f, 0.3f, 1.f); + gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f); gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); } } @@ -582,13 +582,16 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT)); } - mFace->getVertexBuffer()->setBuffer(sRenderMask); + + U32 mask = sRenderMask; U32 start = mMesh->mFaceVertexOffset; U32 end = start + mMesh->mFaceVertexCount - 1; U32 count = mMesh->mFaceIndexCount; U32 offset = mMesh->mFaceIndexOffset; + LLVertexBuffer* buff = mFace->getVertexBuffer(); + if (mMesh->hasWeights()) { if ((mFace->getPool()->getVertexShaderLevel() > 0)) @@ -597,16 +600,23 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) { uploadJointMatrices(); } + mask = mask | LLVertexBuffer::MAP_WEIGHT; + if (mFace->getPool()->getVertexShaderLevel() > 1) + { + mask = mask | LLVertexBuffer::MAP_CLOTHWEIGHT; + } } - mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset); + buff->setBuffer(mask); + buff->drawRange(LLRender::TRIANGLES, start, end, count, offset); } else { glPushMatrix(); LLMatrix4 jointToWorld = getWorldMatrix(); glMultMatrixf((GLfloat*)jointToWorld.mMatrix); - mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset); + buff->setBuffer(mask); + buff->drawRange(LLRender::TRIANGLES, start, end, count, offset); glPopMatrix(); } gPipeline.addTrianglesDrawn(count); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index fa8d43e0b2..8684322eef 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -66,6 +66,7 @@ LLGLSLShader gOcclusionProgram; LLGLSLShader gCustomAlphaProgram; LLGLSLShader gGlowCombineProgram; LLGLSLShader gTwoTextureAddProgram; +LLGLSLShader gOneTextureNoColorProgram; //object shaders LLGLSLShader gObjectSimpleProgram; @@ -74,6 +75,8 @@ LLGLSLShader gObjectSimpleAlphaMaskProgram; LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; LLGLSLShader gObjectFullbrightProgram; LLGLSLShader gObjectFullbrightWaterProgram; +LLGLSLShader gObjectEmissiveProgram; +LLGLSLShader gObjectEmissiveWaterProgram; LLGLSLShader gObjectFullbrightAlphaMaskProgram; LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram; LLGLSLShader gObjectFullbrightShinyProgram; @@ -81,11 +84,17 @@ LLGLSLShader gObjectFullbrightShinyWaterProgram; LLGLSLShader gObjectShinyProgram; LLGLSLShader gObjectShinyWaterProgram; LLGLSLShader gObjectBumpProgram; +LLGLSLShader gTreeProgram; +LLGLSLShader gTreeWaterProgram; +LLGLSLShader gObjectFullbrightNoColorProgram; +LLGLSLShader gObjectFullbrightNoColorWaterProgram; LLGLSLShader gObjectSimpleNonIndexedProgram; LLGLSLShader gObjectSimpleNonIndexedWaterProgram; LLGLSLShader gObjectAlphaMaskNonIndexedProgram; LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram; +LLGLSLShader gObjectAlphaMaskNoColorProgram; +LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; LLGLSLShader gObjectFullbrightNonIndexedProgram; LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; LLGLSLShader gObjectFullbrightShinyNonIndexedProgram; @@ -123,6 +132,7 @@ LLGLSLShader gAvatarPickProgram; LLGLSLShader gWLSkyProgram; LLGLSLShader gWLCloudProgram; + // Effects Shaders LLGLSLShader gGlowProgram; LLGLSLShader gGlowExtractProgram; @@ -186,14 +196,19 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gWaterProgram); mShaderList.push_back(&gAvatarEyeballProgram); mShaderList.push_back(&gObjectSimpleProgram); + mShaderList.push_back(&gObjectFullbrightNoColorProgram); + mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram); mShaderList.push_back(&gObjectSimpleAlphaMaskProgram); mShaderList.push_back(&gObjectBumpProgram); mShaderList.push_back(&gUIProgram); mShaderList.push_back(&gCustomAlphaProgram); mShaderList.push_back(&gGlowCombineProgram); mShaderList.push_back(&gTwoTextureAddProgram); + mShaderList.push_back(&gOneTextureNoColorProgram); mShaderList.push_back(&gSolidColorProgram); mShaderList.push_back(&gOcclusionProgram); + mShaderList.push_back(&gObjectEmissiveProgram); + mShaderList.push_back(&gObjectEmissiveWaterProgram); mShaderList.push_back(&gObjectFullbrightProgram); mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram); mShaderList.push_back(&gObjectFullbrightShinyProgram); @@ -202,6 +217,10 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectSimpleNonIndexedWaterProgram); mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram); mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram); + mShaderList.push_back(&gObjectAlphaMaskNoColorProgram); + mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram); + mShaderList.push_back(&gTreeProgram); + mShaderList.push_back(&gTreeWaterProgram); mShaderList.push_back(&gObjectFullbrightNonIndexedProgram); mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram); mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram); @@ -266,19 +285,24 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) { if (mReservedAttribs.empty()) { - mReservedAttribs.push_back("materialColor"); - mReservedAttribs.push_back("specularColor"); + //MUST match order of enum in LLVertexBuffer.h + mReservedAttribs.push_back("position"); + mReservedAttribs.push_back("normal"); + mReservedAttribs.push_back("texcoord0"); + mReservedAttribs.push_back("texcoord1"); + mReservedAttribs.push_back("texcoord2"); + mReservedAttribs.push_back("texcoord3"); + mReservedAttribs.push_back("diffuse_color"); + mReservedAttribs.push_back("emissive"); mReservedAttribs.push_back("binormal"); - mReservedAttribs.push_back("object_weight"); - - mAvatarAttribs.reserve(5); - mAvatarAttribs.push_back("weight"); - mAvatarAttribs.push_back("clothing"); - mAvatarAttribs.push_back("gWindDir"); - mAvatarAttribs.push_back("gSinWaveParams"); - mAvatarAttribs.push_back("gGravity"); + mReservedAttribs.push_back("weight"); + mReservedAttribs.push_back("weight4"); + mReservedAttribs.push_back("clothing"); mAvatarUniforms.push_back("matrixPalette"); + mAvatarUniforms.push_back("gWindDir"); + mAvatarUniforms.push_back("gSinWaveParams"); + mAvatarUniforms.push_back("gGravity"); mReservedUniforms.reserve(24); mReservedUniforms.push_back("diffuseMap"); @@ -444,6 +468,7 @@ void LLViewerShaderMgr::setShaders() mMaxAvatarShaderLevel = 0; LLGLSLShader::sNoFixedFunction = false; + LLVertexBuffer::unbind(); if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") && gSavedSettings.getBOOL("VertexShaderEnable")) { @@ -635,8 +660,11 @@ void LLViewerShaderMgr::unloadShaders() gCustomAlphaProgram.unload(); gGlowCombineProgram.unload(); gTwoTextureAddProgram.unload(); + gOneTextureNoColorProgram.unload(); gSolidColorProgram.unload(); + gObjectFullbrightNoColorProgram.unload(); + gObjectFullbrightNoColorWaterProgram.unload(); gObjectSimpleProgram.unload(); gObjectSimpleAlphaMaskProgram.unload(); gObjectBumpProgram.unload(); @@ -644,6 +672,8 @@ void LLViewerShaderMgr::unloadShaders() gObjectSimpleWaterAlphaMaskProgram.unload(); gObjectFullbrightProgram.unload(); gObjectFullbrightWaterProgram.unload(); + gObjectEmissiveProgram.unload(); + gObjectEmissiveWaterProgram.unload(); gObjectFullbrightAlphaMaskProgram.unload(); gObjectFullbrightWaterAlphaMaskProgram.unload(); @@ -656,8 +686,12 @@ void LLViewerShaderMgr::unloadShaders() gObjectSimpleNonIndexedWaterProgram.unload(); gObjectAlphaMaskNonIndexedProgram.unload(); gObjectAlphaMaskNonIndexedWaterProgram.unload(); + gObjectAlphaMaskNoColorProgram.unload(); + gObjectAlphaMaskNoColorWaterProgram.unload(); gObjectFullbrightNonIndexedProgram.unload(); gObjectFullbrightNonIndexedWaterProgram.unload(); + gTreeProgram.unload(); + gTreeWaterProgram.unload(); gObjectShinyNonIndexedProgram.unload(); gObjectFullbrightShinyNonIndexedProgram.unload(); @@ -1472,7 +1506,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarShadowProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms); } if (success) @@ -1504,7 +1538,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms); } if (success) @@ -1521,7 +1555,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms); } if (success) @@ -1677,11 +1711,15 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightShinyProgram.unload(); gObjectFullbrightShinyWaterProgram.unload(); gObjectShinyWaterProgram.unload(); + gObjectFullbrightNoColorProgram.unload(); + gObjectFullbrightNoColorWaterProgram.unload(); gObjectSimpleProgram.unload(); gObjectSimpleAlphaMaskProgram.unload(); gObjectBumpProgram.unload(); gObjectSimpleWaterProgram.unload(); gObjectSimpleWaterAlphaMaskProgram.unload(); + gObjectEmissiveProgram.unload(); + gObjectEmissiveWaterProgram.unload(); gObjectFullbrightProgram.unload(); gObjectFullbrightAlphaMaskProgram.unload(); gObjectFullbrightWaterProgram.unload(); @@ -1694,6 +1732,8 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectSimpleNonIndexedWaterProgram.unload(); gObjectAlphaMaskNonIndexedProgram.unload(); gObjectAlphaMaskNonIndexedWaterProgram.unload(); + gObjectAlphaMaskNoColorProgram.unload(); + gObjectAlphaMaskNoColorWaterProgram.unload(); gObjectFullbrightNonIndexedProgram.unload(); gObjectFullbrightNonIndexedWaterProgram.unload(); gSkinnedObjectSimpleProgram.unload(); @@ -1704,6 +1744,8 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightWaterProgram.unload(); gSkinnedObjectFullbrightShinyWaterProgram.unload(); gSkinnedObjectShinySimpleWaterProgram.unload(); + gTreeProgram.unload(); + gTreeWaterProgram.unload(); return TRUE; } @@ -1752,7 +1794,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true; gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true; gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear(); - gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB)); gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL); @@ -1769,13 +1811,83 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true; gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear(); - gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB)); gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; success = gObjectAlphaMaskNonIndexedWaterProgram.createShader(NULL, NULL); } + if (success) + { + gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader"; + gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true; + gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true; + gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true; + gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true; + gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true; + gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true; + gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true; + gObjectAlphaMaskNoColorProgram.mShaderFiles.clear(); + gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectAlphaMaskNoColorWaterProgram.mName = "No color alpha mask Water Shader"; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesLighting = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasWaterFog = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAtmospherics = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasLighting = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.disableTextureIndex = true; + gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAlphaMask = true; + gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.clear(); + gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectAlphaMaskNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectAlphaMaskNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectAlphaMaskNoColorWaterProgram.createShader(NULL, NULL); + } + + if (success) + { + gTreeProgram.mName = "Tree Shader"; + gTreeProgram.mFeatures.calculatesLighting = true; + gTreeProgram.mFeatures.calculatesAtmospherics = true; + gTreeProgram.mFeatures.hasGamma = true; + gTreeProgram.mFeatures.hasAtmospherics = true; + gTreeProgram.mFeatures.hasLighting = true; + gTreeProgram.mFeatures.disableTextureIndex = true; + gTreeProgram.mFeatures.hasAlphaMask = true; + gTreeProgram.mShaderFiles.clear(); + gTreeProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB)); + gTreeProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); + gTreeProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gTreeProgram.createShader(NULL, NULL); + } + + if (success) + { + gTreeWaterProgram.mName = "Tree Water Shader"; + gTreeWaterProgram.mFeatures.calculatesLighting = true; + gTreeWaterProgram.mFeatures.calculatesAtmospherics = true; + gTreeWaterProgram.mFeatures.hasWaterFog = true; + gTreeWaterProgram.mFeatures.hasAtmospherics = true; + gTreeWaterProgram.mFeatures.hasLighting = true; + gTreeWaterProgram.mFeatures.disableTextureIndex = true; + gTreeWaterProgram.mFeatures.hasAlphaMask = true; + gTreeWaterProgram.mShaderFiles.clear(); + gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB)); + gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gTreeWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gTreeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gTreeWaterProgram.createShader(NULL, NULL); + } + if (success) { gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader"; @@ -1807,6 +1919,37 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gObjectFullbrightNonIndexedWaterProgram.createShader(NULL, NULL); } + if (success) + { + gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader"; + gObjectFullbrightNoColorProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightNoColorProgram.mFeatures.hasGamma = true; + gObjectFullbrightNoColorProgram.mFeatures.hasTransport = true; + gObjectFullbrightNoColorProgram.mFeatures.isFullbright = true; + gObjectFullbrightNoColorProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightNoColorProgram.mShaderFiles.clear(); + gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectFullbrightNoColorProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectFullbrightNoColorWaterProgram.mName = "Non Indexed no color Fullbright Water Shader"; + gObjectFullbrightNoColorWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectFullbrightNoColorWaterProgram.mFeatures.isFullbright = true; + gObjectFullbrightNoColorWaterProgram.mFeatures.hasWaterFog = true; + gObjectFullbrightNoColorWaterProgram.mFeatures.hasTransport = true; + gObjectFullbrightNoColorWaterProgram.mFeatures.disableTextureIndex = true; + gObjectFullbrightNoColorWaterProgram.mShaderFiles.clear(); + gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectFullbrightNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectFullbrightNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectFullbrightNoColorWaterProgram.createShader(NULL, NULL); + } + if (success) { gObjectShinyNonIndexedProgram.mName = "Non Indexed Shiny Shader"; @@ -1892,19 +2035,19 @@ BOOL LLViewerShaderMgr::loadShadersObject() if (success) { - gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader"; - gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true; - gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true; - gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true; - gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleAlphaMaskProgram.mShaderFiles.clear(); - gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); - gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); - gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL); + gObjectSimpleWaterProgram.mName = "Simple Water Shader"; + gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true; + gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; + gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true; + gObjectSimpleWaterProgram.mFeatures.hasLighting = true; + gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0; + gObjectSimpleWaterProgram.mShaderFiles.clear(); + gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectSimpleWaterProgram.createShader(NULL, NULL); } if (success) @@ -1923,23 +2066,24 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gObjectBumpProgram.createShader(NULL, NULL); } + if (success) { - gObjectSimpleWaterProgram.mName = "Simple Water Shader"; - gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true; - gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true; - gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; - gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true; - gObjectSimpleWaterProgram.mFeatures.hasLighting = true; - gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0; - gObjectSimpleWaterProgram.mShaderFiles.clear(); - gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); - gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); - gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; - gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gObjectSimpleWaterProgram.createShader(NULL, NULL); + gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader"; + gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true; + gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true; + gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true; + gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true; + gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true; + gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true; + gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0; + gObjectSimpleAlphaMaskProgram.mShaderFiles.clear(); + gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL); } - + if (success) { gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader"; @@ -1989,6 +2133,37 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gObjectFullbrightWaterProgram.createShader(NULL, NULL); } + if (success) + { + gObjectEmissiveProgram.mName = "Emissive Shader"; + gObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true; + gObjectEmissiveProgram.mFeatures.hasGamma = true; + gObjectEmissiveProgram.mFeatures.hasTransport = true; + gObjectEmissiveProgram.mFeatures.isFullbright = true; + gObjectEmissiveProgram.mFeatures.mIndexedTextureChannels = 0; + gObjectEmissiveProgram.mShaderFiles.clear(); + gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectEmissiveProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectEmissiveWaterProgram.mName = "Emissive Water Shader"; + gObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectEmissiveWaterProgram.mFeatures.isFullbright = true; + gObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true; + gObjectEmissiveWaterProgram.mFeatures.hasTransport = true; + gObjectEmissiveWaterProgram.mFeatures.mIndexedTextureChannels = 0; + gObjectEmissiveWaterProgram.mShaderFiles.clear(); + gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectEmissiveWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectEmissiveWaterProgram.createShader(NULL, NULL); + } + if (success) { gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader"; @@ -2272,7 +2447,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR]; - success = gAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gAvatarProgram.createShader(NULL, &mAvatarUniforms); if (success) { @@ -2291,7 +2466,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() // Note: no cloth under water: gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1); gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; - success = gAvatarWaterProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms); } /// Keep track of avatar levels @@ -2310,7 +2485,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar() gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB)); gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB)); gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR]; - success = gAvatarPickProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); + success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms); } if (success) @@ -2414,6 +2589,21 @@ BOOL LLViewerShaderMgr::loadShadersInterface() } } + if (success) + { + gOneTextureNoColorProgram.mName = "One Texture No Color Shader"; + gOneTextureNoColorProgram.mShaderFiles.clear(); + gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB)); + gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorF.glsl", GL_FRAGMENT_SHADER_ARB)); + gOneTextureNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gOneTextureNoColorProgram.createShader(NULL, NULL); + if (success) + { + gOneTextureNoColorProgram.bind(); + gOneTextureNoColorProgram.uniform1i("tex0", 0); + } + } + if (success) { gSolidColorProgram.mName = "Solid Color Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 629ef32adb..ced7ed06d9 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -186,16 +186,10 @@ public: typedef enum { - AVATAR_WEIGHT = END_RESERVED_ATTRIBS, - AVATAR_CLOTHING, + AVATAR_MATRIX = END_RESERVED_UNIFORMS, AVATAR_WIND, AVATAR_SINWAVE, - AVATAR_GRAVITY - } eAvatarAttribs; - - typedef enum - { - AVATAR_MATRIX = END_RESERVED_UNIFORMS + AVATAR_GRAVITY, } eAvatarUniforms; // simple model of forward iterator @@ -265,9 +259,6 @@ private: std::vector mGlowExtractUniforms; - //avatar shader parameter tables - std::vector mAvatarAttribs; - std::vector mAvatarUniforms; // the list of shaders we need to propagate parameters to. @@ -294,7 +285,9 @@ extern LLGLSLShader gGlowCombineProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; - + +extern LLGLSLShader gOneTextureNoColorProgram; + //object shaders extern LLGLSLShader gObjectSimpleProgram; extern LLGLSLShader gObjectSimpleAlphaMaskProgram; @@ -304,13 +297,21 @@ extern LLGLSLShader gObjectSimpleNonIndexedProgram; extern LLGLSLShader gObjectSimpleNonIndexedWaterProgram; extern LLGLSLShader gObjectAlphaMaskNonIndexedProgram; extern LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram; +extern LLGLSLShader gObjectAlphaMaskNoColorProgram; +extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; extern LLGLSLShader gObjectFullbrightProgram; extern LLGLSLShader gObjectFullbrightWaterProgram; +extern LLGLSLShader gObjectFullbrightNoColorProgram; +extern LLGLSLShader gObjectFullbrightNoColorWaterProgram; +extern LLGLSLShader gObjectEmissiveProgram; +extern LLGLSLShader gObjectEmissiveWaterProgram; extern LLGLSLShader gObjectFullbrightAlphaMaskProgram; extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram; extern LLGLSLShader gObjectFullbrightNonIndexedProgram; extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; extern LLGLSLShader gObjectBumpProgram; +extern LLGLSLShader gTreeProgram; +extern LLGLSLShader gTreeWaterProgram; extern LLGLSLShader gObjectSimpleLODProgram; extern LLGLSLShader gObjectFullbrightLODProgram; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 988c4ed1a2..6af268f234 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3458,7 +3458,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, glScalef(scale, scale, scale); LLColor4 color(vovolume->getLightColor(), .5f); - glColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); F32 pixel_area = 100000.f; // Render Outside diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 510525259f..0b746c841c 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -59,6 +59,12 @@ public: // virtual void setupVertexBuffer(U32 data_mask) const { + if (LLGLSLShader::sNoFixedFunction) + { //just use default if shaders are in play + LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3)); + return; + } + U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData; //assume tex coords 2 and 3 are present diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 4c137d3394..4c4ff26df8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3830,8 +3830,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } } - U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255); - if (idx >= 0 && draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 && @@ -3840,7 +3838,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange && draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange && #endif - draw_vec[idx]->mGlowColor.mV[3] == glow && draw_vec[idx]->mFullbright == fullbright && draw_vec[idx]->mBump == bump && draw_vec[idx]->mTextureMatrix == tex_mat && @@ -3872,7 +3869,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - draw_info->mGlowColor.setVec(0,0,0,glow); if (type == LLRenderPass::PASS_ALPHA) { //for alpha sorting facep->setDrawInfo(draw_info); @@ -3972,6 +3968,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 cur_total = 0; + bool emissive = false; + //get all the faces into a list for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) { @@ -4183,6 +4181,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } } + if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0) { facep->clearVertexBuffer(); @@ -4196,6 +4195,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) const LLTextureEntry* te = facep->getTextureEntry(); LLViewerTexture* tex = facep->getTexture(); + if (te->getGlow() >= 1.f/255.f) + { + emissive = true; + } + if (facep->isState(LLFace::TEXTURE_ANIM)) { if (!vobj->mTexAnimMode) @@ -4312,6 +4316,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; + if (emissive) + { //emissive faces are present, include emissive byte to preserve batching + simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE; + alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE; + bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE; + fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE; + } + bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; if (batch_textures) @@ -4455,10 +4467,6 @@ struct CompareBatchBreakerModified { return lte->getFullbright() < rte->getFullbright(); } - else if (lte->getGlow() != rte->getGlow()) - { - return lte->getGlow() < rte->getGlow(); - } else { return lhs->getTexture() < rhs->getTexture(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7c2eaecf8b..8620894229 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -138,7 +138,7 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f; const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10; const U32 REFLECTION_MAP_RES = 128; - +const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; // Max number of occluders to search for. JC const S32 MAX_OCCLUDER_COUNT = 2; @@ -457,6 +457,8 @@ void LLPipeline::init() mSpotLightFade[i] = 1.f; } + mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); + mDeferredVB->allocateBuffer(3, 0, true); setLightingDetail(-1); } @@ -535,6 +537,8 @@ void LLPipeline::cleanup() mMovedBridge.clear(); mInitialized = FALSE; + + mDeferredVB = NULL; } //============================================================================ @@ -6983,6 +6987,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen shader.uniform1f("lum_scale", gSavedSettings.getF32("RenderLuminanceScale")); shader.uniform1f("sun_lum_scale", gSavedSettings.getF32("RenderSunLuminanceScale")); shader.uniform1f("sun_lum_offset", gSavedSettings.getF32("RenderSunLuminanceOffset")); + shader.uniform3fv("sun_dir", 1, mTransformedSunDir.mV); shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail")); shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange")); shader.uniform1f("gi_brightness", gSavedSettings.getF32("RenderGIBrightness")); @@ -7057,21 +7062,23 @@ void LLPipeline::renderDeferredLighting() glh::matrix4f mat = glh_copy_matrix(gGLModelView); - F32 vert[] = - { - -1,1, - -1,-3, - 3,1, - }; - glVertexPointer(2, GL_FLOAT, 0, vert); - glColor3f(1,1,1); + LLStrider vert; + mDeferredVB->getVertexStrider(vert); + LLStrider tc0; + LLStrider tc1; + mDeferredVB->getTexCoord0Strider(tc0); + mDeferredVB->getTexCoord1Strider(tc1); + vert[0].set(-1,1,0); + vert[1].set(-1,-3,0); + vert[2].set(3,1,0); + { setupHWLights(NULL); //to set mSunDir; LLVector4 dir(mSunDir, 0.f); glh::vec4f tc(dir.mV); mat.mult_matrix_vec(tc); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0); + mTransformedSunDir.set(dir.mV); } glPushMatrix(); @@ -7335,10 +7342,10 @@ void LLPipeline::renderDeferredLighting() glPushMatrix(); glLoadIdentity(); - glVertexPointer(2, GL_FLOAT, 0, vert); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); @@ -7347,7 +7354,7 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredSoftenProgram); } - { //render sky + { //render non-deferred geometry (fullbright, alpha, etc) LLGLDisable blend(GL_BLEND); LLGLDisable stencil(GL_STENCIL_TEST); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -7476,7 +7483,7 @@ void LLPipeline::renderDeferredLighting() LLFastTimer ftm(FTM_LOCAL_LIGHTS); glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); stop_glerror(); @@ -7542,7 +7549,7 @@ void LLPipeline::renderDeferredLighting() v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); } @@ -7553,6 +7560,8 @@ void LLPipeline::renderDeferredLighting() { bindDeferredShader(gDeferredMultiLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + LLGLDepthTest depth(GL_FALSE); //full screen blit @@ -7568,7 +7577,7 @@ void LLPipeline::renderDeferredLighting() LLVector4 light[max_count]; LLVector4 col[max_count]; - glVertexPointer(2, GL_FLOAT, 0, vert); +// glVertexPointer(2, GL_FLOAT, 0, vert); F32 far_z = 0.f; @@ -7591,7 +7600,8 @@ void LLPipeline::renderDeferredLighting() gDeferredMultiLightProgram.uniform1f("far_z", far_z); far_z = 0.f; count = 0; - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } } @@ -7623,7 +7633,7 @@ void LLPipeline::renderDeferredLighting() col *= volume->getLightIntensity(); glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); } @@ -7660,8 +7670,8 @@ void LLPipeline::renderDeferredLighting() LLVertexBuffer::unbind(); - glVertexPointer(2, GL_FLOAT, 0, vert); - glColor3f(1,1,1); +// glVertexPointer(2, GL_FLOAT, 0, vert); + gGL.diffuseColor3f(1,1,1); glPushMatrix(); glLoadIdentity(); @@ -8297,7 +8307,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); stop_glerror(); @@ -8341,7 +8351,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 28e6526acd..61ab84588d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -536,6 +536,9 @@ public: LLRenderTarget mHighlight; LLRenderTarget mPhysicsDisplay; + //utility buffer for rendering post effects, gets abused by renderDeferredLighting + LLPointer mDeferredVB; + //sun shadow map LLRenderTarget mShadow[6]; std::vector mShadowFrustPoints[4]; @@ -581,6 +584,7 @@ public: LLColor4 mSunDiffuse; LLVector3 mSunDir; + LLVector3 mTransformedSunDir; BOOL mInitialized; BOOL mVertexShadersEnabled; -- cgit v1.2.3 From 2ee815478043c4d5845f094f744a055707dba0e0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 13:01:14 -0500 Subject: SH-2238, SH-2223, SH-SH-2242 glVertexAttrib throughout main render pipeline complete, preview renders and debug displays still pending. Also fixed a render glitch and a crash (JIRAs listed). --- indra/llrender/llglslshader.cpp | 2 + indra/llrender/llrendersphere.cpp | 97 +------- indra/llrender/llrendersphere.h | 5 - indra/llrender/llvertexbuffer.cpp | 62 ++++- indra/llrender/llvertexbuffer.h | 3 +- .../shaders/class1/avatar/objectSkinV.glsl | 6 +- .../class1/deferred/alphaNonIndexedNoColorF.glsl | 63 +++++ .../shaders/class1/deferred/avatarAlphaV.glsl | 13 +- .../shaders/class1/deferred/avatarF.glsl | 2 +- .../shaders/class1/deferred/avatarShadowF.glsl | 1 - .../shaders/class1/deferred/avatarShadowV.glsl | 4 - .../shaders/class1/deferred/avatarV.glsl | 3 - .../shaders/class1/deferred/diffuseAlphaMaskF.glsl | 4 +- .../class1/deferred/diffuseAlphaMaskNoColorF.glsl | 30 +++ .../shaders/class1/deferred/diffuseNoColorV.glsl | 23 ++ .../shaders/class1/deferred/emissiveF.glsl | 28 +++ .../shaders/class1/deferred/emissiveV.glsl | 38 +++ .../shaders/class1/deferred/multiPointLightV.glsl | 2 - .../shaders/class1/deferred/multiSpotLightF.glsl | 23 +- .../shaders/class1/deferred/pointLightF.glsl | 15 +- .../shaders/class1/deferred/pointLightV.glsl | 10 - .../shaders/class1/deferred/softenLightF.glsl | 1 + .../shaders/class1/deferred/spotLightF.glsl | 18 +- .../shaders/class1/deferred/sunLightSSAOF.glsl | 1 - .../shaders/class1/deferred/sunLightV.glsl | 10 - .../shaders/class1/deferred/treeF.glsl | 10 +- .../shaders/class1/deferred/treeShadowF.glsl | 27 +++ .../shaders/class1/deferred/treeShadowV.glsl | 23 ++ .../shaders/class1/deferred/treeV.glsl | 1 - .../class1/interface/onetexturenocolorF.glsl | 13 ++ .../class1/interface/onetexturenocolorV.glsl | 18 ++ .../app_settings/shaders/class1/interface/uiV.glsl | 2 +- .../app_settings/shaders/class1/objects.zip | Bin 0 -> 6772 bytes .../shaders/class1/objects/emissiveSkinnedV.glsl | 33 +++ .../shaders/class1/objects/emissiveV.glsl | 29 +++ .../shaders/class1/objects/fullbrightNoColorV.glsl | 27 +++ .../shaders/class1/objects/simpleNoColorV.glsl | 30 +++ .../app_settings/shaders/class1/objects/treeV.glsl | 35 +++ .../class2/deferred/alphaNonIndexedNoColorF.glsl | 121 ++++++++++ .../shaders/class2/deferred/alphaSkinnedV.glsl | 4 +- .../shaders/class2/deferred/avatarAlphaV.glsl | 13 +- .../shaders/class2/deferred/multiSpotLightF.glsl | 17 +- .../shaders/class2/deferred/softenLightF.glsl | 7 +- .../shaders/class2/deferred/softenLightV.glsl | 5 +- .../shaders/class2/deferred/sunLightSSAOF.glsl | 6 +- .../shaders/class2/deferred/sunLightV.glsl | 9 - .../shaders/class2/objects/simpleNonIndexedV.glsl | 36 +++ indra/newview/llagent.cpp | 4 +- indra/newview/llcylinder.cpp | 260 ++------------------- indra/newview/llcylinder.h | 33 +-- indra/newview/lldrawpoolalpha.cpp | 3 +- indra/newview/lldrawpoolavatar.cpp | 105 ++++----- indra/newview/lldrawpoolavatar.h | 2 +- indra/newview/lldrawpoolsimple.cpp | 5 +- indra/newview/lldrawpooltree.cpp | 7 +- indra/newview/llfloatermodelpreview.cpp | 20 +- indra/newview/llhudeffectbeam.cpp | 4 +- indra/newview/llmaniptranslate.cpp | 3 +- indra/newview/llselectmgr.cpp | 55 +++-- indra/newview/llspatialpartition.cpp | 2 +- indra/newview/lltracker.cpp | 8 +- indra/newview/llviewerjointmesh.cpp | 8 +- indra/newview/llviewershadermgr.cpp | 128 +++++++++- indra/newview/llviewershadermgr.h | 19 +- indra/newview/llviewerwindow.cpp | 28 +-- indra/newview/llvosurfacepatch.cpp | 14 -- indra/newview/llwlparamset.cpp | 8 +- indra/newview/pipeline.cpp | 126 ++++++---- 68 files changed, 1095 insertions(+), 677 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects.zip create mode 100644 indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/treeV.glsl create mode 100644 indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b6cb84d10c..02bcc9e338 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -934,7 +934,9 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v std::map::iterator iter = mValue.find(location); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { + stop_glerror(); glUniform4fvARB(location, count, v); + stop_glerror(); mValue[location] = vec; } } diff --git a/indra/llrender/llrendersphere.cpp b/indra/llrender/llrendersphere.cpp index a5cd70445f..e7e07a1ab2 100644 --- a/indra/llrender/llrendersphere.cpp +++ b/indra/llrender/llrendersphere.cpp @@ -35,106 +35,11 @@ #include "llglheaders.h" -GLUquadricObj *gQuadObj2 = NULL; LLRenderSphere gSphere; -void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks); - -void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks) -{ - if (!gQuadObj2) - { - gQuadObj2 = gluNewQuadric(); - if (!gQuadObj2) - { - llwarns << "drawSolidSphere couldn't allocate quadric" << llendl; - return; - } - } - - gluQuadricDrawStyle(gQuadObj2, GLU_FILL); - gluQuadricNormals(gQuadObj2, GLU_SMOOTH); - // If we ever changed/used the texture or orientation state - // of quadObj, we'd need to change it to the defaults here - // with gluQuadricTexture and/or gluQuadricOrientation. - gluQuadricTexture(gQuadObj2, GL_TRUE); - gluSphere(gQuadObj2, radius, slices, stacks); -} - - -// A couple thoughts on sphere drawing: -// 1) You need more slices than stacks, but little less than 2:1 -// 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother -void LLRenderSphere::prerender() -{ - // Create a series of display lists for different LODs - mDList[0] = glGenLists(1); - glNewList(mDList[0], GL_COMPILE); - drawSolidSphere(1.0, 30, 20); - glEndList(); - - mDList[1] = glGenLists(1); - glNewList(mDList[1], GL_COMPILE); - drawSolidSphere(1.0, 20, 15); - glEndList(); - - mDList[2] = glGenLists(1); - glNewList(mDList[2], GL_COMPILE); - drawSolidSphere(1.0, 12, 8); - glEndList(); - - mDList[3] = glGenLists(1); - glNewList(mDList[3], GL_COMPILE); - drawSolidSphere(1.0, 8, 5); - glEndList(); -} - -void LLRenderSphere::cleanupGL() -{ - for (S32 detail = 0; detail < 4; detail++) - { - glDeleteLists(mDList[detail], 1); - mDList[detail] = 0; - } - - if (gQuadObj2) - { - gluDeleteQuadric(gQuadObj2); - gQuadObj2 = NULL; - } -} - -// Constants here are empirically derived from my eyeballs, JNC -// -// The toughest adjustment is the cutoff for the lowest LOD -// Maybe we should have more LODs at the low end? -void LLRenderSphere::render(F32 pixel_area) -{ - S32 level_of_detail; - - if (pixel_area > 10000.f) - { - level_of_detail = 0; - } - else if (pixel_area > 800.f) - { - level_of_detail = 1; - } - else if (pixel_area > 100.f) - { - level_of_detail = 2; - } - else - { - level_of_detail = 3; - } - glCallList(mDList[level_of_detail]); -} - - void LLRenderSphere::render() { - glCallList(mDList[0]); + renderGGL(); } inline LLVector3 polar_to_cart(F32 latitude, F32 longitude) diff --git a/indra/llrender/llrendersphere.h b/indra/llrender/llrendersphere.h index 96a6bec80c..f8e9e86e7f 100644 --- a/indra/llrender/llrendersphere.h +++ b/indra/llrender/llrendersphere.h @@ -40,11 +40,6 @@ void lat2xyz(LLVector3 * result, F32 lat, F32 lon); // utility routine class LLRenderSphere { public: - LLGLuint mDList[5]; - - void prerender(); - void cleanupGL(); - void render(F32 pixel_area); // of a box of size 1.0 at that position void render(); // render at highest LOD void renderGGL(); // render using LLRender diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index a5977d658d..5d19168842 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -62,7 +62,6 @@ U32 LLVertexBuffer::sAllocatedBytes = 0; BOOL LLVertexBuffer::sMapped = FALSE; BOOL LLVertexBuffer::sUseStreamDraw = TRUE; BOOL LLVertexBuffer::sPreferStreamDraw = FALSE; -S32 LLVertexBuffer::sWeight4Loc = -1; std::vector LLVertexBuffer::sDeleteList; @@ -355,6 +354,8 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) //static void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, const std::vector& norm) { + llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + U32 count = pos.size(); llassert_always(norm.size() >= pos.size()); llassert_always(count > 0) ; @@ -369,6 +370,49 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con glDrawArrays(sGLMode[mode], 0, count); } +//static +void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp) +{ + llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + + U32 mask = LLVertexBuffer::MAP_VERTEX; + if (tc) + { + mask = mask | LLVertexBuffer::MAP_TEXCOORD0; + } + + unbind(); + + setupClientArrays(mask); + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader) + { + S32 loc = shader->getAttribLocation(LLVertexBuffer::TYPE_VERTEX); + if (loc > -1) + { + glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 16, pos); + + if (tc) + { + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_TEXCOORD0); + if (loc > -1) + { + glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, 0, tc); + } + } + } + } + else + { + glTexCoordPointer(2, GL_FLOAT, 0, tc); + glVertexPointer(3, GL_FLOAT, 16, pos); + } + + glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp); +} + void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const { if (start >= (U32) mRequestedNumVerts || @@ -403,6 +447,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi validateRange(start, end, count, indices_offset); llassert(mRequestedNumVerts >= 0); + llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); if (mGLIndices != sGLRenderIndices) { @@ -431,6 +476,8 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const { + llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + llassert(mRequestedNumIndices >= 0); if (indices_offset >= (U32) mRequestedNumIndices || indices_offset + count > (U32) mRequestedNumIndices) @@ -463,6 +510,8 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { + llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + llassert(mRequestedNumVerts >= 0); if (first >= (U32) mRequestedNumVerts || first + count > (U32) mRequestedNumVerts) @@ -2037,9 +2086,16 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const } - if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1) + if (data_mask & MAP_WEIGHT4) { - glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4])); + if (shader) + { + S32 loc = shader->getAttribLocation(TYPE_WEIGHT4); + if (loc > -1) + { + glVertexAttribPointerARB(loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4])); + } + } } if (data_mask & MAP_CLOTHWEIGHT) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 3cccdf62ec..9497bc9357 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -111,8 +111,6 @@ public: static LLVBOPool sStreamIBOPool; static LLVBOPool sDynamicIBOPool; - static S32 sWeight4Loc; - static BOOL sUseStreamDraw; static BOOL sPreferStreamDraw; @@ -120,6 +118,7 @@ public: static void cleanupClass(); static void setupClientArrays(U32 data_mask); static void drawArrays(U32 mode, const std::vector& pos, const std::vector& norm); + static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp); static void clientCopy(F64 max_time = 0.005); //copy data from client to GL static void unbind(); //unbind any bound vertex buffer diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 7613e50dca..35c5a38081 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -7,7 +7,7 @@ -attribute vec4 object_weight; +attribute vec4 weight4; uniform mat4 matrixPalette[32]; @@ -15,8 +15,8 @@ mat4 getObjectSkinnedTransform() { int i; - vec4 w = fract(object_weight); - vec4 index = floor(object_weight); + vec4 w = fract(weight4); + vec4 index = floor(weight4); float scale = 1.0/(w.x+w.y+w.z+w.w); w *= scale; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl new file mode 100644 index 0000000000..5d1306bfc9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl @@ -0,0 +1,63 @@ +/** + * @file alphaNonIndexedNoColorF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap; + +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform vec2 screen_res; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).a; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; +} + +void main() +{ + vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; + frag *= screen_res; + + vec4 pos = vec4(vary_position, 1.0); + + vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy); + + vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0); + vec4 color = diff * col; + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + + color.rgb += diff.rgb * vary_pointlight_col.rgb; + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 842931ec17..468d7332a6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -7,7 +7,6 @@ attribute vec3 position; attribute vec3 normal; -attribute vec4 diffuse_color; attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -86,9 +85,7 @@ void main() calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - - vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -98,17 +95,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*diffuse_color.rgb; + vary_pointlight_col = col.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*diffuse_color.rgb; - vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); + vary_ambient = col.rgb; + vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0)); - col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); + col.rgb = min(col.rgb, 1.0); gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index 3268618093..d8e8f6088d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -13,7 +13,7 @@ varying vec3 vary_normal; void main() { - vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy); if (diff.a < 0.2) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 78986ab12e..c693725074 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -13,7 +13,6 @@ varying vec4 post_pos; void main() { - //gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); gl_FragColor = vec4(1,1,1,1); gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index cf6fc1c0ed..35d0bb5603 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -11,10 +11,8 @@ mat4 getSkinnedTransform(); attribute vec3 position; attribute vec3 normal; -attribute vec4 diffuse_color; attribute vec2 texcoord0; - varying vec4 post_pos; void main() @@ -40,8 +38,6 @@ void main() post_pos = pos; gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); - - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index e66f8c8483..9ef11109ed 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -6,7 +6,6 @@ */ attribute vec3 position; -attribute vec4 diffuse_color; attribute vec3 normal; attribute vec2 texcoord0; @@ -38,8 +37,6 @@ void main() vary_normal = norm; gl_Position = gl_ProjectionMatrix * pos; - - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index 338d0ebb2b..26355731ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -1,5 +1,5 @@ /** - * @file diffuseF.glsl + * @file diffuseAlphaMaskF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * $/LicenseInfo$ @@ -15,7 +15,7 @@ varying vec3 vary_normal; void main() { - vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; if (col.a < minimum_alpha || col.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl new file mode 100644 index 0000000000..dfc1b52c2e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl @@ -0,0 +1,30 @@ +/** + * @file diffuseAlphaMaskNoColorF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + +uniform float minimum_alpha; +uniform float maximum_alpha; + +uniform sampler2D diffuseMap; + +varying vec3 vary_normal; + +void main() +{ + vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); + + if (col.a < minimum_alpha || col.a > maximum_alpha) + { + discard; + } + + gl_FragData[0] = vec4(col.rgb, 0.0); + gl_FragData[1] = vec4(0,0,0,0); // spec + vec3 nvn = normalize(vary_normal); + gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl new file mode 100644 index 0000000000..ff9578e253 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -0,0 +1,23 @@ +/** + * @file diffuseNoColorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; + +varying vec3 vary_normal; +varying float vary_texture_index; + +void main() +{ + //transform vertex + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vary_normal = normalize(gl_NormalMatrix * normal); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl new file mode 100644 index 0000000000..5a9a6196f3 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -0,0 +1,28 @@ +/** + * @file emissiveF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable + +vec3 fullbrightAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + + +void main() +{ + float shadow = 1.0; + + vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color; + + color.rgb = fullbrightAtmosTransport(color.rgb); + + color.rgb = fullbrightScaleSoftClip(color.rgb); + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl new file mode 100644 index 0000000000..9841943fe6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -0,0 +1,38 @@ +/** + * @file emissiveV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + +attribute vec4 position; +attribute float emissive; +attribute vec2 texcoord0; + +void calcAtmospherics(vec3 inPositionEye); + +vec3 atmosAmbient(vec3 light); +vec3 atmosAffectDirectionalLight(float lightIntensity); +vec3 scaleDownLight(vec3 light); +vec3 scaleUpLight(vec3 light); + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz, 1.0); + vec4 pos = (gl_ModelViewMatrix * vert); + vary_texture_index = position.w; + + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(0,0,0,emissive); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index 7db577c07a..bb0497b309 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -7,7 +7,6 @@ attribute vec3 position; -attribute vec4 diffuse_color; varying vec4 vary_fragcoord; @@ -18,5 +17,4 @@ void main() vary_fragcoord = pos; gl_Position = pos; - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 0d25d7792d..6c08f7b51f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -37,7 +37,10 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +uniform vec3 center; +uniform vec3 color; +uniform float falloff; +uniform float size; varying vec4 vary_fragcoord; uniform vec2 screen_res; @@ -92,7 +95,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) vec4 getPosition(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen.xy).a; + float depth = texture2DRect(depthMap, pos_screen.xy).r; vec2 sc = pos_screen.xy*2.0; sc /= screen_res; sc -= vec2(1.0,1.0); @@ -111,9 +114,9 @@ void main() frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos.xyz; + vec3 lv = center.xyz-pos.xyz; float dist2 = dot(lv,lv); - dist2 /= vary_light.w; + dist2 /= size; if (dist2 > 1.0) { discard; @@ -127,16 +130,16 @@ void main() vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); if (proj_tc.z < 0.0) { - discard; + //discard; } proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = falloff+1.0; float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); if (dist_atten <= 0.0) { - discard; + //discard; } lv = proj_origin-pos.xyz; @@ -164,7 +167,7 @@ void main() vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -181,7 +184,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -214,7 +217,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; + col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 5efa3200d4..601bb17bc7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -20,7 +20,10 @@ uniform sampler2DRect depthMap; uniform vec3 env_mat[3]; uniform float sun_wash; -varying vec4 vary_light; +uniform vec3 center; +uniform vec3 color; +uniform float falloff; +uniform float size; varying vec4 vary_fragcoord; uniform vec2 screen_res; @@ -49,9 +52,9 @@ void main() frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos; + vec3 lv = center.xyz-pos; float dist2 = dot(lv,lv); - dist2 /= vary_light.w; + dist2 /= size; if (dist2 > 1.0) { discard; @@ -72,11 +75,11 @@ void main() float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; - float fa = gl_Color.a+1.0; + float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); float lit = da * dist_atten * noise; - col = gl_Color.rgb*lit*col; + col = color.rgb*lit*col; vec4 spec = texture2DRect(specularRect, frag.xy); if (spec.a > 0.0) @@ -86,7 +89,7 @@ void main() { sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); sa *= noise; - col += da*sa*gl_Color.rgb*spec.rgb; + col += da*sa*color.rgb*spec.rgb; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index ac3170d16d..a09cfa2661 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -6,10 +6,7 @@ */ attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; -varying vec4 vary_light; varying vec4 vary_fragcoord; void main() @@ -18,12 +15,5 @@ void main() vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); vary_fragcoord = pos; - vec4 tex = vec4(texcoord0,0,1); - tex.w = 1.0; - - vary_light = vec4(texcoord0,0,1); - gl_Position = pos; - - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 3ba5ee5bd2..35ab77d3cc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -306,5 +306,6 @@ void main() } gl_FragColor.rgb = col; + gl_FragColor.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 9aaffc15bf..ed67dc32d5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -13,7 +13,6 @@ uniform sampler2DRect diffuseRect; uniform sampler2DRect specularRect; uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; -uniform samplerCube environmentMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; uniform sampler2D projectionMap; @@ -32,7 +31,10 @@ uniform float far_clip; uniform vec3 proj_origin; //origin of projection to be used for angular attenuation uniform float sun_wash; -varying vec4 vary_light; +uniform vec3 center; +uniform vec3 color; +uniform float falloff; +uniform float size; varying vec4 vary_fragcoord; uniform vec2 screen_res; @@ -60,9 +62,9 @@ void main() frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos.xyz; + vec3 lv = center.xyz-pos.xyz; float dist2 = dot(lv,lv); - dist2 /= vary_light.w; + dist2 /= size; if (dist2 > 1.0) { discard; @@ -82,7 +84,7 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); lv = proj_origin-pos.xyz; @@ -108,7 +110,7 @@ void main() vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -127,7 +129,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -156,7 +158,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; + col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 665d8126a0..6bbf86177a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -25,7 +25,6 @@ uniform float ssao_factor; uniform float ssao_factor_inv; varying vec2 vary_fragcoord; -varying vec4 vary_light; uniform mat4 inv_proj; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 65fa288e88..d39bfef4ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -6,11 +6,7 @@ */ attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; -varying vec4 vary_light; varying vec2 vary_fragcoord; uniform vec2 screen_res; @@ -22,10 +18,4 @@ void main() gl_Position = pos; vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = vec4(texcoord0,0,1); - tex.w = 1.0; - - vary_light = vec4(texcoord0,0,1); - - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index de7e038402..08a3bc251a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -11,10 +11,18 @@ uniform sampler2D diffuseMap; varying vec3 vary_normal; +uniform float minimum_alpha; +uniform float maximum_alpha; + void main() { vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); - gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005); + if (col.a < minimum_alpha || col.a > maximum_alpha) + { + discard; + } + + gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, 0.0); gl_FragData[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl new file mode 100644 index 0000000000..9f0b902c96 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -0,0 +1,27 @@ +/** + * @file treeShadowF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +uniform float minimum_alpha; +uniform float maximum_alpha; + +uniform sampler2D diffuseMap; + +varying vec4 post_pos; + +void main() +{ + float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a; + + if (alpha < minimum_alpha || alpha > maximum_alpha) + { + discard; + } + + gl_FragColor = vec4(1,1,1,1); + + gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl new file mode 100644 index 0000000000..42ce2f5226 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl @@ -0,0 +1,23 @@ +/** + * @file treeShadowV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec3 position; +attribute vec2 texcoord0; + +varying vec4 post_pos; + +void main() +{ + //transform vertex + vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + + post_pos = pos; + + gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); + + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 07e56e84db..f56f389348 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -10,7 +10,6 @@ attribute vec3 position; attribute vec3 normal; attribute vec2 texcoord0; - varying vec3 vary_normal; void main() diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl new file mode 100644 index 0000000000..a5442c9bf4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl @@ -0,0 +1,13 @@ +/** + * @file onetexturenocolorF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +uniform sampler2D tex0; + +void main() +{ + gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy); +} diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl new file mode 100644 index 0000000000..7df45e90e6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl @@ -0,0 +1,18 @@ +/** + * @file onetexturenocolorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + +attribute vec3 position; +attribute vec2 texcoord0; + + +void main() +{ + gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1); + gl_TexCoord[0] = vec4(texcoord0,0,1); +} + diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl index ebf2361da4..9d129caf21 100644 --- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl @@ -14,7 +14,7 @@ attribute vec2 texcoord0; void main() { gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1); - gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/objects.zip b/indra/newview/app_settings/shaders/class1/objects.zip new file mode 100644 index 0000000000..7e43660731 Binary files /dev/null and b/indra/newview/app_settings/shaders/class1/objects.zip differ diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl new file mode 100644 index 0000000000..78668711ac --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -0,0 +1,33 @@ +/** + * @file emissiveSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + + +attribute vec3 position; +attribute float emissive; +attribute vec2 texcoord0; + +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +void main() +{ + //transform vertex + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + mat4 mat = getObjectSkinnedTransform(); + + mat = gl_ModelViewMatrix * mat; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; + + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(0,0,0,emissive); + + gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl new file mode 100644 index 0000000000..05d7cc397f --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -0,0 +1,29 @@ +/** + * @file emissiveV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec4 position; +attribute float emissive; +attribute vec2 texcoord0; + +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vary_texture_index = position.w; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(0,0,0,emissive); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl new file mode 100644 index 0000000000..57d98038e0 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -0,0 +1,27 @@ +/** + * @file fullbrightNoColorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec3 normal; + +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + vec4 pos = (gl_ModelViewMatrix * vert); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(1,1,1,1); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl new file mode 100644 index 0000000000..54c262885e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -0,0 +1,30 @@ +/** + * @file simpleNoColorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec3 norm = normalize(gl_NormalMatrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl new file mode 100644 index 0000000000..1e9e7f4b0b --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -0,0 +1,35 @@ +/** + * @file treeV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec3 normal; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + + gl_Position = gl_ModelViewProjectionMatrix*vert; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); + + vec4 pos = (gl_ModelViewMatrix * vert); + + vec3 norm = normalize(gl_NormalMatrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl new file mode 100644 index 0000000000..294a000ab5 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl @@ -0,0 +1,121 @@ +/** + * @file alphaNonIndexedNoColorF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRectShadow shadowMap0; +uniform sampler2DRectShadow shadowMap1; +uniform sampler2DRectShadow shadowMap2; +uniform sampler2DRectShadow shadowMap3; +uniform sampler2DRect depthMap; +uniform sampler2D diffuseMap; + +uniform mat4 shadow_matrix[6]; +uniform vec4 shadow_clip; +uniform vec2 screen_res; +uniform vec2 shadow_res; + +vec3 atmosLighting(vec3 light); +vec3 scaleSoftClip(vec3 light); + +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_fragcoord; +varying vec3 vary_position; +varying vec3 vary_pointlight_col; + +uniform float shadow_bias; + +uniform mat4 inv_proj; + +vec4 getPosition(vec2 pos_screen) +{ + float depth = texture2DRect(depthMap, pos_screen.xy).a; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos.xyz /= pos.w; + pos.w = 1.0; + return pos; +} + +float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) +{ + stc.xyz /= stc.w; + stc.z += shadow_bias; + + float cs = shadow2DRect(shadowMap, stc.xyz).x; + float shadow = cs; + + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs); + shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs); + + return shadow/5.0; +} + + +void main() +{ + vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; + frag *= screen_res; + + float shadow = 1.0; + vec4 pos = vec4(vary_position, 1.0); + + vec4 spos = pos; + + if (spos.z > -shadow_clip.w) + { + vec4 lpos; + + if (spos.z < -shadow_clip.z) + { + lpos = shadow_matrix[3]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap3, lpos, 1.5); + shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); + } + else if (spos.z < -shadow_clip.y) + { + lpos = shadow_matrix[2]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap2, lpos, 1.5); + } + else if (spos.z < -shadow_clip.x) + { + lpos = shadow_matrix[1]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap1, lpos, 1.5); + } + else + { + lpos = shadow_matrix[0]*spos; + lpos.xy *= shadow_res; + shadow = pcfShadow(shadowMap0, lpos, 1.5); + } + } + + vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy); + + vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0); + vec4 color = diff * col; + + color.rgb = atmosLighting(color.rgb); + + color.rgb = scaleSoftClip(color.rgb); + + color.rgb += diff.rgb * vary_pointlight_col.rgb; + + gl_FragColor = color; +} + diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index 97fe7029e1..a446239a22 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -68,11 +68,11 @@ void main() mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*position).xyz; + vec3 pos = (mat*vec4(position, 1.0)).xyz; gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0); - vec4 n = position; + vec4 n = vec4(position, 1.0); n.xyz += normal.xyz; n.xyz = (mat*n).xyz; n.xyz = normalize(n.xyz-pos.xyz); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 65c3e5da10..8102578bb2 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -8,7 +8,6 @@ attribute vec3 position; attribute vec3 normal; -attribute vec4 diffuse_color; attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -89,9 +88,7 @@ void main() calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - - vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -101,17 +98,17 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*diffuse_color.rgb; + vary_pointlight_col = col.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb*diffuse_color.rgb; - vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); + vary_ambient = col.rgb; + vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0)); - col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); + col.rgb = min(col.rgb, 1.0); gl_FrontColor = col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index f54186ffca..a16be0c8b4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -36,7 +36,10 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +uniform vec3 center; +uniform float size; +uniform vec3 color; +uniform float falloff; varying vec4 vary_fragcoord; uniform vec2 screen_res; @@ -110,9 +113,9 @@ void main() frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = vary_light.xyz-pos.xyz; + vec3 lv = center.xyz-pos.xyz; float dist2 = dot(lv,lv); - dist2 /= vary_light.w; + dist2 /= size; if (dist2 > 1.0) { discard; @@ -143,7 +146,7 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = falloff+1.0; float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); if (dist_atten <= 0.0) { @@ -175,7 +178,7 @@ void main() vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -192,7 +195,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -225,7 +228,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f0c9b01671..cbac299e44 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -47,7 +47,8 @@ uniform mat3 ssao_effect_mat; uniform mat4 inv_proj; uniform vec2 screen_res; -varying vec4 vary_light; +uniform vec3 sun_dir; + varying vec2 vary_fragcoord; vec3 vary_PositionEye; @@ -264,7 +265,7 @@ void main() norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; - float da = max(dot(norm.xyz, vary_light.xyz), 0.0); + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); @@ -291,7 +292,7 @@ void main() // the old infinite-sky shiny reflection // vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float sa = dot(refnormpersp, vary_light.xyz); + float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index d2e3415d91..9534f1d79c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -7,12 +7,11 @@ attribute vec3 position; -attribute vec2 texcoord0; uniform vec2 screen_res; -varying vec4 vary_light; varying vec2 vary_fragcoord; + void main() { //transform vertex @@ -21,6 +20,4 @@ void main() vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; - - vary_light = vec4(texcoord0,0,1); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index d53850b489..699fcdb0f3 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -30,7 +30,7 @@ uniform float ssao_factor; uniform float ssao_factor_inv; varying vec2 vary_fragcoord; -varying vec4 vary_light; +uniform vec3 sun_dir; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -167,10 +167,10 @@ void main() }*/ float shadow = 1.0; - float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); vec3 shadow_pos = pos.xyz + displace*norm; - vec3 offset = vary_light.xyz * (1.0-dp_directional_light); + vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 6795b55dc6..39cca9589e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -6,9 +6,6 @@ */ attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; varying vec4 vary_light; @@ -23,10 +20,4 @@ void main() gl_Position = pos; vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = vec4(texcoord0,0,1); - tex.w = 1.0; - - vary_light = vec4(texcoord0,0,1); - - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl new file mode 100644 index 0000000000..d2a83c9724 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl @@ -0,0 +1,36 @@ +/** + * @file simpleNonIndexedV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + + + +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec3 normal; +attribute vec4 diffuse_color; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + + gl_Position = gl_ModelViewProjectionMatrix*vert; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); + + vec4 pos = (gl_ModelViewMatrix * vert); + + vec3 norm = normalize(gl_NormalMatrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 406417a36b..64a5884e14 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3925,7 +3925,7 @@ void LLAgent::renderAutoPilotTarget() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // lovely green - gGL.diffuseColor4f(0.f, 1.f, 1.f, 1.f); + gGL.color4f(0.f, 1.f, 1.f, 1.f); target_global = mAutoPilotTargetGlobal; @@ -3935,7 +3935,7 @@ void LLAgent::renderAutoPilotTarget() glScalef(height_meters, height_meters, height_meters); - gSphere.render(1500.f); + gSphere.render(); gGL.popMatrix(); } diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp index 4901e29691..2adc071d7a 100644 --- a/indra/newview/llcylinder.cpp +++ b/indra/newview/llcylinder.cpp @@ -37,261 +37,39 @@ #include "llgl.h" #include "llglheaders.h" -LLCylinder gCylinder; LLCone gCone; -GLUquadricObj* gQuadObj = NULL; - -static const GLint SLICES[] = { 30, 20, 12, 6 }; // same as sphere slices -static const GLint STACKS = 2; -static const GLfloat RADIUS = 0.5f; - -// draws a cylinder or cone -// returns approximate number of triangles required -U32 draw_cylinder_side(GLint slices, GLint stacks, GLfloat base_radius, GLfloat top_radius) -{ - U32 triangles = 0; - GLfloat height = 1.0f; - - if (!gQuadObj) - { - gQuadObj = gluNewQuadric(); - if (!gQuadObj) llerror("draw_cylindrical_body couldn't allocated quadric", 0); - } - - gluQuadricDrawStyle(gQuadObj, GLU_FILL); - gluQuadricNormals(gQuadObj, GLU_SMOOTH); - gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); - gluQuadricTexture(gQuadObj, GL_TRUE); - gluCylinder(gQuadObj, base_radius, top_radius, height, slices, stacks); - triangles += stacks * (slices * 2); - - - return triangles; -} - - -// Returns number of triangles required to draw -// Need to know if top or not to set lighting normals -const BOOL TOP = TRUE; -const BOOL BOTTOM = FALSE; -U32 draw_cylinder_cap(GLint slices, GLfloat base_radius, BOOL is_top) -{ - U32 triangles = 0; - - if (!gQuadObj) - { - gQuadObj = gluNewQuadric(); - if (!gQuadObj) llerror("draw_cylinder_base couldn't allocated quadric", 0); - } - - gluQuadricDrawStyle(gQuadObj, GLU_FILL); - gluQuadricNormals(gQuadObj, GLU_SMOOTH); - gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); - gluQuadricTexture(gQuadObj, GL_TRUE); - - // no hole in the middle of the disk, and just one ring - GLdouble inner_radius = 0.0; - GLint rings = 1; - - // normals point in +z for top, -z for base - if (is_top) - { - gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); - } - else - { - gluQuadricOrientation(gQuadObj, GLU_INSIDE); - } - gluDisk(gQuadObj, inner_radius, base_radius, slices, rings); - triangles += slices; - - return triangles; -} - -void LLCylinder::drawSide(S32 detail) -{ - draw_cylinder_side(SLICES[detail], STACKS, RADIUS, RADIUS); -} - -void LLCylinder::drawTop(S32 detail) -{ - draw_cylinder_cap(SLICES[detail], RADIUS, TOP); -} - -void LLCylinder::drawBottom(S32 detail) -{ - draw_cylinder_cap(SLICES[detail], RADIUS, BOTTOM); -} - -void LLCylinder::prerender() -{ -} - -void LLCylinder::cleanupGL() -{ - if (gQuadObj) - { - gluDeleteQuadric(gQuadObj); - gQuadObj = NULL; - } -} - -void LLCylinder::render(F32 pixel_area) -{ - renderface(pixel_area, 0); - renderface(pixel_area, 1); - renderface(pixel_area, 2); -} - - -void LLCylinder::renderface(F32 pixel_area, S32 face) -{ - if (face < 0 || face > 2) - { - llerror("LLCylinder::renderface() invalid face number", face); - return; - } - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - S32 level_of_detail; - - if (pixel_area > 20000.f) - { - level_of_detail = 0; - } - else if (pixel_area > 1600.f) - { - level_of_detail = 1; - } - else if (pixel_area > 200.f) - { - level_of_detail = 2; - } - else - { - level_of_detail = 3; - } - - if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail) - { - llerror("LLCylinder::renderface() invalid level of detail", level_of_detail); - return; - } - - LLVertexBuffer::unbind(); - - switch(face) - { - case 0: - glTranslatef(0.f, 0.f, -0.5f); - drawSide(level_of_detail); - break; - case 1: - glTranslatef(0.0f, 0.f, 0.5f); - drawTop(level_of_detail); - break; - case 2: - glTranslatef(0.0f, 0.f, -0.5f); - drawBottom(level_of_detail); - break; - default: - llerror("LLCylinder::renderface() fell out of switch", 0); - break; - } - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); -} - - // // Cones // -void LLCone::prerender() +void LLCone::render(S32 sides) { -} + gGL.begin(LLRender::TRIANGLE_FAN); + gGL.vertex3f(0,0,0); -void LLCone::cleanupGL() -{ - if (gQuadObj) + for (U32 i = 0; i < sides; i++) { - gluDeleteQuadric(gQuadObj); - gQuadObj = NULL; + F32 a = (F32) i/sides * F_PI*2.f; + F32 x = cosf(a)*0.5f; + F32 y = sinf(a)*0.5f; + gGL.vertex3f(x,y,0.f); } -} + gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f); -void LLCone::drawSide(S32 detail) -{ - draw_cylinder_side( SLICES[detail], STACKS, RADIUS, 0.f ); -} - -void LLCone::drawBottom(S32 detail) -{ - draw_cylinder_cap( SLICES[detail], RADIUS, BOTTOM ); -} - -void LLCone::render(S32 level_of_detail) -{ - GLfloat height = 1.0f; + gGL.end(); - if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail) + gGL.begin(LLRender::TRIANGLE_FAN); + gGL.vertex3f(0.f, 0.f, 1.f); + for (U32 i = 0; i < sides; i++) { - llerror("LLCone::render() invalid level of detail", level_of_detail); - return; + F32 a = (F32) i/sides * F_PI*2.f; + F32 x = cosf(a)*0.5f; + F32 y = sinf(a)*0.5f; + gGL.vertex3f(x,y,0.f); } + gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - // center object at 0 - glTranslatef(0.f, 0.f, - height / 2.0f); - - drawSide(level_of_detail); - drawBottom(level_of_detail); - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.end(); } - -void LLCone::renderface(S32 level_of_detail, S32 face) -{ - if (face < 0 || face > 1) - { - llerror("LLCone::renderface() invalid face number", face); - return; - } - - if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail) - { - llerror("LLCone::renderface() invalid level of detail", level_of_detail); - return; - } - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - LLVertexBuffer::unbind(); - - switch(face) - { - case 0: - glTranslatef(0.f, 0.f, -0.5f); - drawSide(level_of_detail); - break; - case 1: - glTranslatef(0.f, 0.f, -0.5f); - drawBottom(level_of_detail); - break; - default: - llerror("LLCylinder::renderface() fell out of switch", 0); - break; - } - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); -} diff --git a/indra/newview/llcylinder.h b/indra/newview/llcylinder.h index 40a669ceb6..4369f06659 100644 --- a/indra/newview/llcylinder.h +++ b/indra/newview/llcylinder.h @@ -30,45 +30,18 @@ //#include "stdtypes.h" //#include "llgl.h" -// -// Cylinders -// -const S32 CYLINDER_LEVELS_OF_DETAIL = 4; -const S32 CYLINDER_FACES = 3; - -class LLCylinder -{ -public: - void prerender(); - void drawTop(S32 detail); - void drawSide(S32 detail); - void drawBottom(S32 detail); - void cleanupGL(); - - void render(F32 pixel_area); - void renderface(F32 pixel_area, S32 face); -}; - +#include "llvertexbuffer.h" // // Cones // -const S32 CONE_LOD_HIGHEST = 0; -const S32 CONE_LEVELS_OF_DETAIL = 4; -const S32 CONE_FACES = 2; - class LLCone { public: - void prerender(); - void cleanupGL(); - void drawSide(S32 detail); - void drawBottom(S32 detail); - void render(S32 level_of_detail); - void renderface(S32 level_of_detail, S32 face); + void render(S32 sides = 12); }; -extern LLCylinder gCylinder; + extern LLCone gCone; #endif diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index ef8819d9b5..a3f8eb377a 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -492,7 +492,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha. - if (draw_glow_for_this_partition && + if (current_shader && + draw_glow_for_this_partition && params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE)) { // install glow-accumulating blend mode diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index dae995e1f5..a99f0200ce 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -270,7 +270,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedAlpha() sVertexProgram = &gDeferredSkinnedAlphaProgram; gPipeline.bindDeferredShader(*sVertexProgram); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); gPipeline.enableLightsDynamic(); } @@ -279,7 +278,6 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha() LLVertexBuffer::unbind(); gPipeline.unbindDeferredShader(*sVertexProgram); sDiffuseChannel = 0; - LLVertexBuffer::sWeight4Loc = -1; sVertexProgram = NULL; } @@ -354,10 +352,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) if (pass == 0) { sVertexProgram = &gDeferredAvatarShadowProgram; - if (sShaderLevel > 0) - { - gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX]; - } + //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f); gGL.diffuseColor4f(1,1,1,1); @@ -373,7 +368,6 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) sVertexProgram = &gDeferredAttachmentShadowProgram; sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sVertexProgram->bind(); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } } @@ -392,7 +386,6 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass) { LLVertexBuffer::unbind(); sVertexProgram->unbind(); - LLVertexBuffer::sWeight4Loc = -1; sVertexProgram = NULL; } } @@ -426,11 +419,6 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) if (pass == 0) { - if (sShaderLevel > 0) - { - gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX]; - } - avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); } else @@ -587,11 +575,20 @@ void LLDrawPoolAvatar::beginImpostor() gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); sDiffuseChannel = 0; + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } } void LLDrawPoolAvatar::endImpostor() { gPipeline.enableLightsDynamic(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } } void LLDrawPoolAvatar::beginRigid() @@ -657,9 +654,10 @@ void LLDrawPoolAvatar::endDeferredImpostor() void LLDrawPoolAvatar::beginDeferredRigid() { - sVertexProgram = &gDeferredNonIndexedDiffuseProgram; + sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; sVertexProgram->bind(); + sVertexProgram->setAlphaRange(0.2f, 1.f); } void LLDrawPoolAvatar::endDeferredRigid() @@ -773,7 +771,6 @@ void LLDrawPoolAvatar::beginRiggedSimple() { sDiffuseChannel = 0; sVertexProgram->bind(); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } } @@ -784,7 +781,6 @@ void LLDrawPoolAvatar::endRiggedSimple() { sVertexProgram->unbind(); sVertexProgram = NULL; - LLVertexBuffer::sWeight4Loc = -1; } } @@ -811,7 +807,34 @@ void LLDrawPoolAvatar::endRiggedFullbrightAlpha() void LLDrawPoolAvatar::beginRiggedGlow() { - beginRiggedFullbright(); + if (sShaderLevel > 0) + { + if (LLPipeline::sUnderWaterRender) + { + sVertexProgram = &gSkinnedObjectEmissiveWaterProgram; + } + else + { + sVertexProgram = &gSkinnedObjectEmissiveProgram; + } + } + else + { + if (LLPipeline::sUnderWaterRender) + { + sVertexProgram = &gObjectEmissiveNonIndexedWaterProgram; + } + else + { + sVertexProgram = &gObjectEmissiveNonIndexedProgram; + } + } + + if (sShaderLevel > 0 || gPipeline.canUseVertexShaders()) + { + sDiffuseChannel = 0; + sVertexProgram->bind(); + } } void LLDrawPoolAvatar::endRiggedGlow() @@ -848,7 +871,6 @@ void LLDrawPoolAvatar::beginRiggedFullbright() { sDiffuseChannel = 0; sVertexProgram->bind(); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } } @@ -859,7 +881,6 @@ void LLDrawPoolAvatar::endRiggedFullbright() { sVertexProgram->unbind(); sVertexProgram = NULL; - LLVertexBuffer::sWeight4Loc = -1; } } @@ -892,7 +913,6 @@ void LLDrawPoolAvatar::beginRiggedShinySimple() { sVertexProgram->bind(); LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } } @@ -904,7 +924,6 @@ void LLDrawPoolAvatar::endRiggedShinySimple() LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); sVertexProgram->unbind(); sVertexProgram = NULL; - LLVertexBuffer::sWeight4Loc = -1; } } @@ -938,7 +957,6 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny() { sVertexProgram->bind(); LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } } @@ -950,7 +968,6 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny() LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); sVertexProgram->unbind(); sVertexProgram = NULL; - LLVertexBuffer::sWeight4Loc = -1; } } @@ -960,14 +977,12 @@ void LLDrawPoolAvatar::beginDeferredRiggedSimple() sVertexProgram = &gDeferredSkinnedDiffuseProgram; sDiffuseChannel = 0; sVertexProgram->bind(); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } void LLDrawPoolAvatar::endDeferredRiggedSimple() { LLVertexBuffer::unbind(); sVertexProgram->unbind(); - LLVertexBuffer::sWeight4Loc = -1; sVertexProgram = NULL; } @@ -977,7 +992,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump() sVertexProgram->bind(); normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); } void LLDrawPoolAvatar::endDeferredRiggedBump() @@ -986,7 +1000,6 @@ void LLDrawPoolAvatar::endDeferredRiggedBump() sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP); sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sVertexProgram->unbind(); - LLVertexBuffer::sWeight4Loc = -1; normal_channel = -1; sDiffuseChannel = 0; sVertexProgram = NULL; @@ -996,10 +1009,10 @@ void LLDrawPoolAvatar::beginDeferredSkinned() { sShaderLevel = mVertexShaderLevel; sVertexProgram = &gDeferredAvatarProgram; - sRenderingSkinned = TRUE; sVertexProgram->bind(); + sVertexProgram->setAlphaRange(0.2f, 1.f); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gGL.getTexUnit(0)->activate(); @@ -1216,11 +1229,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - if (sShaderLevel > 0) - { - gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX]; - } - if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) { LLMatrix4 rot_mat; @@ -1632,34 +1640,3 @@ LLVertexBufferAvatar::LLVertexBufferAvatar() } -void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const -{ - /*if (sRenderingSkinned) - { - U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData; - - glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_VERTEX], (void*)(base + 0)); - glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); - glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); - - set_vertex_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT], - LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_WEIGHT], (F32*)(base + mOffsets[TYPE_WEIGHT])); - - if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP) - { - set_binormals(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL], - LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_BINORMAL], (LLVector3*)(base + mOffsets[TYPE_BINORMAL])); - } - - if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH) - { - set_vertex_clothing_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING], - LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_CLOTHWEIGHT], (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT])); - } - } - else - {*/ - LLVertexBuffer::setupVertexBuffer(data_mask); - //} -} - diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index fcd8294af5..e0326bcfaf 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -176,6 +176,7 @@ public: RIGGED_FULLBRIGHT_SHINY_MASK = RIGGED_SIMPLE_MASK, RIGGED_GLOW_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_EMISSIVE | LLVertexBuffer::MAP_WEIGHT4, RIGGED_ALPHA_MASK = RIGGED_SIMPLE_MASK, RIGGED_FULLBRIGHT_ALPHA_MASK = RIGGED_FULLBRIGHT_MASK, @@ -214,7 +215,6 @@ class LLVertexBufferAvatar : public LLVertexBuffer { public: LLVertexBufferAvatar(); - virtual void setupVertexBuffer(U32 data_mask) const; }; extern S32 AVATAR_OFFSET_POS; diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 582e462871..80c202d4e2 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -46,7 +46,7 @@ static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) { - gDeferredFullbrightProgram.bind(); + gDeferredEmissiveProgram.bind(); } static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push"); @@ -76,7 +76,7 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass) void LLDrawPoolGlow::endPostDeferredPass(S32 pass) { - gDeferredFullbrightProgram.unbind(); + gDeferredEmissiveProgram.unbind(); LLRenderPass::endRenderPass(pass); } @@ -255,6 +255,7 @@ void LLDrawPoolGrass::prerender() void LLDrawPoolGrass::beginRenderPass(S32 pass) { LLFastTimer t(FTM_RENDER_GRASS); + stop_glerror(); if (LLPipeline::sUnderWaterRender) { diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 50a52ac4cf..da8e3e8b3a 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -142,7 +142,7 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass) { LLFastTimer t(FTM_RENDER_TREES); - shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram; + shader = &gDeferredTreeProgram; shader->bind(); shader->setAlphaRange(0.5f, 1.f); } @@ -169,8 +169,8 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), gSavedSettings.getF32("RenderDeferredTreeShadowBias")); - gDeferredShadowAlphaMaskProgram.bind(); - gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f); + gDeferredTreeShadowProgram.bind(); + gDeferredTreeShadowProgram.setAlphaRange(0.5f, 1.f); } void LLDrawPoolTree::renderShadow(S32 pass) @@ -184,6 +184,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass) glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"), gSavedSettings.getF32("RenderDeferredSpotShadowBias")); + gDeferredTreeShadowProgram.unbind(); } diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3286408f21..b9838f7da2 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3623,6 +3623,15 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim LLVertexBuffer::unbind(); + bool no_ff = LLGLSLShader::sNoFixedFunction; + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + LLGLSLShader::sNoFixedFunction = false; + + if (shader) + { + shader->unbind(); + } + stop_gloderror(); static U32 cur_name = 1; @@ -4003,6 +4012,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim mResourceCost = calcResourceCost(); + LLVertexBuffer::unbind(); + LLGLSLShader::sNoFixedFunction = no_ff; + if (shader) + { + shader->bind(); + } + /*if (which_lod == -1 && mScene[LLModel::LOD_PHYSICS].empty()) { //build physics scene mScene[LLModel::LOD_PHYSICS] = mScene[LLModel::LOD_LOW]; @@ -4950,7 +4966,7 @@ BOOL LLModelPreview::render() llassert(binding == model->mMaterialList[i]); - gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(material.mDiffuseColor.mV); if (material.mDiffuseMap.notNull()) { @@ -5261,7 +5277,7 @@ BOOL LLModelPreview::render() const LLImportMaterial& material = instance.mMaterial[binding]; buffer->setBuffer(type_mask & buffer->getTypeMask()); - gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(material.mDiffuseColor.mV); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index 37b7b2e75d..ec5a0926c4 100644 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -295,12 +295,12 @@ void LLHUDEffectBeam::render() F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3]; alpha *= mInterpFade[i].getCurVal(); coloru.mV[3] = (U8)alpha; - glColor4ubv(coloru.mV); + gGL.color4ubv(coloru.mV); glPushMatrix(); glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); glScalef(scale, scale, scale); - gSphere.render(0); + gSphere.render(); glPopMatrix(); } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index c4f8369cd0..a9b14829b2 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1519,6 +1519,7 @@ void LLManipTranslate::renderSnapGuides() F32 sz = mGridSizeMeters; F32 tiles = sz; + glMatrixMode(GL_TEXTURE); gGL.pushMatrix(); usc = 1.0f/usc; @@ -2243,7 +2244,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]); glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f); - gCone.render(CONE_LOD_HIGHEST); + gCone.render(); gGL.popMatrix(); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 8aa24e9261..568c967a9a 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -89,6 +89,7 @@ #include "llvoavatarself.h" #include "llvovolume.h" #include "pipeline.h" +#include "llviewershadermgr.h" #include "llglheaders.h" @@ -5570,8 +5571,7 @@ void pushWireframe(LLDrawable* drawable) for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = rigged_volume->getVolumeFace(i); - glVertexPointer(3, GL_FLOAT, 16, face.mPositions); - glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, face.mTexCoords, face.mNumIndices, face.mIndices); } gGL.popMatrix(); } @@ -5584,7 +5584,7 @@ void pushWireframe(LLDrawable* drawable) LLFace* face = drawable->getFace(i); if (face->verify()) { - pushVerts(face, LLVertexBuffer::MAP_VERTEX); + pushVerts(face, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); } } } @@ -5604,6 +5604,13 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) return; } + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader) + { + gHighlightProgram.bind(); + } + glMatrixMode(GL_MODELVIEW); gGL.pushMatrix(); @@ -5627,26 +5634,41 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible()) { gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE); - LLGLEnable fog(GL_FOG); - glFogi(GL_FOG_MODE, GL_LINEAR); - float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec(); - LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); - glFogf(GL_FOG_START, d); - glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); - glFogfv(GL_FOG_COLOR, fogCol.mV); - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + if (shader) { - gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + gHighlightProgram.uniform4f("highlight_color", color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); pushWireframe(drawable); } + else + { + LLGLEnable fog(GL_FOG); + glFogi(GL_FOG_MODE, GL_LINEAR); + float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec(); + LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); + glFogf(GL_FOG_START, d); + glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); + glFogfv(GL_FOG_COLOR, fogCol.mV); + + gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + { + gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + pushWireframe(drawable); + } + } } gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); + if (shader) + { + gHighlightProgram.uniform4f("highlight_color", color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); + } + else + { + gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); + } LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); glLineWidth(3.f); @@ -5654,6 +5676,11 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) glLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); gGL.popMatrix(); + + if (shader) + { + shader->bind(); + } } //----------------------------------------------------------------------------- diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 064eaa49dd..3d371f7a44 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4248,7 +4248,7 @@ public: LLVector3 local_start = mStart; LLVector3 local_end = mEnd; - if (!gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible()) + if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible()) { return false; } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 983108391f..2ec7534025 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -506,7 +506,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global, glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); + { glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color); @@ -559,9 +560,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global, gGL.end(); } - - //gCylinder.render(1000); - glPopMatrix(); + } + gGL.popMatrix(); std::string text; text = llformat( "%.0f m", to_vec.magVec()); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 5e4c124c45..2d08a27923 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -459,7 +459,10 @@ void LLViewerJointMesh::uploadJointMatrices() } } stop_glerror(); - glUniform4fvARB(gAvatarMatrixParam, 45, mat); + if (LLGLSLShader::sCurBoundShaderPtr) + { + LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat); + } stop_glerror(); } else @@ -512,7 +515,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) { if (!mValid || !mMesh || !mFace || !mVisible || !mFace->getVertexBuffer() || - mMesh->getNumFaces() == 0) + mMesh->getNumFaces() == 0 || + (LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShaderPtr == NULL)) { return 0; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 8684322eef..f07b21e3c3 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -97,6 +97,8 @@ LLGLSLShader gObjectAlphaMaskNoColorProgram; LLGLSLShader gObjectAlphaMaskNoColorWaterProgram; LLGLSLShader gObjectFullbrightNonIndexedProgram; LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; +LLGLSLShader gObjectEmissiveNonIndexedProgram; +LLGLSLShader gObjectEmissiveNonIndexedWaterProgram; LLGLSLShader gObjectFullbrightShinyNonIndexedProgram; LLGLSLShader gObjectFullbrightShinyNonIndexedWaterProgram; LLGLSLShader gObjectShinyNonIndexedProgram; @@ -105,11 +107,13 @@ LLGLSLShader gObjectShinyNonIndexedWaterProgram; //object hardware skinning shaders LLGLSLShader gSkinnedObjectSimpleProgram; LLGLSLShader gSkinnedObjectFullbrightProgram; +LLGLSLShader gSkinnedObjectEmissiveProgram; LLGLSLShader gSkinnedObjectFullbrightShinyProgram; LLGLSLShader gSkinnedObjectShinySimpleProgram; LLGLSLShader gSkinnedObjectSimpleWaterProgram; LLGLSLShader gSkinnedObjectFullbrightWaterProgram; +LLGLSLShader gSkinnedObjectEmissiveWaterProgram; LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram; LLGLSLShader gSkinnedObjectShinySimpleWaterProgram; @@ -147,12 +151,14 @@ LLGLSLShader gDeferredDiffuseProgram; LLGLSLShader gDeferredDiffuseAlphaMaskProgram; LLGLSLShader gDeferredNonIndexedDiffuseProgram; LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram; +LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; LLGLSLShader gDeferredSkinnedDiffuseProgram; LLGLSLShader gDeferredSkinnedBumpProgram; LLGLSLShader gDeferredSkinnedAlphaProgram; LLGLSLShader gDeferredBumpProgram; LLGLSLShader gDeferredTerrainProgram; LLGLSLShader gDeferredTreeProgram; +LLGLSLShader gDeferredTreeShadowProgram; LLGLSLShader gDeferredAvatarProgram; LLGLSLShader gDeferredAvatarAlphaProgram; LLGLSLShader gDeferredLightProgram; @@ -169,6 +175,7 @@ LLGLSLShader gDeferredAttachmentShadowProgram; LLGLSLShader gDeferredAlphaProgram; LLGLSLShader gDeferredAvatarEyesProgram; LLGLSLShader gDeferredFullbrightProgram; +LLGLSLShader gDeferredEmissiveProgram; LLGLSLShader gDeferredGIProgram; LLGLSLShader gDeferredGIFinalProgram; LLGLSLShader gDeferredPostGIProgram; @@ -179,10 +186,6 @@ LLGLSLShader gDeferredWLCloudProgram; LLGLSLShader gDeferredStarProgram; LLGLSLShader gLuminanceGatherProgram; - -//current avatar shader parameter pointer -GLint gAvatarMatrixParam; - LLViewerShaderMgr::LLViewerShaderMgr() : mVertexShaderLevel(SHADER_COUNT, 0), mMaxAvatarShaderLevel(0) @@ -223,14 +226,18 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gTreeWaterProgram); mShaderList.push_back(&gObjectFullbrightNonIndexedProgram); mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram); + mShaderList.push_back(&gObjectEmissiveNonIndexedProgram); + mShaderList.push_back(&gObjectEmissiveNonIndexedWaterProgram); mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram); mShaderList.push_back(&gObjectFullbrightShinyNonIndexedWaterProgram); mShaderList.push_back(&gSkinnedObjectSimpleProgram); mShaderList.push_back(&gSkinnedObjectFullbrightProgram); + mShaderList.push_back(&gSkinnedObjectEmissiveProgram); mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram); mShaderList.push_back(&gSkinnedObjectShinySimpleProgram); mShaderList.push_back(&gSkinnedObjectSimpleWaterProgram); mShaderList.push_back(&gSkinnedObjectFullbrightWaterProgram); + mShaderList.push_back(&gSkinnedObjectEmissiveWaterProgram); mShaderList.push_back(&gSkinnedObjectFullbrightShinyWaterProgram); mShaderList.push_back(&gSkinnedObjectShinySimpleWaterProgram); mShaderList.push_back(&gTerrainProgram); @@ -251,6 +258,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); mShaderList.push_back(&gDeferredFullbrightProgram); + mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); mShaderList.push_back(&gDeferredPostGIProgram); mShaderList.push_back(&gDeferredEdgeProgram); @@ -690,6 +698,8 @@ void LLViewerShaderMgr::unloadShaders() gObjectAlphaMaskNoColorWaterProgram.unload(); gObjectFullbrightNonIndexedProgram.unload(); gObjectFullbrightNonIndexedWaterProgram.unload(); + gObjectEmissiveNonIndexedProgram.unload(); + gObjectEmissiveNonIndexedWaterProgram.unload(); gTreeProgram.unload(); gTreeWaterProgram.unload(); @@ -700,11 +710,13 @@ void LLViewerShaderMgr::unloadShaders() gSkinnedObjectSimpleProgram.unload(); gSkinnedObjectFullbrightProgram.unload(); + gSkinnedObjectEmissiveProgram.unload(); gSkinnedObjectFullbrightShinyProgram.unload(); gSkinnedObjectShinySimpleProgram.unload(); gSkinnedObjectSimpleWaterProgram.unload(); gSkinnedObjectFullbrightWaterProgram.unload(); + gSkinnedObjectEmissiveWaterProgram.unload(); gSkinnedObjectFullbrightShinyWaterProgram.unload(); gSkinnedObjectShinySimpleWaterProgram.unload(); @@ -730,6 +742,7 @@ void LLViewerShaderMgr::unloadShaders() gDeferredDiffuseProgram.unload(); gDeferredDiffuseAlphaMaskProgram.unload(); gDeferredNonIndexedDiffuseAlphaMaskProgram.unload(); + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload(); gDeferredNonIndexedDiffuseProgram.unload(); gDeferredSkinnedDiffuseProgram.unload(); gDeferredSkinnedBumpProgram.unload(); @@ -1086,9 +1099,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (mVertexShaderLevel[SHADER_DEFERRED] == 0) { gDeferredTreeProgram.unload(); + gDeferredTreeShadowProgram.unload(); gDeferredDiffuseProgram.unload(); gDeferredDiffuseAlphaMaskProgram.unload(); gDeferredNonIndexedDiffuseAlphaMaskProgram.unload(); + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload(); gDeferredNonIndexedDiffuseProgram.unload(); gDeferredSkinnedDiffuseProgram.unload(); gDeferredSkinnedBumpProgram.unload(); @@ -1111,6 +1126,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.unload(); gDeferredAlphaProgram.unload(); gDeferredFullbrightProgram.unload(); + gDeferredEmissiveProgram.unload(); gDeferredAvatarEyesProgram.unload(); gDeferredPostGIProgram.unload(); gDeferredEdgeProgram.unload(); @@ -1163,6 +1179,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL); } + + if (success) + { + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader"; + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear(); + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL); + } if (success) { @@ -1234,6 +1260,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = gDeferredTreeProgram.createShader(NULL, NULL); } + if (success) + { + gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader"; + gDeferredTreeShadowProgram.mShaderFiles.clear(); + gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredTreeShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredTreeShadowProgram.createShader(NULL, NULL); + } + if (success) { gDeferredImpostorProgram.mName = "Deferred Impostor Shader"; @@ -1436,6 +1472,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = gDeferredFullbrightProgram.createShader(NULL, NULL); } + if (success) + { + gDeferredEmissiveProgram.mName = "Deferred Emissive Shader"; + gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true; + gDeferredEmissiveProgram.mFeatures.hasGamma = true; + gDeferredEmissiveProgram.mFeatures.hasTransport = true; + gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredEmissiveProgram.mShaderFiles.clear(); + gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredEmissiveProgram.createShader(NULL, NULL); + } + if (success) { // load water shader @@ -1553,7 +1603,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarAlphaProgram.mShaderFiles.clear(); gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms); } @@ -1736,12 +1786,16 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectAlphaMaskNoColorWaterProgram.unload(); gObjectFullbrightNonIndexedProgram.unload(); gObjectFullbrightNonIndexedWaterProgram.unload(); + gObjectEmissiveNonIndexedProgram.unload(); + gObjectEmissiveNonIndexedWaterProgram.unload(); gSkinnedObjectSimpleProgram.unload(); gSkinnedObjectFullbrightProgram.unload(); + gSkinnedObjectEmissiveProgram.unload(); gSkinnedObjectFullbrightShinyProgram.unload(); gSkinnedObjectShinySimpleProgram.unload(); gSkinnedObjectSimpleWaterProgram.unload(); gSkinnedObjectFullbrightWaterProgram.unload(); + gSkinnedObjectEmissiveWaterProgram.unload(); gSkinnedObjectFullbrightShinyWaterProgram.unload(); gSkinnedObjectShinySimpleWaterProgram.unload(); gTreeProgram.unload(); @@ -1919,6 +1973,37 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gObjectFullbrightNonIndexedWaterProgram.createShader(NULL, NULL); } + if (success) + { + gObjectEmissiveNonIndexedProgram.mName = "Non Indexed Emissive Shader"; + gObjectEmissiveNonIndexedProgram.mFeatures.calculatesAtmospherics = true; + gObjectEmissiveNonIndexedProgram.mFeatures.hasGamma = true; + gObjectEmissiveNonIndexedProgram.mFeatures.hasTransport = true; + gObjectEmissiveNonIndexedProgram.mFeatures.isFullbright = true; + gObjectEmissiveNonIndexedProgram.mFeatures.disableTextureIndex = true; + gObjectEmissiveNonIndexedProgram.mShaderFiles.clear(); + gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectEmissiveNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectEmissiveNonIndexedProgram.createShader(NULL, NULL); + } + + if (success) + { + gObjectEmissiveNonIndexedWaterProgram.mName = "Non Indexed Emissive Water Shader"; + gObjectEmissiveNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true; + gObjectEmissiveNonIndexedWaterProgram.mFeatures.isFullbright = true; + gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasWaterFog = true; + gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasTransport = true; + gObjectEmissiveNonIndexedWaterProgram.mFeatures.disableTextureIndex = true; + gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.clear(); + gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectEmissiveNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + gObjectEmissiveNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; + success = gObjectEmissiveNonIndexedWaterProgram.createShader(NULL, NULL); + } + if (success) { gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader"; @@ -2299,6 +2384,39 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gSkinnedObjectFullbrightProgram.createShader(NULL, NULL); } + if (success) + { + gSkinnedObjectEmissiveProgram.mName = "Skinned Emissive Shader"; + gSkinnedObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true; + gSkinnedObjectEmissiveProgram.mFeatures.hasGamma = true; + gSkinnedObjectEmissiveProgram.mFeatures.hasTransport = true; + gSkinnedObjectEmissiveProgram.mFeatures.isFullbright = true; + gSkinnedObjectEmissiveProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectEmissiveProgram.mFeatures.disableTextureIndex = true; + gSkinnedObjectEmissiveProgram.mShaderFiles.clear(); + gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSkinnedObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gSkinnedObjectEmissiveProgram.createShader(NULL, NULL); + } + + if (success) + { + gSkinnedObjectEmissiveWaterProgram.mName = "Skinned Emissive Water Shader"; + gSkinnedObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.hasGamma = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.hasTransport = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.isFullbright = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.disableTextureIndex = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true; + gSkinnedObjectEmissiveWaterProgram.mShaderFiles.clear(); + gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSkinnedObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gSkinnedObjectEmissiveWaterProgram.createShader(NULL, NULL); + } + if (success) { gSkinnedObjectFullbrightShinyProgram.mName = "Skinned Fullbright Shiny Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index ced7ed06d9..1b658c45ba 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -71,15 +71,6 @@ public: SHADER_COUNT }; - typedef enum - { - MATERIAL_COLOR = 0, - SPECULAR_COLOR, - BINORMAL, - OBJECT_WEIGHT, - END_RESERVED_ATTRIBS - } eGLSLReservedAttribs; - typedef enum { DIFFUSE_MAP = 0, @@ -309,6 +300,8 @@ extern LLGLSLShader gObjectFullbrightAlphaMaskProgram; extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram; extern LLGLSLShader gObjectFullbrightNonIndexedProgram; extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram; +extern LLGLSLShader gObjectEmissiveNonIndexedProgram; +extern LLGLSLShader gObjectEmissiveNonIndexedWaterProgram; extern LLGLSLShader gObjectBumpProgram; extern LLGLSLShader gTreeProgram; extern LLGLSLShader gTreeWaterProgram; @@ -328,11 +321,13 @@ extern LLGLSLShader gObjectShinyNonIndexedWaterProgram; extern LLGLSLShader gSkinnedObjectSimpleProgram; extern LLGLSLShader gSkinnedObjectFullbrightProgram; +extern LLGLSLShader gSkinnedObjectEmissiveProgram; extern LLGLSLShader gSkinnedObjectFullbrightShinyProgram; extern LLGLSLShader gSkinnedObjectShinySimpleProgram; extern LLGLSLShader gSkinnedObjectSimpleWaterProgram; extern LLGLSLShader gSkinnedObjectFullbrightWaterProgram; +extern LLGLSLShader gSkinnedObjectEmissiveWaterProgram; extern LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram; extern LLGLSLShader gSkinnedObjectShinySimpleWaterProgram; @@ -368,6 +363,7 @@ extern LLGLSLShader gDeferredWaterProgram; extern LLGLSLShader gDeferredDiffuseProgram; extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram; extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram; +extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; extern LLGLSLShader gDeferredNonIndexedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedBumpProgram; @@ -375,6 +371,7 @@ extern LLGLSLShader gDeferredSkinnedAlphaProgram; extern LLGLSLShader gDeferredBumpProgram; extern LLGLSLShader gDeferredTerrainProgram; extern LLGLSLShader gDeferredTreeProgram; +extern LLGLSLShader gDeferredTreeShadowProgram; extern LLGLSLShader gDeferredLightProgram; extern LLGLSLShader gDeferredMultiLightProgram; extern LLGLSLShader gDeferredSpotLightProgram; @@ -394,6 +391,7 @@ extern LLGLSLShader gDeferredAvatarShadowProgram; extern LLGLSLShader gDeferredAttachmentShadowProgram; extern LLGLSLShader gDeferredAlphaProgram; extern LLGLSLShader gDeferredFullbrightProgram; +extern LLGLSLShader gDeferredEmissiveProgram; extern LLGLSLShader gDeferredAvatarEyesProgram; extern LLGLSLShader gDeferredAvatarAlphaProgram; extern LLGLSLShader gDeferredWLSkyProgram; @@ -401,8 +399,5 @@ extern LLGLSLShader gDeferredWLCloudProgram; extern LLGLSLShader gDeferredStarProgram; extern LLGLSLShader gLuminanceGatherProgram; -//current avatar shader parameter pointer -extern GLint gAvatarMatrixParam; - #endif diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 36d8d6a39b..9f66c074fd 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1720,10 +1720,7 @@ void LLViewerWindow::initGLDefaults() glCullFace(GL_BACK); // RN: Need this for translation and stretch manip. - gCone.prerender(); gBox.prerender(); - gSphere.prerender(); - gCylinder.prerender(); } struct MainPanel : public LLPanel @@ -2233,6 +2230,10 @@ void LLViewerWindow::drawDebugText() gGL.color4f(1,1,1,1); gGL.pushMatrix(); gGL.pushUIMatrix(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } { // scale view by UI global scale factor and aspect ratio correction factor gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); @@ -2242,6 +2243,10 @@ void LLViewerWindow::drawDebugText() gGL.popMatrix(); gGL.flush(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } } void LLViewerWindow::draw() @@ -3441,26 +3446,26 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, if (drawable && drawable->isLight()) { LLVOVolume* vovolume = drawable->getVOVolume(); - glPushMatrix(); + gGL.pushMatrix(); LLVector3 center = drawable->getPositionAgent(); - glTranslatef(center[0], center[1], center[2]); + gGL.translatef(center[0], center[1], center[2]); F32 scale = vovolume->getLightRadius(); - glScalef(scale, scale, scale); + gGL.scalef(scale, scale, scale); LLColor4 color(vovolume->getLightColor(), .5f); - gGL.diffuseColor4fv(color.mV); + gGL.color4fv(color.mV); F32 pixel_area = 100000.f; // Render Outside - gSphere.render(pixel_area); + gSphere.render(); // Render Inside glCullFace(GL_FRONT); - gSphere.render(pixel_area); + gSphere.render(); glCullFace(GL_BACK); - glPopMatrix(); + gGL.popMatrix(); } return true; } @@ -4635,10 +4640,7 @@ void LLViewerWindow::stopGL(BOOL save_state) gPipeline.destroyGL(); } - gCone.cleanupGL(); gBox.cleanupGL(); - gSphere.cleanupGL(); - gCylinder.cleanupGL(); if(gPostProcess) { diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 0b746c841c..7e00350926 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -112,20 +112,6 @@ public: glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR])); } - if (data_mask & MAP_WEIGHT) - { - glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT])); - } - - if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1) - { - glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4])); - } - - if (data_mask & MAP_CLOTHWEIGHT) - { - glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT])); - } if (data_mask & MAP_VERTEX) { glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index 02d914a812..22fba90f65 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -91,8 +91,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset; val.mV[2] = (F32) i->second[2].asReal(); val.mV[3] = (F32) i->second[3].asReal(); - - shader->uniform4fv(param, 1, val.mV); + stop_glerror(); + shader->uniform4fv(param, 1, val.mV); + stop_glerror(); } else // param is the uniform name { @@ -118,8 +119,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const { val.mV[0] = i->second.asBoolean(); } - + stop_glerror(); shader->uniform4fv(param, 1, val.mV); + stop_glerror(); } } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d296081612..f6d021fda8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -458,7 +458,7 @@ void LLPipeline::init() } mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); - mDeferredVB->allocateBuffer(3, 0, true); + mDeferredVB->allocateBuffer(8, 0, true); setLightingDetail(-1); } @@ -3494,7 +3494,7 @@ void LLPipeline::renderHighlights() if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { gHighlightProgram.bind(); - gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f); + gHighlightProgram.uniform4f("highlight_color",1,1,1,0.5f); } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) @@ -3526,7 +3526,7 @@ void LLPipeline::renderHighlights() color.setVec(1.f, 0.f, 0.f, 0.5f); if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { - gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f); + gHighlightProgram.uniform4f("highlight_color",1,0,0,0.5f); } int count = mHighlightFaces.size(); for (S32 i = 0; i < count; i++) @@ -7021,7 +7021,7 @@ void LLPipeline::renderDeferredLighting() LLVector4 dir(mSunDir, 0.f); glh::vec4f tc(dir.mV); mat.mult_matrix_vec(tc); - mTransformedSunDir.set(dir.mV); + mTransformedSunDir.set(tc.v); } glPushMatrix(); @@ -7036,7 +7036,7 @@ void LLPipeline::renderDeferredLighting() { //paint shadow/SSAO light map (direct lighting lightmap) LLFastTimer ftm(FTM_SUN_SHADOW); bindDeferredShader(gDeferredSunProgram, 0); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); glClearColor(1,1,1,1); mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); @@ -7067,7 +7067,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7091,7 +7091,8 @@ void LLPipeline::renderDeferredLighting() gDeferredEdgeProgram.bind(); mEdgeMap.bindTarget(); bindDeferredShader(gDeferredEdgeProgram); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gDeferredEdgeProgram); mEdgeMap.flush(); } @@ -7113,7 +7114,8 @@ void LLPipeline::renderDeferredLighting() gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight()); mLuminanceMap.bindTarget(); bindDeferredShader(gLuminanceGatherProgram); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gLuminanceGatherProgram); mLuminanceMap.flush(); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true); @@ -7131,7 +7133,8 @@ void LLPipeline::renderDeferredLighting() mGIMapPost[0].bindTarget(); bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0, mTrueNoiseMap); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); unbindDeferredShader(gDeferredGIProgram); mGIMapPost[0].flush(); } @@ -7156,7 +7159,8 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_FALSE); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7171,7 +7175,8 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_FALSE); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } mGIMapPost[0].flush(); @@ -7185,13 +7190,12 @@ void LLPipeline::renderDeferredLighting() LLFastTimer ftm(FTM_SOFTEN_SHADOW); //blur lightmap mDeferredLight[1].bindTarget(); - glClearColor(1,1,1,1); mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); bindDeferredShader(gDeferredBlurLightProgram); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); const U32 kern_length = 4; F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); @@ -7219,7 +7223,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } @@ -7227,6 +7231,7 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredBlurLightProgram); bindDeferredShader(gDeferredBlurLightProgram, 1); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); mDeferredLight[0].bindTarget(); gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f); @@ -7235,7 +7240,7 @@ void LLPipeline::renderDeferredLighting() LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); stop_glerror(); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); stop_glerror(); } mDeferredLight[0].flush(); @@ -7338,12 +7343,12 @@ void LLPipeline::renderDeferredLighting() std::list light_colors; LLVertexBuffer::unbind(); + LLVector4a* v = (LLVector4a*) vert.get(); - F32 v[24]; - glVertexPointer(3, GL_FLOAT, 0, v); - { bindDeferredShader(gDeferredLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + LLGLDepthTest depth(GL_TRUE, GL_FALSE); for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter) { @@ -7398,15 +7403,15 @@ void LLPipeline::renderDeferredLighting() //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear //meaning negative facing - v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000 - v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001 - v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010 - v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011 + v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000 + v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001 + v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010 + v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011 - v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100 - v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101 - v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 - v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 + v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100 + v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101 + v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110 + v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111 if (camera->getOrigin().mV[0] > c[0] + s + 0.2f || camera->getOrigin().mV[0] < c[0] - s - 0.2f || @@ -7425,8 +7430,12 @@ void LLPipeline::renderDeferredLighting() } LLFastTimer ftm(FTM_LOCAL_LIGHTS); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + //glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); + gDeferredLightProgram.uniform3fv("center", 1, tc.v); + gDeferredLightProgram.uniform1f("size", s*s); + gDeferredLightProgram.uniform3fv("color", 1, col.mV); + gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); stop_glerror(); @@ -7453,6 +7462,8 @@ void LLPipeline::renderDeferredLighting() LLGLDepthTest depth(GL_TRUE, GL_FALSE); bindDeferredShader(gDeferredSpotLightProgram); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) @@ -7481,18 +7492,20 @@ void LLPipeline::renderDeferredLighting() //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear //meaning negative facing - v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000 - v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001 - v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010 - v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011 + v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000 + v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001 + v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010 + v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011 - v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100 - v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101 - v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 - v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 - - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100 + v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101 + v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110 + v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111 + + gDeferredSpotLightProgram.uniform3fv("center", 1, tc.v); + gDeferredSpotLightProgram.uniform1f("size", s*s); + gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV); + gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); } @@ -7500,6 +7513,11 @@ void LLPipeline::renderDeferredLighting() unbindDeferredShader(gDeferredSpotLightProgram); } + //reset mDeferredVB to fullscreen triangle + vert[0].set(-1,1,0); + vert[1].set(-1,-3,0); + vert[2].set(3,1,0); + { bindDeferredShader(gDeferredMultiLightProgram); @@ -7554,6 +7572,8 @@ void LLPipeline::renderDeferredLighting() gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) { LLFastTimer ftm(FTM_PROJECTORS); @@ -7575,9 +7595,11 @@ void LLPipeline::renderDeferredLighting() LLColor3 col = volume->getLightColor(); col *= volume->getLightIntensity(); - glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + gDeferredMultiSpotLightProgram.uniform3fv("center", 1, tc.v); + gDeferredMultiSpotLightProgram.uniform1f("size", s*s); + gDeferredMultiSpotLightProgram.uniform3fv("color", 1, col.mV); + gDeferredMultiSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); @@ -7610,7 +7632,7 @@ void LLPipeline::renderDeferredLighting() bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]); gDeferredPostProgram.bind(); - + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); LLVertexBuffer::unbind(); // glVertexPointer(2, GL_FLOAT, 0, vert); @@ -7622,8 +7644,8 @@ void LLPipeline::renderDeferredLighting() glPushMatrix(); glLoadIdentity(); - glDrawArrays(GL_TRIANGLES, 0, 3); - + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); @@ -8294,12 +8316,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); - gGL.diffuseColor4f(1,1,1,1); + gDeferredTreeShadowProgram.bind(); + gDeferredTreeShadowProgram.setAlphaRange(0.6f, 1.f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } //glCullFace(GL_BACK); + gDeferredShadowProgram.bind(); gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); doOcclusion(shadow_cam); @@ -9676,6 +9700,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) static const F32 clip_plane = 0.99999f; + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gGL.color4ub(64,64,64,255); gGL.begin(LLRender::QUADS); gGL.vertex3f(-1, -1, clip_plane); @@ -9685,6 +9714,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gGL.end(); gGL.flush(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } + glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); -- cgit v1.2.3 From 5e87957e053268031d1bd880b7f8e6f713394c5e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 13:02:14 -0500 Subject: Remove zip file that was accidentally added --- indra/newview/app_settings/shaders/class1/objects.zip | Bin 6772 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 indra/newview/app_settings/shaders/class1/objects.zip diff --git a/indra/newview/app_settings/shaders/class1/objects.zip b/indra/newview/app_settings/shaders/class1/objects.zip deleted file mode 100644 index 7e43660731..0000000000 Binary files a/indra/newview/app_settings/shaders/class1/objects.zip and /dev/null differ -- cgit v1.2.3 From db92b0369194f1a81b92fd3fa72458eb0c1d2f20 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 14:49:11 -0500 Subject: SH-2242 Start using "no fixed function" when rendering dynamic textures. --- indra/newview/lldynamictexture.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 799866091b..4955b6224e 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -209,10 +209,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() LLGLSLShader::bindNoShader(); LLVertexBuffer::unbind(); - //allow fixed function when rendering dynamic textures - bool no_fixed = LLGLSLShader::sNoFixedFunction; - LLGLSLShader::sNoFixedFunction = false; - + BOOL result = FALSE; BOOL ret = FALSE ; for( S32 order = 0; order < ORDER_COUNT; order++ ) @@ -243,7 +240,6 @@ BOOL LLViewerDynamicTexture::updateAllInstances() } } - LLGLSLShader::sNoFixedFunction = no_fixed; return ret; } -- cgit v1.2.3 From 364f8771ed6b7a4fabaf2ec1e547aafb8227c876 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 15:34:48 -0500 Subject: Merge cleanup. --- .../shaders/class1/objects/impostorF.glsl | 35 ++++++++++------------ .../shaders/class1/objects/impostorV.glsl | 12 ++++---- indra/newview/lldrawpoolavatar.cpp | 9 ------ 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl index 7257132f06..d6946d0de6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl @@ -5,22 +5,19 @@ * $/LicenseInfo$ */ -uniform float minimum_alpha; -uniform float maximum_alpha; - -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - -uniform sampler2D diffuseMap; - -void main() -{ - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; - - if (color.a < minimum_alpha || color.a > maximum_alpha) - { - discard; - } - - gl_FragColor = color; -} +uniform float minimum_alpha; +uniform float maximum_alpha; + +uniform sampler2D diffuseMap; + +void main() +{ + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); + + if (color.a < minimum_alpha || color.a > maximum_alpha) + { + discard; + } + + gl_FragColor = color; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl index 724b86a1b7..f1c307c459 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl @@ -5,12 +5,14 @@ * $/LicenseInfo$ */ - + + +attribute vec3 position; +attribute vec2 texcoord0; + void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 082448d95c..f0eb52909d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -581,11 +581,6 @@ void LLDrawPoolAvatar::beginImpostor() gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); sDiffuseChannel = 0; - - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } } void LLDrawPoolAvatar::endImpostor() @@ -595,10 +590,6 @@ void LLDrawPoolAvatar::endImpostor() gImpostorProgram.unbind(); } gPipeline.enableLightsDynamic(); - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.unbind(); - } } void LLDrawPoolAvatar::beginRigid() -- cgit v1.2.3 From 2dd8ce53e4e0d14f2bc20796eb6bdf1ef12a65df Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 11 Aug 2011 14:19:58 -0500 Subject: SH-2242 FXAA support instead of unreliable multisample textures (done here because it's a smaller change than integrating glVertexAttrib with FSAA pipe). Shader integration with LLDynamicTexture subclasses. --- indra/llrender/llgl.cpp | 2 + indra/llrender/llshadermgr.cpp | 13 +- .../class1/deferred/postDeferredNoDoFF.glsl | 2086 +++++++++++++++++++- .../shaders/class1/deferred/postDeferredV.glsl | 5 + .../shaders/class1/interface/glowcombineFXAAF.glsl | 23 + .../shaders/class1/interface/glowcombineFXAAV.glsl | 19 + .../shaders/class1/objects/previewV.glsl | 30 + indra/newview/llfloateranimpreview.cpp | 5 + indra/newview/llfloaterimagepreview.cpp | 39 +- indra/newview/llspatialpartition.cpp | 21 +- indra/newview/lltoolmorph.cpp | 5 + indra/newview/llviewershadermgr.cpp | 42 + indra/newview/llviewershadermgr.h | 2 + indra/newview/pipeline.cpp | 58 +- indra/newview/pipeline.h | 1 + .../newview/skins/default/xui/en/floater_about.xml | 52 +- 16 files changed, 2347 insertions(+), 56 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/previewV.glsl diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 87a6b9b885..1a2fe0ea0e 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -582,6 +582,8 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); } + //HACK always disable texture multisample, use FXAA instead + mHasTextureMultisample = FALSE; #if LL_WINDOWS if (mIsATI) { //using multisample textures on ATI results in black screen for some reason diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 986c1f2774..2334435644 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -531,9 +531,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } //we can't have any lines longer than 1024 characters - //or any shaders longer than 1024 lines... deal - DaveP + //or any shaders longer than 4096 lines... deal - DaveP GLcharARB buff[1024]; - GLcharARB* text[1024]; + GLcharARB* text[4096]; GLuint count = 0; if (gGLManager.mGLVersion < 2.1f) @@ -649,7 +649,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } //copy file into memory - while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) ) + while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(text) ) { text[count++] = (GLcharARB *)strdup((char *)buff); } @@ -709,6 +709,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade for (GLuint i = 0; i < count; i++) { ostr << i << ": " << text[i]; + + if (i % 128 == 0) + { //dump every 128 lines + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + ostr = std::stringstream(); + } + } LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index bf829bfc56..4c531ed20b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -1,24 +1,2096 @@ /** - * @file postDeferredF.glsl + * @file postDeferredNoDoFF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * $/LicenseInfo$ */ +#extension GL_ARB_texture_rectangle : enable +#define FXAA_PC 1 +#define FXAA_GLSL_130 1 +#define FXAA_QUALITY__PRESET 12 -#extension GL_ARB_texture_rectangle : enable +/*============================================================================ + + + NVIDIA FXAA 3.11 by TIMOTHY LOTTES + + +------------------------------------------------------------------------------ +COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. +------------------------------------------------------------------------------ +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED +*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR +CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR +LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, +OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE +THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +------------------------------------------------------------------------------ + INTEGRATION CHECKLIST +------------------------------------------------------------------------------ +(1.) +In the shader source, setup defines for the desired configuration. +When providing multiple shaders (for different presets), +simply setup the defines differently in multiple files. +Example, + + #define FXAA_PC 1 + #define FXAA_HLSL_5 1 + #define FXAA_QUALITY__PRESET 12 + +Or, + + #define FXAA_360 1 + +Or, + + #define FXAA_PS3 1 + +Etc. + +(2.) +Then include this file, + + #include "Fxaa3_11.h" + +(3.) +Then call the FXAA pixel shader from within your desired shader. +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. +As for FXAA 3.11 all inputs for all shaders are the same +to enable easy porting between platforms. + + return FxaaPixelShader(...); + +(4.) +Insure pass prior to FXAA outputs RGBL (see next section). +Or use, + + #define FXAA_GREEN_AS_LUMA 1 + +(5.) +Setup engine to provide the following constants +which are used in the FxaaPixelShader() inputs, + + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir + +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. + +(6.) +Have FXAA vertex shader run as a full screen triangle, +and output "pos" and "fxaaConsolePosPos" +such that inputs in the pixel shader provide, + + // {xy} = center of pixel + FxaaFloat2 pos, + + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + +(7.) +Insure the texture sampler(s) used by FXAA are set to bilinear filtering. + + +------------------------------------------------------------------------------ + INTEGRATION - RGBL AND COLORSPACE +------------------------------------------------------------------------------ +FXAA3 requires RGBL as input unless the following is set, + + #define FXAA_GREEN_AS_LUMA 1 + +In which case the engine uses green in place of luma, +and requires RGB input is in a non-linear colorspace. + +RGB should be LDR (low dynamic range). +Specifically do FXAA after tonemapping. + +RGB data as returned by a texture fetch can be non-linear, +or linear when FXAA_GREEN_AS_LUMA is not set. +Note an "sRGB format" texture counts as linear, +because the result of a texture fetch is linear data. +Regular "RGBA8" textures in the sRGB colorspace are non-linear. + +If FXAA_GREEN_AS_LUMA is not set, +luma must be stored in the alpha channel prior to running FXAA. +This luma should be in a perceptual space (could be gamma 2.0). +Example pass before FXAA where output is gamma 2.0 encoded, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma + return color; + +Another example where output is linear encoded, +say for instance writing to an sRGB formated render target, +where the render target does the conversion back to sRGB after blending, + + color.rgb = ToneMap(color.rgb); // linear color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma + return color; + +Getting luma correct is required for the algorithm to work correctly. + + +------------------------------------------------------------------------------ + BEING LINEARLY CORRECT? +------------------------------------------------------------------------------ +Applying FXAA to a framebuffer with linear RGB color will look worse. +This is very counter intuitive, but happends to be true in this case. +The reason is because dithering artifacts will be more visiable +in a linear colorspace. + + +------------------------------------------------------------------------------ + COMPLEX INTEGRATION +------------------------------------------------------------------------------ +Q. What if the engine is blending into RGB before wanting to run FXAA? + +A. In the last opaque pass prior to FXAA, + have the pass write out luma into alpha. + Then blend into RGB only. + FXAA should be able to run ok + assuming the blending pass did not any add aliasing. + This should be the common case for particles and common blending passes. + +A. Or use FXAA_GREEN_AS_LUMA. + +============================================================================*/ + +/*============================================================================ + + INTEGRATION KNOBS + +============================================================================*/ +// +// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE). +// FXAA_360_OPT is a prototype for the new optimized 360 version. +// +// 1 = Use API. +// 0 = Don't use API. +// +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PS3 + #define FXAA_PS3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360 + #define FXAA_360 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360_OPT + #define FXAA_360_OPT 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_PC + // + // FXAA Quality + // The high quality PC algorithm. + // + #define FXAA_PC 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PC_CONSOLE + // + // The console algorithm for PC is included + // for developers targeting really low spec machines. + // Likely better to just run FXAA_PC, and use a really low preset. + // + #define FXAA_PC_CONSOLE 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_120 + #define FXAA_GLSL_120 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_130 + #define FXAA_GLSL_130 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_3 + #define FXAA_HLSL_3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_4 + #define FXAA_HLSL_4 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_5 + #define FXAA_HLSL_5 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_GREEN_AS_LUMA + // + // For those using non-linear color, + // and either not able to get luma in alpha, or not wanting to, + // this enables FXAA to run using green as a proxy for luma. + // So with this enabled, no need to pack luma in alpha. + // + // This will turn off AA on anything which lacks some amount of green. + // Pure red and blue or combination of only R and B, will get no AA. + // + // Might want to lower the settings for both, + // fxaaConsoleEdgeThresholdMin + // fxaaQualityEdgeThresholdMin + // In order to insure AA does not get turned off on colors + // which contain a minor amount of green. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_GREEN_AS_LUMA 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_EARLY_EXIT + // + // Controls algorithm's early exit path. + // On PS3 turning this ON adds 2 cycles to the shader. + // On 360 turning this OFF adds 10ths of a millisecond to the shader. + // Turning this off on console will result in a more blurry image. + // So this defaults to on. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_EARLY_EXIT 1 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_DISCARD + // + // Only valid for PC OpenGL currently. + // Probably will not work when FXAA_GREEN_AS_LUMA = 1. + // + // 1 = Use discard on pixels which don't need AA. + // For APIs which enable concurrent TEX+ROP from same surface. + // 0 = Return unchanged color on pixels which don't need AA. + // + #define FXAA_DISCARD 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_FAST_PIXEL_OFFSET + // + // Used for GLSL 120 only. + // + // 1 = GL API supports fast pixel offsets + // 0 = do not use fast pixel offsets + // + #ifdef GL_EXT_gpu_shader4 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifndef FXAA_FAST_PIXEL_OFFSET + #define FXAA_FAST_PIXEL_OFFSET 0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GATHER4_ALPHA + // + // 1 = API supports gather4 on alpha channel. + // 0 = API does not support gather4 on alpha channel. + // + #if (FXAA_HLSL_5 == 1) + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif +#endif + +/*============================================================================ + FXAA CONSOLE PS3 - TUNING KNOBS +============================================================================*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS + // + // Consoles the sharpness of edges on PS3 only. + // Non-PS3 tuning is done with shader input. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 8.0 is sharper + // 4.0 is softer + // 2.0 is really soft (good for vector graphics inputs) + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD + // + // Only effects PS3. + // Non-PS3 tuning is done with shader input. + // + // The minimum amount of local contrast required to apply algorithm. + // The console setting has a different mapping than the quality setting. + // + // This only applies when FXAA_EARLY_EXIT is 1. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 0.25 and 0.125. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 0.125 leaves less aliasing, but is softer + // 0.25 leaves more aliasing, and is sharper + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125 + #else + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25 + #endif +#endif + +/*============================================================================ + FXAA QUALITY - TUNING KNOBS +------------------------------------------------------------------------------ +NOTE the other tuning knobs are now in the shader function inputs! +============================================================================*/ +#ifndef FXAA_QUALITY__PRESET + // + // Choose the quality preset. + // This needs to be compiled into the shader as it effects code. + // Best option to include multiple presets is to + // in each shader define the preset, then include this file. + // + // OPTIONS + // ----------------------------------------------------------------------- + // 10 to 15 - default medium dither (10=fastest, 15=highest quality) + // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) + // 39 - no dither, very expensive + // + // NOTES + // ----------------------------------------------------------------------- + // 12 = slightly faster then FXAA 3.9 and higher edge quality (default) + // 13 = about same speed as FXAA 3.9 and better than 12 + // 23 = closest to FXAA 3.9 visually and performance wise + // _ = the lowest digit is directly related to performance + // _ = the highest digit is directly related to style + // + #define FXAA_QUALITY__PRESET 12 +#endif + + +/*============================================================================ + + FXAA QUALITY - PRESETS + +============================================================================*/ + +/*============================================================================ + FXAA QUALITY - MEDIUM DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 10) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 3.0 + #define FXAA_QUALITY__P2 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 11) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 3.0 + #define FXAA_QUALITY__P3 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 12) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 4.0 + #define FXAA_QUALITY__P4 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 13) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 4.0 + #define FXAA_QUALITY__P5 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 14) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 4.0 + #define FXAA_QUALITY__P6 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 15) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 12.0 +#endif + +/*============================================================================ + FXAA QUALITY - LOW DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 20) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 2.0 + #define FXAA_QUALITY__P2 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 21) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 22) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 23) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 24) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 3.0 + #define FXAA_QUALITY__P6 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 25) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 26) + #define FXAA_QUALITY__PS 9 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 4.0 + #define FXAA_QUALITY__P8 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 27) + #define FXAA_QUALITY__PS 10 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 4.0 + #define FXAA_QUALITY__P9 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 28) + #define FXAA_QUALITY__PS 11 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 4.0 + #define FXAA_QUALITY__P10 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 29) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif -uniform sampler2DRect diffuseRect; -uniform sampler2D bloomMap; +/*============================================================================ + FXAA QUALITY - EXTREME QUALITY +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 39) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.0 + #define FXAA_QUALITY__P2 1.0 + #define FXAA_QUALITY__P3 1.0 + #define FXAA_QUALITY__P4 1.0 + #define FXAA_QUALITY__P5 1.5 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + + +/*============================================================================ + + API PORTING + +============================================================================*/ +#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1) + #define FxaaBool bool + #define FxaaDiscard discard + #define FxaaFloat float + #define FxaaFloat2 vec2 + #define FxaaFloat3 vec3 + #define FxaaFloat4 vec4 + #define FxaaHalf float + #define FxaaHalf2 vec2 + #define FxaaHalf3 vec3 + #define FxaaHalf4 vec4 + #define FxaaInt2 ivec2 + #define FxaaSat(x) clamp(x, 0.0, 1.0) + #define FxaaTex sampler2D +#else + #define FxaaBool bool + #define FxaaDiscard clip(-1) + #define FxaaFloat float + #define FxaaFloat2 float2 + #define FxaaFloat3 float3 + #define FxaaFloat4 float4 + #define FxaaHalf half + #define FxaaHalf2 half2 + #define FxaaHalf3 half3 + #define FxaaHalf4 half4 + #define FxaaSat(x) saturate(x) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_120 == 1) + // Requires, + // #version 120 + // And at least, + // #extension GL_EXT_gpu_shader4 : enable + // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9) + #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0) + #if (FXAA_FAST_PIXEL_OFFSET == 1) + #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o) + #else + #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0) + #endif + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_130 == 1) + // Requires "#version 130" or better + #define FxaaTexTop(t, p) textureLod(t, p, 0.0) + #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o) + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1) + #define FxaaInt2 float2 + #define FxaaTex sampler2D + #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0)) + #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0)) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_4 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_5 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) + #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p) + #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o) + #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p) + #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o) +#endif + + +/*============================================================================ + GREEN AS LUMA OPTION SUPPORT FUNCTION +============================================================================*/ +#if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; } +#else + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } +#endif + + + + +/*============================================================================ + + FXAA3 QUALITY - PC + +============================================================================*/ +#if (FXAA_PC == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy} = center of pixel + FxaaFloat2 pos, + // + // Used only for FXAA Console, and not used on the 360 version. + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + // + // Input color texture. + // {rgb_} = color in linear or perceptual color space + // if (FXAA_GREEN_AS_LUMA == 0) + // {___a} = luma in perceptual color space (not linear) + FxaaTex tex, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 2nd sampler. + // This sampler needs to have an exponent bias of -1. + FxaaTex fxaaConsole360TexExpBiasNegOne, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 3nd sampler. + // This sampler needs to have an exponent bias of -2. + FxaaTex fxaaConsole360TexExpBiasNegTwo, + // + // Only used on FXAA Quality. + // This must be from a constant/uniform. + // {x_} = 1.0/screenWidthInPixels + // {_y} = 1.0/screenHeightInPixels + FxaaFloat2 fxaaQualityRcpFrame, + // + // Only used on FXAA Console. + // This must be from a constant/uniform. + // This effects sub-pixel AA quality and inversely sharpness. + // Where N ranges between, + // N = 0.50 (default) + // N = 0.33 (sharper) + // {x___} = -N/screenWidthInPixels + // {_y__} = -N/screenHeightInPixels + // {__z_} = N/screenWidthInPixels + // {___w} = N/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt, + // + // Only used on FXAA Console. + // Not used on 360, but used on PS3 and PC. + // This must be from a constant/uniform. + // {x___} = -2.0/screenWidthInPixels + // {_y__} = -2.0/screenHeightInPixels + // {__z_} = 2.0/screenWidthInPixels + // {___w} = 2.0/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + // + // Only used on FXAA Console. + // Only used on 360 in place of fxaaConsoleRcpFrameOpt2. + // This must be from a constant/uniform. + // {x___} = 8.0/screenWidthInPixels + // {_y__} = 8.0/screenHeightInPixels + // {__z_} = -4.0/screenWidthInPixels + // {___w} = -4.0/screenHeightInPixels + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + FxaaFloat fxaaQualitySubpix, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + FxaaFloat fxaaQualityEdgeThreshold, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaQualityEdgeThresholdMin, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // 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. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + FxaaFloat fxaaConsoleEdgeSharpness, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3. + // Due to the PS3 being ALU bound, + // 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. + // The console setting has a different mapping than the quality setting. + // Other platforms can use other values. + // 0.125 leaves less aliasing, but is softer (default!!!) + // 0.25 leaves more aliasing, and is sharper + FxaaFloat fxaaConsoleEdgeThreshold, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // The console setting has a different mapping than the quality setting. + // This only applies when FXAA_EARLY_EXIT is 1. + // This does not apply to PS3, + // PS3 was simplified to avoid more shader instructions. + // 0.06 - faster but more aliasing in darks + // 0.05 - default + // 0.04 - slower and less aliasing in darks + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaConsoleEdgeThresholdMin, + // + // Extra constants for 360 FXAA Console only. + // Use zeros or anything else for other platforms. + // These must be in physical constant registers and NOT immedates. + // Immedates will result in compiler un-optimizing. + // {xyzw} = float4(1.0, -1.0, 0.25, -0.25) + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posM; + posM.x = pos.x; + posM.y = pos.y; + #if (FXAA_GATHER4_ALPHA == 1) + #if (FXAA_DISCARD == 0) + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + #endif + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1)); + #else + FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1)); + #endif + #if (FXAA_DISCARD == 1) + #define lumaM luma4A.w + #endif + #define lumaE luma4A.z + #define lumaS luma4A.x + #define lumaSE luma4A.y + #define lumaNW luma4B.w + #define lumaN luma4B.z + #define lumaW luma4B.x + #else + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat maxSM = max(lumaS, lumaM); + FxaaFloat minSM = min(lumaS, lumaM); + FxaaFloat maxESM = max(lumaE, maxSM); + FxaaFloat minESM = min(lumaE, minSM); + FxaaFloat maxWN = max(lumaN, lumaW); + FxaaFloat minWN = min(lumaN, lumaW); + FxaaFloat rangeMax = max(maxWN, maxESM); + FxaaFloat rangeMin = min(minWN, minESM); + FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold; + FxaaFloat range = rangeMax - rangeMin; + FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled); + FxaaBool earlyExit = range < rangeMaxClamped; +/*--------------------------------------------------------------------------*/ + if(earlyExit) + #if (FXAA_DISCARD == 1) + FxaaDiscard; + #else + return rgbyM; + #endif +/*--------------------------------------------------------------------------*/ + #if (FXAA_GATHER4_ALPHA == 0) + FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #else + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNS = lumaN + lumaS; + FxaaFloat lumaWE = lumaW + lumaE; + FxaaFloat subpixRcpRange = 1.0/range; + FxaaFloat subpixNSWE = lumaNS + lumaWE; + FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS; + FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNESE = lumaNE + lumaSE; + FxaaFloat lumaNWNE = lumaNW + lumaNE; + FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE; + FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNWSW = lumaNW + lumaSW; + FxaaFloat lumaSWSE = lumaSW + lumaSE; + FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2); + FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2); + FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW; + FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE; + FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4; + FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4; +/*--------------------------------------------------------------------------*/ + FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE; + FxaaFloat lengthSign = fxaaQualityRcpFrame.x; + FxaaBool horzSpan = edgeHorz >= edgeVert; + FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE; +/*--------------------------------------------------------------------------*/ + if(!horzSpan) lumaN = lumaW; + if(!horzSpan) lumaS = lumaE; + if(horzSpan) lengthSign = fxaaQualityRcpFrame.y; + FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM; +/*--------------------------------------------------------------------------*/ + FxaaFloat gradientN = lumaN - lumaM; + FxaaFloat gradientS = lumaS - lumaM; + FxaaFloat lumaNN = lumaN + lumaM; + FxaaFloat lumaSS = lumaS + lumaM; + FxaaBool pairN = abs(gradientN) >= abs(gradientS); + FxaaFloat gradient = max(abs(gradientN), abs(gradientS)); + if(pairN) lengthSign = -lengthSign; + FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange); +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posB; + posB.x = posM.x; + posB.y = posM.y; + FxaaFloat2 offNP; + offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; + offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; + if(!horzSpan) posB.x += lengthSign * 0.5; + if( horzSpan) posB.y += lengthSign * 0.5; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posN; + posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; + posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; + FxaaFloat2 posP; + posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; + posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; + FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; + FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); + FxaaFloat subpixE = subpixC * subpixC; + FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP)); +/*--------------------------------------------------------------------------*/ + if(!pairN) lumaNN = lumaSS; + FxaaFloat gradientScaled = gradient * 1.0/4.0; + FxaaFloat lumaMM = lumaM - lumaNN * 0.5; + FxaaFloat subpixF = subpixD * subpixE; + FxaaBool lumaMLTZero = lumaMM < 0.0; +/*--------------------------------------------------------------------------*/ + lumaEndN -= lumaNN * 0.5; + lumaEndP -= lumaNN * 0.5; + FxaaBool doneN = abs(lumaEndN) >= gradientScaled; + FxaaBool doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; + FxaaBool doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; +/*--------------------------------------------------------------------------*/ + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 3) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 4) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 5) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 6) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 7) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 8) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 9) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 10) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 11) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 12) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } +/*--------------------------------------------------------------------------*/ + FxaaFloat dstN = posM.x - posN.x; + FxaaFloat dstP = posP.x - posM.x; + if(!horzSpan) dstN = posM.y - posN.y; + if(!horzSpan) dstP = posP.y - posM.y; +/*--------------------------------------------------------------------------*/ + FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero; + FxaaFloat spanLength = (dstP + dstN); + FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero; + FxaaFloat spanLengthRcp = 1.0/spanLength; +/*--------------------------------------------------------------------------*/ + FxaaBool directionN = dstN < dstP; + FxaaFloat dst = min(dstN, dstP); + FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP; + FxaaFloat subpixG = subpixF * subpixF; + FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5; + FxaaFloat subpixH = subpixG * fxaaQualitySubpix; +/*--------------------------------------------------------------------------*/ + FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0; + FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH); + if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign; + if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign; + #if (FXAA_DISCARD == 1) + return FxaaTexTop(tex, posM); + #else + return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); + #endif +} +/*==========================================================================*/ +#endif + + + + +/*============================================================================ + + FXAA3 CONSOLE - PC VERSION + +------------------------------------------------------------------------------ +Instead of using this on PC, I'd suggest just using FXAA Quality with + #define FXAA_QUALITY__PRESET 10 +Or + #define FXAA_QUALITY__PRESET 20 +Either are higher qualilty and almost as fast as this on modern PC GPUs. +============================================================================*/ +#if (FXAA_PC_CONSOLE == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy)); + FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw)); + FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy)); + FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw)); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy); + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat lumaM = rgbyM.w; + #else + FxaaFloat lumaM = rgbyM.y; + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw); + lumaNe += 1.0/384.0; + FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe); + FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw); + FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMinM = min(lumaMin, lumaM); + FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled); + FxaaFloat lumaMaxM = max(lumaMax, lumaM); + FxaaFloat dirSwMinusNe = lumaSw - lumaNe; + FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM; + FxaaFloat dirSeMinusNw = lumaSe - lumaNw; + if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir; + dir.x = dirSwMinusNe + dirSeMinusNw; + dir.y = dirSwMinusNe - dirSeMinusNw; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir1 = normalize(dir.xy); + FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw); + FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness; + FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw); + FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyA = rgbyN1 + rgbyP1; + FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25); +/*--------------------------------------------------------------------------*/ + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax); + #else + FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax); + #endif + if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5; + return rgbyB; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - 360 PIXEL SHADER + +------------------------------------------------------------------------------ +This optimized version thanks to suggestions from Andy Luedke. +Should be fully tex bound in all cases. +As of the FXAA 3.11 release, I have still not tested this code, +however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10. +And note this is replacing the old unoptimized version. +If it does not work, please let me know so I can fix it. +============================================================================*/ +#if (FXAA_360 == 1) +/*--------------------------------------------------------------------------*/ +[reduceTempRegUsage(4)] +float4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + float4 lumaNwNeSwSe; + #if (FXAA_GREEN_AS_LUMA == 0) + asm { + tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #else + asm { + tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #endif +/*--------------------------------------------------------------------------*/ + lumaNwNeSwSe.y += 1.0/384.0; + float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y); + float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y); +/*--------------------------------------------------------------------------*/ + float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + float lumaMinM = min(lumaMin, rgbyM.w); + float lumaMaxM = max(lumaMax, rgbyM.w); + #else + float lumaMinM = min(lumaMin, rgbyM.y); + float lumaMaxM = max(lumaMax, rgbyM.y); + #endif + if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM; +/*--------------------------------------------------------------------------*/ + float2 dir; + dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx); + dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy); + dir = normalize(dir); +/*--------------------------------------------------------------------------*/ + float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw; +/*--------------------------------------------------------------------------*/ + float4 dir2; + float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness; + dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5); + dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw; +/*--------------------------------------------------------------------------*/ + float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0)); + float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0)); + float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0)); + float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ + float4 rgbyA = rgbyN1 + rgbyP1; + float4 rgbyB = rgbyN2 + rgbyP2 * 0.5 + rgbyA; +/*--------------------------------------------------------------------------*/ + float4 rgbyR = ((rgbyB.w - lumaMax) > 0.0) ? rgbyA : rgbyB; + rgbyR = ((rgbyB.w - lumaMin) > 0.0) ? rgbyR : rgbyA; + return rgbyR; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT) + +============================================================================== +The code below does not exactly match the assembly. +I have a feeling that 12 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h0.w(TRUE), v5.xwxx, #0 + 6: addh h0.z(TRUE), -h2, h0.w + 7: texpkb h1.w(TRUE), v5, #0 + 9: addh h0.x(TRUE), h0.z, -h1.w + 10: addh h3.w(TRUE), h0.z, h1 + 11: texpkb h2.w(TRUE), v5.zwzz, #0 + 13: addh h0.z(TRUE), h3.w, -h2.w + 14: addh h0.x(TRUE), h2.w, h0 + 15: nrmh h1.xz(TRUE), h0_n + 16: minh_m8 h0.x(TRUE), |h1|, |h1.z| + 17: maxh h4.w(TRUE), h0, h1 + 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n + 19: movr r1.zw(TRUE), v4.xxxy + 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww + 22: minh h5.w(TRUE), h0, h1 + 23: texpkb h0(TRUE), r2.xzxx, #0 + 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1 + 27: maxh h4.x(TRUE), h2.z, h2.w + 28: texpkb h1(TRUE), r0.zwzz, #0 + 30: addh_d2 h1(TRUE), h0, h1 + 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 33: texpkb h0(TRUE), r0, #0 + 35: minh h4.z(TRUE), h2, h2.w + 36: fenct TRUE + 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 39: texpkb h2(TRUE), r1, #0 + 41: addh_d2 h0(TRUE), h0, h2 + 42: maxh h2.w(TRUE), h4, h4.x + 43: minh h2.x(TRUE), h5.w, h4.z + 44: addh_d2 h0(TRUE), h0, h1 + 45: slth h2.x(TRUE), h0.w, h2 + 46: sgth h2.w(TRUE), h0, h2 + 47: movh h0(TRUE), h0 + 48: addx.c0 rc(TRUE), h2, h2.w + 49: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-; + | | | + 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-; + | | | + 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---; + | SCB1 | add | 10: ADDh h3.w, h0.---z, h1; + | | | + 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h2.w---, h0; + | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-; + | | | + 5 | SCT1 | mov | 15: NRMh h1.xz, h0; + | SRB | nrm | 15: NRMh h1.xz, h0; + | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|; + | SCB1 | max | 17: MAXh h4.w, h0, h1; + | | | + 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0; + | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy; + | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-; + | SCB1 | min | 22: MINh h5.w, h0, h1; + | | | + 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---; + | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1; + | | | + 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | SCB0/1 | add | 30: ADDh/2 h1, h0, h1; + | | | + 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--; + | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0; + | SCB1 | min | 35: MINh h4.z, h2, h2.--w-; + | | | + 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--; + | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0; + | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0; + | SCB0/1 | add | 41: ADDh/2 h0, h0, h2; + | | | + 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---; + | SCT1 | max | 42: MAXh h2.w, h4, h4.---x; + | SCB0/1 | add | 44: ADDh/2 h0, h0, h1; + | | | + 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2; + | SCT1 | set | 46: SGTh h2.w, h0, h2; + | SCB0/1 | mul | 47: MOVh h0, h0; + | | | + 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---; + | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 0% 0% 50% + 6: 100% 0% 75% + 7: 0% 100% 75% + 8: 0% 100% 100% + 9: 0% 100% 25% + 10: 0% 100% 100% + 11: 50% 0% 100% + 12: 50% 0% 100% + 13: 25% 0% 100% + +MEAN: 17% 61% 67% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 0% 100% + 2: 0% 0% 100% 0% 100% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 0% 0% 0% 100% 100% + 6: 100% 100% 0% 100% 100% + 7: 0% 0% 100% 100% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 0% 100% + 10: 0% 0% 100% 100% 100% + 11: 100% 100% 0% 100% 100% + 12: 100% 100% 0% 100% 100% + 13: 100% 0% 0% 100% 100% + +MEAN: 30% 23% 61% 76% 100% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 13 cycles, 3 r regs, 923,076,923 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O3 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 dir; + half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + lumaNe.w += half(1.0/512.0); + dir.x = -lumaNe.w; + dir.z = -lumaNe.w; + #else + lumaNe.y += half(1.0/512.0); + dir.x = -lumaNe.y; + dir.z = -lumaNe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSw.w; + dir.z += lumaSw.w; + #else + dir.x += lumaSw.y; + dir.z += lumaSw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x -= lumaNw.w; + dir.z += lumaNw.w; + #else + dir.x -= lumaNw.y; + dir.z += lumaNw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSe.w; + dir.z -= lumaSe.w; + #else + dir.x += lumaSe.y; + dir.z -= lumaSe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half4 dir1_pos; + dir1_pos.xy = normalize(dir.xyz).xz; + half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (7) + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (8) + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (9) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (11) + // compilier moves these scalar ops up to other cycles + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w)); + half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w)); + #else + half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y)); + half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y)); + #endif + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (12) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif +/*--------------------------------------------------------------------------*/ +// (13) + if(twoTapLt || twoTapGt) rgby2 = rgby1; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT) + +============================================================================== +The code mostly matches the assembly. +I have a feeling that 14 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks). +Will look at fixing this for FXAA 3.12. +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h1.w(TRUE), v5.xwxx, #0 + 6: addh h0.x(TRUE), h1.w, -h2.y + 7: texpkb h2.w(TRUE), v5.zwzz, #0 + 9: minh h4.w(TRUE), h2.y, h2 + 10: maxh h5.x(TRUE), h2.y, h2.w + 11: texpkb h0.w(TRUE), v5, #0 + 13: addh h3.w(TRUE), -h0, h0.x + 14: addh h0.x(TRUE), h0.w, h0 + 15: addh h0.z(TRUE), -h2.w, h0.x + 16: addh h0.x(TRUE), h2.w, h3.w + 17: minh h5.y(TRUE), h0.w, h1.w + 18: nrmh h2.xz(TRUE), h0_n + 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z| + 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w + 21: movr r1.zw(TRUE), v4.xxxy + 22: maxh h2.w(TRUE), h0, h1 + 23: fenct TRUE + 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 26: texpkb h0(TRUE), r0, #0 + 28: maxh h5.x(TRUE), h2.w, h5 + 29: minh h5.w(TRUE), h5.y, h4 + 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 32: texpkb h2(TRUE), r1, #0 + 34: addh_d2 h2(TRUE), h0, h2 + 35: texpkb h1(TRUE), v4, #0 + 37: maxh h5.y(TRUE), h5.x, h1.w + 38: minh h4.w(TRUE), h1, h5 + 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 41: texpkb h0(TRUE), r0, #0 + 43: addh_m8 h5.z(TRUE), h5.y, -h4.w + 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 46: texpkb h3(TRUE), r2, #0 + 48: addh_d2 h0(TRUE), h0, h3 + 49: addh_d2 h3(TRUE), h0, h2 + 50: movh h0(TRUE), h3 + 51: slth h3.x(TRUE), h3.w, h5.w + 52: sgth h3.w(TRUE), h3, h5.x + 53: addx.c0 rc(TRUE), h3.x, h3 + 54: slth.c0 rc(TRUE), h5.z, h5 + 55: movh h0(c0.NE.w), h2 + 56: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--; + | | | + 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---; + | | | + 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---; + | SCB1 | min | 9: MINh h4.w, h2.---y, h2; + | | | + 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h0.w---, h0; + | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x; + | | | + 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---; + | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-; + | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--; + | | | + 6 | SCT1 | mov | 18: NRMh h2.xz, h0; + | SRB | nrm | 18: NRMh h2.xz, h0; + | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|; + | | | + 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--; + | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy; + | SCB1 | max | 22: MAXh h2.w, h0, h1; + | | | + 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0; + | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0; + | SCB0 | max | 28: MAXh h5.x, h2.w---, h5; + | SCB1 | min | 29: MINh h5.w, h5.---y, h4; + | | | + 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0; + | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0; + | SCB0/1 | add | 34: ADDh/2 h2, h0, h2; + | | | + 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--; + | SCB1 | min | 38: MINh h4.w, h1, h5; + | | | + 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--; + | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0; + | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--; + | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-; + | | | + 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0; + | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0; + | SCB0/1 | add | 48: ADDh/2 h0, h0, h3; + | | | + 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2; + | SCB0/1 | mul | 50: MOVh h0, h3; + | | | + 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---; + | SCT1 | set | 52: SGTh h3.w, h3, h5.---x; + | SCB0 | set | 54: SLThc0 rc, h5.z---, h5; + | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3; + | | | + 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2; + | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 50% 0% 25% + 6: 0% 0% 25% + 7: 100% 0% 25% + 8: 0% 100% 50% + 9: 0% 100% 100% + 10: 0% 100% 50% + 11: 0% 100% 75% + 12: 0% 100% 100% + 13: 100% 0% 100% + 14: 50% 0% 50% + 15: 100% 0% 100% + +MEAN: 26% 60% 56% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 100% 0% + 2: 0% 0% 100% 100% 0% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 100% 100% 0% 100% 0% + 6: 0% 0% 0% 0% 100% + 7: 100% 100% 0% 0% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 100% 100% + 10: 0% 0% 100% 100% 100% + 11: 0% 0% 100% 100% 100% + 12: 0% 0% 100% 100% 100% + 13: 100% 100% 0% 100% 100% + 14: 100% 100% 0% 100% 100% + 15: 100% 100% 0% 100% 100% + +MEAN: 33% 33% 60% 86% 80% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 15 cycles, 3 r regs, 800,000,000 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O2 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaNe = rgbyNe.w + half(1.0/512.0); + #else + half lumaNe = rgbyNe.y + half(1.0/512.0); + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaSwNegNe = lumaSw.w - lumaNe; + #else + half lumaSwNegNe = lumaSw.y - lumaNe; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNwSw = max(lumaNw.w, lumaSw.w); + half lumaMinNwSw = min(lumaNw.w, lumaSw.w); + #else + half lumaMaxNwSw = max(lumaNw.y, lumaSw.y); + half lumaMinNwSw = min(lumaNw.y, lumaSw.y); + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half dirZ = lumaNw.w + lumaSwNegNe; + half dirX = -lumaNw.w + lumaSwNegNe; + #else + half dirZ = lumaNw.y + lumaSwNegNe; + half dirX = -lumaNw.y + lumaSwNegNe; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half3 dir; + dir.y = 0.0; + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x = lumaSe.w + dirX; + dir.z = -lumaSe.w + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.w); + #else + dir.x = lumaSe.y + dirX; + dir.z = -lumaSe.y + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir1_pos; + dir1_pos.xy = normalize(dir).xz; + half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (7) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNeSe = max(lumaNe, lumaSe.w); + #else + half lumaMaxNeSe = max(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (8) + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe); + half lumaMin = min(lumaMinNwSw, lumaMinNeSe); +/*--------------------------------------------------------------------------*/ +// (9) + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxM = max(lumaMax, rgbyM.w); + half lumaMinM = min(lumaMin, rgbyM.w); + #else + half lumaMaxM = max(lumaMax, rgbyM.y); + half lumaMinM = min(lumaMin, rgbyM.y); + #endif +/*--------------------------------------------------------------------------*/ +// (11) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD; +/*--------------------------------------------------------------------------*/ +// (12) + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (13) + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (14) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif + bool earlyExit = lumaRangeM < lumaMax; + bool twoTap = twoTapLt || twoTapGt; +/*--------------------------------------------------------------------------*/ +// (15) + if(twoTap) rgby2 = rgby1; + if(earlyExit) rgby2 = rgbyM; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif + +uniform sampler2D diffuseMap; + +uniform vec2 rcp_screen_res; +uniform vec4 rcp_frame_opt; +uniform vec4 rcp_frame_opt2; uniform vec2 screen_res; varying vec2 vary_fragcoord; +varying vec2 vary_tc; void main() { - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + vec4 diff = FxaaPixelShader(vary_tc, //pos + vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos + diffuseMap, //tex + diffuseMap, + diffuseMap, + rcp_screen_res, //fxaaQualityRcpFrame + vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt + rcp_frame_opt, //fxaaConsoleRcpFrameOpt2 + rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2 + 0.75, //fxaaQualitySubpix + 0.166, //fxaaQualityEdgeThreshold + 0.0833, //fxaaQualityEdgeThresholdMin + 8.0, //fxaaConsoleEdgeSharpness + 0.125, //fxaaConsoleEdgeThreshold + 0.05, //fxaaConsoleEdgeThresholdMin + vec4(0,0,0,0)); //fxaaConsole360ConstDir + + + + //diff = texture2D(diffuseMap, vary_tc); + + gl_FragColor = diff; - vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor = diff + bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 30dbe3f75e..c327011184 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -8,6 +8,10 @@ attribute vec3 position; varying vec2 vary_fragcoord; +varying vec2 vary_tc; + +uniform vec2 tc_scale; + uniform vec2 screen_res; void main() @@ -15,5 +19,6 @@ void main() //transform vertex vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); gl_Position = pos; + vary_tc = (pos.xy*0.5+0.5)*tc_scale; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl new file mode 100644 index 0000000000..6639f88047 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl @@ -0,0 +1,23 @@ +/** + * @file glowcombineFXAAF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2D glowMap; +uniform sampler2DRect screenMap; + +uniform vec2 screen_res; +varying vec2 vary_tc; + +void main() +{ + vec3 col = texture2D(glowMap, vary_tc).rgb + + texture2DRect(screenMap, vary_tc*screen_res).rgb; + + + gl_FragColor = vec4(col.rgb, dot(col.rgb, vec3(0.299, 0.587, 0.144))); +} diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl new file mode 100644 index 0000000000..f54876135e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl @@ -0,0 +1,19 @@ +/** + * @file glowcombineFXAAV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec3 position; + +varying vec2 vary_tc; + +void main() +{ + vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); + gl_Position = pos; + + vary_tc = pos.xy*0.5+0.5; +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl new file mode 100644 index 0000000000..555c59c37e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -0,0 +1,30 @@ +/** + * @file previewV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ + +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); + + vec3 norm = normalize(gl_NormalMatrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 1f334815d6..ef92dfd956 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -1072,6 +1072,11 @@ BOOL LLPreviewAnimation::render() gGL.pushMatrix(); glLoadIdentity(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + LLGLSUIDefault def; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index dc4c15316a..b9c298ff9d 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -50,6 +50,7 @@ #include "llvoavatar.h" #include "pipeline.h" #include "lluictrlfactory.h" +#include "llviewershadermgr.h" #include "llviewertexturelist.h" #include "llstring.h" @@ -662,6 +663,11 @@ BOOL LLImagePreviewAvatar::render() LLGLSUIDefault def; gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gl_rect_2d_simple( mFullWidth, mFullHeight ); glMatrixMode(GL_PROJECTION); @@ -690,8 +696,7 @@ BOOL LLImagePreviewAvatar::render() LLVertexBuffer::unbind(); avatarp->updateLOD(); - - + if (avatarp->mDrawable.notNull()) { LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); @@ -790,15 +795,17 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) U32 num_indices = vf.mNumIndices; U32 num_vertices = vf.mNumVertices; - mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL, 0); + mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0, 0); mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE); LLStrider vertex_strider; LLStrider normal_strider; + LLStrider tc_strider; LLStrider index_strider; mVertexBuffer->getVertexStrider(vertex_strider); mVertexBuffer->getNormalStrider(normal_strider); + mVertexBuffer->getTexCoord0Strider(tc_strider); mVertexBuffer->getIndexStrider(index_strider); // build vertices and normals @@ -806,7 +813,8 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) pos = (LLVector3*) vf.mPositions; pos.setStride(16); LLStrider norm; norm = (LLVector3*) vf.mNormals; norm.setStride(16); - + LLStrider tc; + tc = (LLVector2*) vf.mTexCoords; tc.setStride(8); for (U32 i = 0; i < num_vertices; i++) { @@ -814,6 +822,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) LLVector3 normal = *norm++; normal.normalize(); *(normal_strider++) = normal; + *(tc_strider++) = *tc++; } // build indices @@ -846,8 +855,13 @@ BOOL LLImagePreviewSculpted::render() gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); - gl_rect_2d_simple( mFullWidth, mFullHeight ); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gl_rect_2d_simple( mFullWidth, mFullHeight ); + glMatrixMode(GL_PROJECTION); gGL.popMatrix(); @@ -876,17 +890,28 @@ BOOL LLImagePreviewSculpted::render() const LLVolumeFace &vf = mVolume->getVolumeFace(0); U32 num_indices = vf.mNumIndices; - mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL); - gPipeline.enableLightsAvatar(); + + if (LLGLSLShader::sNoFixedFunction) + { + gObjectPreviewProgram.bind(); + } gGL.pushMatrix(); const F32 SCALE = 1.25f; gGL.scalef(SCALE, SCALE, SCALE); const F32 BRIGHTNESS = 0.9f; gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); + + mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0); mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0); gGL.popMatrix(); + + if (LLGLSLShader::sNoFixedFunction) + { + gObjectPreviewProgram.unbind(); + } + return TRUE; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 3d371f7a44..ed124cfecf 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2436,8 +2436,7 @@ void pushVerts(LLVolume* volume) for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); - glVertexPointer(3, GL_FLOAT, 16, face.mPositions); - glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); } } @@ -3178,13 +3177,13 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVertexBuffer::unbind(); llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0); - - glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); + + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); gGL.diffuseColor4fv(color.mV); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); + } else { @@ -4115,6 +4114,11 @@ void LLSpatialPartition::renderDebug() return; } + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) { //sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds); @@ -4143,6 +4147,11 @@ void LLSpatialPartition::renderDebug() LLOctreeRenderNonOccluded render_debug(camera); render_debug.traverse(mOctree); + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } } void LLSpatialGroup::drawObjectBox(LLColor4 col) diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 964b17d3a6..eeb90a2b19 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -178,6 +178,11 @@ BOOL LLVisualParamHint::render() gGL.pushMatrix(); glLoadIdentity(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + LLGLSUIDefault gls_ui; //LLGLState::verify(TRUE); mBackgroundp->draw(0, 0, mFullWidth, mFullHeight); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ab193c7d85..de9d853c7c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -65,11 +65,13 @@ LLVector4 gShinyOrigin; LLGLSLShader gOcclusionProgram; LLGLSLShader gCustomAlphaProgram; LLGLSLShader gGlowCombineProgram; +LLGLSLShader gGlowCombineFXAAProgram; LLGLSLShader gTwoTextureAddProgram; LLGLSLShader gOneTextureNoColorProgram; //object shaders LLGLSLShader gObjectSimpleProgram; +LLGLSLShader gObjectPreviewProgram; LLGLSLShader gObjectSimpleWaterProgram; LLGLSLShader gObjectSimpleAlphaMaskProgram; LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; @@ -200,6 +202,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gWaterProgram); mShaderList.push_back(&gAvatarEyeballProgram); mShaderList.push_back(&gObjectSimpleProgram); + mShaderList.push_back(&gObjectPreviewProgram); mShaderList.push_back(&gImpostorProgram); mShaderList.push_back(&gObjectFullbrightNoColorProgram); mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram); @@ -208,6 +211,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gUIProgram); mShaderList.push_back(&gCustomAlphaProgram); mShaderList.push_back(&gGlowCombineProgram); + mShaderList.push_back(&gGlowCombineFXAAProgram); mShaderList.push_back(&gTwoTextureAddProgram); mShaderList.push_back(&gOneTextureNoColorProgram); mShaderList.push_back(&gSolidColorProgram); @@ -669,6 +673,7 @@ void LLViewerShaderMgr::unloadShaders() gUIProgram.unload(); gCustomAlphaProgram.unload(); gGlowCombineProgram.unload(); + gGlowCombineFXAAProgram.unload(); gTwoTextureAddProgram.unload(); gOneTextureNoColorProgram.unload(); gSolidColorProgram.unload(); @@ -676,6 +681,7 @@ void LLViewerShaderMgr::unloadShaders() gObjectFullbrightNoColorProgram.unload(); gObjectFullbrightNoColorWaterProgram.unload(); gObjectSimpleProgram.unload(); + gObjectPreviewProgram.unload(); gImpostorProgram.unload(); gObjectSimpleAlphaMaskProgram.unload(); gObjectBumpProgram.unload(); @@ -1767,6 +1773,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gObjectFullbrightNoColorProgram.unload(); gObjectFullbrightNoColorWaterProgram.unload(); gObjectSimpleProgram.unload(); + gObjectPreviewProgram.unload(); gImpostorProgram.unload(); gObjectSimpleAlphaMaskProgram.unload(); gObjectBumpProgram.unload(); @@ -2117,6 +2124,23 @@ BOOL LLViewerShaderMgr::loadShadersObject() success = gImpostorProgram.createShader(NULL, NULL); } + if (success) + { + gObjectPreviewProgram.mName = "Simple Shader"; + gObjectPreviewProgram.mFeatures.calculatesLighting = true; + gObjectPreviewProgram.mFeatures.calculatesAtmospherics = true; + gObjectPreviewProgram.mFeatures.hasGamma = true; + gObjectPreviewProgram.mFeatures.hasAtmospherics = true; + gObjectPreviewProgram.mFeatures.hasLighting = true; + gObjectPreviewProgram.mFeatures.mIndexedTextureChannels = 0; + gObjectPreviewProgram.mFeatures.disableTextureIndex = true; + gObjectPreviewProgram.mShaderFiles.clear(); + gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER_ARB)); + gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB)); + gObjectPreviewProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gObjectPreviewProgram.createShader(NULL, NULL); + } + if (success) { gObjectSimpleProgram.mName = "Simple Shader"; @@ -2706,6 +2730,24 @@ BOOL LLViewerShaderMgr::loadShadersInterface() } } + if (success) + { + gGlowCombineFXAAProgram.mName = "Glow CombineFXAA Shader"; + gGlowCombineFXAAProgram.mShaderFiles.clear(); + gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER_ARB)); + gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER_ARB)); + gGlowCombineFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gGlowCombineFXAAProgram.createShader(NULL, NULL); + if (success) + { + gGlowCombineFXAAProgram.bind(); + gGlowCombineFXAAProgram.uniform1i("glowMap", 0); + gGlowCombineFXAAProgram.uniform1i("screenMap", 1); + gGlowCombineFXAAProgram.unbind(); + } + } + + if (success) { gTwoTextureAddProgram.mName = "Two Texture Add Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 270c05b669..c63260fb2e 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -273,6 +273,7 @@ extern LLVector4 gShinyOrigin; extern LLGLSLShader gOcclusionProgram; extern LLGLSLShader gCustomAlphaProgram; extern LLGLSLShader gGlowCombineProgram; +extern LLGLSLShader gGlowCombineFXAAProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; @@ -281,6 +282,7 @@ extern LLGLSLShader gOneTextureNoColorProgram; //object shaders extern LLGLSLShader gObjectSimpleProgram; +extern LLGLSLShader gObjectPreviewProgram; extern LLGLSLShader gObjectSimpleAlphaMaskProgram; extern LLGLSLShader gObjectSimpleWaterProgram; extern LLGLSLShader gObjectSimpleWaterAlphaMaskProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f6d021fda8..7feb429911 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -673,6 +673,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (!addDeferredAttachments(mDeferredScreen)) return false; if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; + if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false; #if LL_DARWIN // As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO @@ -782,6 +783,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { mShadow[i].release(); } + mFXAABuffer.release(); mScreen.release(); mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first mDeferredDepth.release(); @@ -867,6 +869,7 @@ void LLPipeline::releaseScreenBuffers() { mUIScreen.release(); mScreen.release(); + mFXAABuffer.release(); mPhysicsDisplay.release(); mDeferredScreen.release(); mDeferredDepth.release(); @@ -4231,6 +4234,11 @@ void LLPipeline::renderDebug() } } + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) { LLVertexBuffer::unbind(); @@ -4455,6 +4463,10 @@ void LLPipeline::renderDebug() } gGL.flush(); + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } gPipeline.renderPhysicsDisplay(); } @@ -6300,7 +6312,31 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (LLPipeline::sRenderDeferred) { bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater(); + { + //bake out texture2D with RGBL for FXAA shader + mFXAABuffer.bindTarget(); + + S32 width = mScreen.getWidth(); + S32 height = mScreen.getHeight(); + glViewport(0, 0, width, height); + + gGlowCombineFXAAProgram.bind(); + gGlowCombineFXAAProgram.uniform2f("screen_res", width, height); + + gGL.getTexUnit(0)->bind(&mGlow[1]); + gGL.getTexUnit(1)->bind(&mScreen); + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex2f(-1,-1); + gGL.vertex2f(-1,3); + gGL.vertex2f(3,-1); + gGL.end(); + + gGlowCombineFXAAProgram.unbind(); + mFXAABuffer.flush(); + gViewerWindow->setup3DViewport(); + } + LLGLSLShader* shader = &gDeferredPostProgram; if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2) { @@ -6317,6 +6353,16 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) LLGLDisable blend(GL_BLEND); bindDeferredShader(*shader); + S32 width = mScreen.getWidth(); + S32 height = mScreen.getHeight(); + + F32 scale_x = (F32) width/mFXAABuffer.getWidth(); + F32 scale_y = (F32) height/mFXAABuffer.getHeight(); + shader->uniform2f("tc_scale", scale_x, scale_y); + shader->uniform2f("rcp_screen_res", 1.f/width*scale_x, 1.f/height*scale_y); + shader->uniform4f("rcp_frame_opt", -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y); + shader->uniform4f("rcp_frame_opt2", -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y); + if (dof_enabled) { //depth of field focal plane calculations @@ -6429,17 +6475,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f("magnification", magnification); } - S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); + S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); if (channel > -1) { - mScreen.bindTexture(0, channel); + mFXAABuffer.bindTexture(0, channel); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } - //channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); - //if (channel > -1) - //{ - //gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - //} - + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 61ab84588d..159ec612d3 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -527,6 +527,7 @@ public: LLRenderTarget mScreen; LLRenderTarget mUIScreen; LLRenderTarget mDeferredScreen; + LLRenderTarget mFXAABuffer; LLRenderTarget mEdgeMap; LLRenderTarget mDeferredDepth; LLRenderTarget mDeferredLight[3]; diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index a8b3ce9c28..b93e70c8c5 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -137,34 +137,36 @@ Thank you to the following Residents for helping to ensure that this is the best top="5" width="435" word_wrap="true"> -3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion -APR Copyright (C) 2000-2004 The Apache Software Foundation -Collada DOM Copyright 2005 Sony Computer Entertainment Inc. -cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se) -DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc. -expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd. -FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org). -GL Copyright (C) 1999-2004 Brian Paul. -GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia. -google-perftools Copyright (c) 2005, Google Inc. -Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited. -jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW) -jpeglib Copyright (C) 1991-1998, Thomas G. Lane. -ogg/vorbis Copyright (C) 2001, Xiphophorus -OpenSSL Copyright (C) 1998-2002 The OpenSSL Project. -PCRE Copyright (c) 1997-2008 University of Cambridge -SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga -SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) -xmlrpc-epi Copyright (C) 2000 Epinions, Inc. -zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler. -google-perftools Copyright (c) 2005, Google Inc. + 3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion + APR Copyright (C) 2000-2004 The Apache Software Foundation + Collada DOM Copyright 2005 Sony Computer Entertainment Inc. + cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se) + DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc. + expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd. + FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org). + GL Copyright (C) 1999-2004 Brian Paul. + GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia. + google-perftools Copyright (c) 2005, Google Inc. + Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited. + jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW) + jpeglib Copyright (C) 1991-1998, Thomas G. Lane. + ogg/vorbis Copyright (C) 2001, Xiphophorus + OpenSSL Copyright (C) 1998-2002 The OpenSSL Project. + PCRE Copyright (c) 1997-2008 University of Cambridge + SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + xmlrpc-epi Copyright (C) 2000 Epinions, Inc. + zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler. + google-perftools Copyright (c) 2005, Google Inc. -Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details. + Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details. -All rights reserved. See licenses.txt for details. + This software contains source code provided by NVIDIA Corporation. -Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C) - + All rights reserved. See licenses.txt for details. + + Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C) + -- cgit v1.2.3 From a44fb94af2974fce07575f30f5dcaff9729d9ba9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Aug 2011 17:41:54 -0400 Subject: CHOP-763: Reduce redundancy in LLView::childrenHandle*() methods. There were 13 different methods that were more or less clones of each other. Consolidate those down to 5 variations on the basic method body, where each variation has good (commented!) reason to differ. Use helper methods to further simplify the remaining distinct method bodies. Use BOOST_FOREACH() to improve readability of iterating over mChildList. --- indra/llui/llview.cpp | 496 ++++++++++++-------------------------------------- indra/llui/llview.h | 17 ++ 2 files changed, 129 insertions(+), 384 deletions(-) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 8803d106ba..f41e43c0cf 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -32,6 +32,7 @@ #include #include +#include #include "llrender.h" #include "llevent.h" @@ -346,13 +347,11 @@ void LLView::removeChild(LLView* child) LLView::ctrl_list_t LLView::getCtrlList() const { ctrl_list_t controls; - for(child_list_const_iter_t iter = mChildList.begin(); - iter != mChildList.end(); - iter++) + BOOST_FOREACH(LLView* viewp, mChildList) { - if((*iter)->isCtrl()) + if(viewp->isCtrl()) { - controls.push_back(static_cast(*iter)); + controls.push_back(static_cast(viewp)); } } return controls; @@ -574,9 +573,8 @@ void LLView::deleteAllChildren() void LLView::setAllChildrenEnabled(BOOL b) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; viewp->setEnabled(b); } } @@ -602,9 +600,8 @@ void LLView::setVisible(BOOL visible) // virtual void LLView::handleVisibilityChange ( BOOL new_visibility ) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; // only views that are themselves visible will have their overall visibility affected by their ancestors if (viewp->getVisible()) { @@ -646,39 +643,71 @@ void LLView::onMouseLeave(S32 x, S32 y, MASK mask) //llinfos << "Mouse left " << getName() << llendl; } +bool LLView::visibleAndContains(S32 local_x, S32 local_y) +{ + return pointInView(local_x, local_y) + && getVisible(); +} -LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) +bool LLView::visibleEnabledAndContains(S32 local_x, S32 local_y) +{ + return visibleAndContains(local_x, local_y) + && getEnabled(); +} + +void LLView::logMouseEvent() +{ + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("/") + mName + sMouseHandlerMessage; + } +} + +// XDATA might be MASK, or S32 clicks +template +LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra) { - LLView* handled_view = NULL; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; - if(!viewp->pointInView(local_x, local_y) - || !viewp->getVisible()) + + if (!viewp->visibleEnabledAndContains(local_x, local_y)) { continue; } - if (viewp->handleToolTip(local_x, local_y, mask) ) + if ((viewp->*method)( local_x, local_y, extra ) + || viewp->blockMouseEvent( local_x, local_y )) { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } + viewp->logMouseEvent(); + return viewp; + } + } + return NULL; +} - handled_view = viewp; - break; +LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) +{ + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + // Differs from childrenHandleMouseEvent() in that we want to offer + // tooltips even for disabled widgets. + if(!viewp->visibleAndContains(local_x, local_y)) + { + continue; } - if (viewp->blockMouseEvent(local_x, local_y)) + if (viewp->handleToolTip(local_x, local_y, mask) + || viewp->blockMouseEvent(local_x, local_y)) { - handled_view = viewp; - break; + viewp->logMouseEvent(); + return viewp; } } - return handled_view; + return NULL; } @@ -686,13 +715,11 @@ LLView* LLView::childFromPoint(S32 x, S32 y) { if (!getVisible() ) return false; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() ) + if (!viewp->visibleAndContains(local_x, local_y)) { continue; } @@ -822,36 +849,31 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, EAcceptance* accept, std::string& tooltip_msg) { - LLView* handled_view = NULL; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + // default to not accepting drag and drop, will be overridden by handler + *accept = ACCEPT_NO; + + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; - if( !viewp->pointInView(local_x, local_y) || - !viewp->getVisible() || - !viewp->getEnabled()) + if( !viewp->visibleEnabledAndContains(local_x, local_y)) { continue; } + + // Differs from childrenHandleMouseEvent() simply in that this virtual + // method call diverges pretty radically from the usual (x, y, int). if (viewp->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, - tooltip_msg)) + tooltip_msg) + || viewp->blockMouseEvent(local_x, local_y)) { - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(x, y)) - { - *accept = ACCEPT_NO; - handled_view = viewp; - break; + return viewp; } } - return handled_view; + return NULL; } void LLView::onMouseCaptureLost() @@ -906,388 +928,100 @@ BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { - LLView* handled_view = NULL; - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleScrollWheel( local_x, local_y, clicks )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleScrollWheel, x, y, clicks); } LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if (getVisible() && getEnabled() ) + BOOST_FOREACH(LLView* viewp, mChildList) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if(!viewp->visibleEnabledAndContains(local_x, local_y)) { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if(!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleHover(local_x, local_y, mask) ) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } + continue; + } - if (viewp->blockMouseEvent(local_x, local_y)) - { - LLUI::sWindow->setCursor(viewp->getHoverCursor()); + // This call differentiates this method from childrenHandleMouseEvent(). + LLUI::sWindow->setCursor(viewp->getHoverCursor()); - handled_view = viewp; - break; - } + if (viewp->handleHover(local_x, local_y, mask) + || viewp->blockMouseEvent(local_x, local_y)) + { + viewp->logMouseEvent(); + return viewp; } } - return handled_view; + return NULL; } -// Called during downward traversal -LLView* LLView::childrenHandleKey(KEY key, MASK mask) +template +LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask) { - LLView* handled_view = NULL; - if ( getVisible() && getEnabled() ) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; - if (viewp->handleKey(key, mask, TRUE)) + if ((viewp->*method)(c, mask, TRUE)) { if (LLView::sDebugKeys) { - llinfos << "Key handled by " << viewp->getName() << llendl; + llinfos << desc << " handled by " << viewp->getName() << llendl; } - handled_view = viewp; - break; + return viewp; } } } + return NULL; +} - return handled_view; +// Called during downward traversal +LLView* LLView::childrenHandleKey(KEY key, MASK mask) +{ + return childrenHandleCharEvent("Key", &LLView::handleKey, key, mask); } // Called during downward traversal LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char) { - LLView* handled_view = NULL; - - if ( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - if (viewp->handleUnicodeChar(uni_char, TRUE)) - { - if (LLView::sDebugKeys) - { - llinfos << "Unicode character handled by " << viewp->getName() << llendl; - } - handled_view = viewp; - break; - } - } - } - - return handled_view; + return childrenHandleCharEvent("Unicode character", &LLView::handleUnicodeCharWithDummyMask, + uni_char, MASK_NONE); } LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if(viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMouseDown, x, y, mask); } LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleRightMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleRightMouseDown, x, y, mask); } LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMiddleMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMiddleMouseDown, x, y, mask); } LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleDoubleClick( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleDoubleClick, x, y, mask); } LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMouseUp, x, y, mask); } LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled() ) - { - continue; - } - - if(viewp->handleRightMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if(viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleRightMouseUp, x, y, mask); } LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMiddleMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMiddleMouseUp, x, y, mask); } void LLView::draw() @@ -1460,9 +1194,8 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) mRect.mTop = getRect().mBottom + height; // move child views according to reshape flags - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; LLRect child_rect( viewp->mRect ); if (viewp->followsRight() && viewp->followsLeft()) @@ -1525,10 +1258,8 @@ LLRect LLView::calcBoundingRect() { LLRect local_bounding_rect = LLRect::null; - child_list_const_iter_t child_it; - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; // ignore invisible and "top" children when calculating bounding rect // such as combobox popups if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl()) @@ -1689,11 +1420,9 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const //richard: should we allow empty names? //if(name.empty()) // return NULL; - child_list_const_iter_t child_it; // Look for direct children *first* - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; llassert(childp); if (childp->getName() == name) { @@ -1703,9 +1432,8 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const if (recurse) { // Look inside each child as well. - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; llassert(childp); LLView* viewp = childp->findChildView(name, recurse); if ( viewp ) @@ -2811,9 +2539,9 @@ S32 LLView::notifyParent(const LLSD& info) bool LLView::notifyChildren(const LLSD& info) { bool ret = false; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - ret |= (*child_it)->notifyChildren(info); + ret = ret || childp->notifyChildren(info); } return ret; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 594a5eec6b..daea46d330 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -516,6 +516,9 @@ protected: void drawDebugRect(); void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE); void drawChildren(); + bool visibleAndContains(S32 local_x, S32 local_Y); + bool visibleEnabledAndContains(S32 local_x, S32 local_y); + void logMouseEvent(); LLView* childrenHandleKey(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); @@ -541,6 +544,20 @@ protected: private: + template + LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra); + + template + LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask); + + // adapter to blur distinction between handleKey() and handleUnicodeChar() + // for childrenHandleCharEvent() + BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent) + { + return handleUnicodeChar(uni_char, from_parent); + } + LLView* mParentView; child_list_t mChildList; -- cgit v1.2.3 From a548fd52e3c938614f213ae7f2b1aa9cbf05b23f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Aug 2011 17:54:27 -0400 Subject: CHOP-763: Collect nontrivial LLView::childrenHandle*() methods. There are 5 remaining childrenHandleSomething() methods with nontrivial bodies -- the rest all forward to one of those 5. Move them all to be physically adjacent in the source file to make it easy to compare/maintain. --- indra/llui/llview.cpp | 158 +++++++++++++++++++++++++------------------------- 1 file changed, 78 insertions(+), 80 deletions(-) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f41e43c0cf..6d0bd4d520 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -663,6 +663,27 @@ void LLView::logMouseEvent() } } +template +LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask) +{ + if ( getVisible() && getEnabled() ) + { + BOOST_FOREACH(LLView* viewp, mChildList) + { + if ((viewp->*method)(c, mask, TRUE)) + { + if (LLView::sDebugKeys) + { + llinfos << desc << " handled by " << viewp->getName() << llendl; + } + return viewp; + } + } + } + return NULL; +} + // XDATA might be MASK, or S32 clicks template LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra) @@ -710,6 +731,63 @@ LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) return NULL; } +LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + // default to not accepting drag and drop, will be overridden by handler + *accept = ACCEPT_NO; + + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if( !viewp->visibleEnabledAndContains(local_x, local_y)) + { + continue; + } + + // Differs from childrenHandleMouseEvent() simply in that this virtual + // method call diverges pretty radically from the usual (x, y, int). + if (viewp->handleDragAndDrop(local_x, local_y, mask, drop, + cargo_type, + cargo_data, + accept, + tooltip_msg) + || viewp->blockMouseEvent(local_x, local_y)) + { + return viewp; + } + } + return NULL; +} + +LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) +{ + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if(!viewp->visibleEnabledAndContains(local_x, local_y)) + { + continue; + } + + // This call differentiates this method from childrenHandleMouseEvent(). + LLUI::sWindow->setCursor(viewp->getHoverCursor()); + + if (viewp->handleHover(local_x, local_y, mask) + || viewp->blockMouseEvent(local_x, local_y)) + { + viewp->logMouseEvent(); + return viewp; + } + } + return NULL; +} LLView* LLView::childFromPoint(S32 x, S32 y) { @@ -842,40 +920,6 @@ BOOL LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return childrenHandleDragAndDrop( x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; } -LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - // default to not accepting drag and drop, will be overridden by handler - *accept = ACCEPT_NO; - - BOOST_FOREACH(LLView* viewp, mChildList) - { - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if( !viewp->visibleEnabledAndContains(local_x, local_y)) - { - continue; - } - - // Differs from childrenHandleMouseEvent() simply in that this virtual - // method call diverges pretty radically from the usual (x, y, int). - if (viewp->handleDragAndDrop(local_x, local_y, mask, drop, - cargo_type, - cargo_data, - accept, - tooltip_msg) - || viewp->blockMouseEvent(local_x, local_y)) - { - return viewp; - } - } - return NULL; -} - void LLView::onMouseCaptureLost() { } @@ -925,57 +969,11 @@ BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) return childrenHandleMiddleMouseUp( x, y, mask ) != NULL; } - LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { return childrenHandleMouseEvent(&LLView::handleScrollWheel, x, y, clicks); } -LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) -{ - BOOST_FOREACH(LLView* viewp, mChildList) - { - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if(!viewp->visibleEnabledAndContains(local_x, local_y)) - { - continue; - } - - // This call differentiates this method from childrenHandleMouseEvent(). - LLUI::sWindow->setCursor(viewp->getHoverCursor()); - - if (viewp->handleHover(local_x, local_y, mask) - || viewp->blockMouseEvent(local_x, local_y)) - { - viewp->logMouseEvent(); - return viewp; - } - } - return NULL; -} - -template -LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method, - CHARTYPE c, MASK mask) -{ - if ( getVisible() && getEnabled() ) - { - BOOST_FOREACH(LLView* viewp, mChildList) - { - if ((viewp->*method)(c, mask, TRUE)) - { - if (LLView::sDebugKeys) - { - llinfos << desc << " handled by " << viewp->getName() << llendl; - } - return viewp; - } - } - } - return NULL; -} - // Called during downward traversal LLView* LLView::childrenHandleKey(KEY key, MASK mask) { -- cgit v1.2.3 From ee4fdd2c18c722164d78a7305777fad6e49cba8b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sun, 21 Aug 2011 16:23:04 -0500 Subject: SH-2242 Work in progress on FXAA/glVertexAttrib -- DoF works, physics shape display still doesn't. --- indra/llrender/llrender.cpp | 20 +- .../shaders/class1/deferred/postDeferredF.glsl | 2099 +++++++++++++++++++- .../shaders/class1/interface/debugF.glsl | 31 + .../shaders/class1/interface/debugV.glsl | 32 + .../class1/interface/splattexturerectF.glsl | 33 + .../class1/interface/splattexturerectV.glsl | 36 + indra/newview/llspatialpartition.cpp | 6 +- indra/newview/llviewershadermgr.cpp | 31 + indra/newview/llviewershadermgr.h | 2 + indra/newview/pipeline.cpp | 34 +- 10 files changed, 2286 insertions(+), 38 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/interface/debugF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/debugV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index da85bc202c..03a45c35dc 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1586,12 +1586,12 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) S32 loc = -1; if (shader) { - loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + loc = shader->getUniformLocation("color"); } if (loc >= 0) { - glVertexAttrib3fARB(loc, r,g,b); + shader->uniform4f(loc, r,g,b,1.f); } else { @@ -1605,12 +1605,12 @@ void LLRender::diffuseColor3fv(const F32* c) S32 loc = -1; if (shader) { - loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + loc = shader->getUniformLocation("color"); } if (loc >= 0) { - glVertexAttrib3fvARB(loc, c); + shader->uniform4f(loc, c[0], c[1], c[2], 1.f); } else { @@ -1624,12 +1624,12 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) S32 loc = -1; if (shader) { - loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + loc = shader->getUniformLocation("color"); } if (loc >= 0) { - glVertexAttrib4fARB(loc, r,g,b,a); + shader->uniform4f(loc, r,g,b,a); } else { @@ -1644,12 +1644,12 @@ void LLRender::diffuseColor4fv(const F32* c) S32 loc = -1; if (shader) { - loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + loc = shader->getUniformLocation("color"); } if (loc >= 0) { - glVertexAttrib4fvARB(loc, c); + shader->uniform4fv(loc, 1, c); } else { @@ -1663,12 +1663,12 @@ void LLRender::diffuseColor4ubv(const U8* c) S32 loc = -1; if (shader) { - loc = shader->getAttribLocation(LLVertexBuffer::TYPE_COLOR); + loc = shader->getUniformLocation("color"); } if (loc >= 0) { - glVertexAttrib4ubvARB(loc, c); + shader->uniform4f(loc, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); } else { diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 29f5f899ba..cfcd8585f1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -22,16 +22,2070 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + +#extension GL_ARB_texture_rectangle : enable + +#define FXAA_PC 1 +#define FXAA_GLSL_130 1 +#define FXAA_QUALITY__PRESET 12 + +/*============================================================================ + + + NVIDIA FXAA 3.11 by TIMOTHY LOTTES + + +------------------------------------------------------------------------------ +COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. +------------------------------------------------------------------------------ +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED +*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR +CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR +LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, +OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE +THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +------------------------------------------------------------------------------ + INTEGRATION CHECKLIST +------------------------------------------------------------------------------ +(1.) +In the shader source, setup defines for the desired configuration. +When providing multiple shaders (for different presets), +simply setup the defines differently in multiple files. +Example, + + #define FXAA_PC 1 + #define FXAA_HLSL_5 1 + #define FXAA_QUALITY__PRESET 12 + +Or, + + #define FXAA_360 1 + +Or, + + #define FXAA_PS3 1 + +Etc. + +(2.) +Then include this file, + + #include "Fxaa3_11.h" + +(3.) +Then call the FXAA pixel shader from within your desired shader. +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. +As for FXAA 3.11 all inputs for all shaders are the same +to enable easy porting between platforms. + + return FxaaPixelShader(...); + +(4.) +Insure pass prior to FXAA outputs RGBL (see next section). +Or use, + + #define FXAA_GREEN_AS_LUMA 1 + +(5.) +Setup engine to provide the following constants +which are used in the FxaaPixelShader() inputs, + + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir + +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. + +(6.) +Have FXAA vertex shader run as a full screen triangle, +and output "pos" and "fxaaConsolePosPos" +such that inputs in the pixel shader provide, + + // {xy} = center of pixel + FxaaFloat2 pos, + + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + +(7.) +Insure the texture sampler(s) used by FXAA are set to bilinear filtering. + + +------------------------------------------------------------------------------ + INTEGRATION - RGBL AND COLORSPACE +------------------------------------------------------------------------------ +FXAA3 requires RGBL as input unless the following is set, + + #define FXAA_GREEN_AS_LUMA 1 + +In which case the engine uses green in place of luma, +and requires RGB input is in a non-linear colorspace. + +RGB should be LDR (low dynamic range). +Specifically do FXAA after tonemapping. + +RGB data as returned by a texture fetch can be non-linear, +or linear when FXAA_GREEN_AS_LUMA is not set. +Note an "sRGB format" texture counts as linear, +because the result of a texture fetch is linear data. +Regular "RGBA8" textures in the sRGB colorspace are non-linear. + +If FXAA_GREEN_AS_LUMA is not set, +luma must be stored in the alpha channel prior to running FXAA. +This luma should be in a perceptual space (could be gamma 2.0). +Example pass before FXAA where output is gamma 2.0 encoded, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma + return color; + +Another example where output is linear encoded, +say for instance writing to an sRGB formated render target, +where the render target does the conversion back to sRGB after blending, + + color.rgb = ToneMap(color.rgb); // linear color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma + return color; + +Getting luma correct is required for the algorithm to work correctly. + + +------------------------------------------------------------------------------ + BEING LINEARLY CORRECT? +------------------------------------------------------------------------------ +Applying FXAA to a framebuffer with linear RGB color will look worse. +This is very counter intuitive, but happends to be true in this case. +The reason is because dithering artifacts will be more visiable +in a linear colorspace. + + +------------------------------------------------------------------------------ + COMPLEX INTEGRATION +------------------------------------------------------------------------------ +Q. What if the engine is blending into RGB before wanting to run FXAA? + +A. In the last opaque pass prior to FXAA, + have the pass write out luma into alpha. + Then blend into RGB only. + FXAA should be able to run ok + assuming the blending pass did not any add aliasing. + This should be the common case for particles and common blending passes. + +A. Or use FXAA_GREEN_AS_LUMA. + +============================================================================*/ + +/*============================================================================ + + INTEGRATION KNOBS + +============================================================================*/ +// +// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE). +// FXAA_360_OPT is a prototype for the new optimized 360 version. +// +// 1 = Use API. +// 0 = Don't use API. +// +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PS3 + #define FXAA_PS3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360 + #define FXAA_360 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360_OPT + #define FXAA_360_OPT 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_PC + // + // FXAA Quality + // The high quality PC algorithm. + // + #define FXAA_PC 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PC_CONSOLE + // + // The console algorithm for PC is included + // for developers targeting really low spec machines. + // Likely better to just run FXAA_PC, and use a really low preset. + // + #define FXAA_PC_CONSOLE 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_120 + #define FXAA_GLSL_120 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_130 + #define FXAA_GLSL_130 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_3 + #define FXAA_HLSL_3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_4 + #define FXAA_HLSL_4 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_5 + #define FXAA_HLSL_5 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_GREEN_AS_LUMA + // + // For those using non-linear color, + // and either not able to get luma in alpha, or not wanting to, + // this enables FXAA to run using green as a proxy for luma. + // So with this enabled, no need to pack luma in alpha. + // + // This will turn off AA on anything which lacks some amount of green. + // Pure red and blue or combination of only R and B, will get no AA. + // + // Might want to lower the settings for both, + // fxaaConsoleEdgeThresholdMin + // fxaaQualityEdgeThresholdMin + // In order to insure AA does not get turned off on colors + // which contain a minor amount of green. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_GREEN_AS_LUMA 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_EARLY_EXIT + // + // Controls algorithm's early exit path. + // On PS3 turning this ON adds 2 cycles to the shader. + // On 360 turning this OFF adds 10ths of a millisecond to the shader. + // Turning this off on console will result in a more blurry image. + // So this defaults to on. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_EARLY_EXIT 1 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_DISCARD + // + // Only valid for PC OpenGL currently. + // Probably will not work when FXAA_GREEN_AS_LUMA = 1. + // + // 1 = Use discard on pixels which don't need AA. + // For APIs which enable concurrent TEX+ROP from same surface. + // 0 = Return unchanged color on pixels which don't need AA. + // + #define FXAA_DISCARD 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_FAST_PIXEL_OFFSET + // + // Used for GLSL 120 only. + // + // 1 = GL API supports fast pixel offsets + // 0 = do not use fast pixel offsets + // + #ifdef GL_EXT_gpu_shader4 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifndef FXAA_FAST_PIXEL_OFFSET + #define FXAA_FAST_PIXEL_OFFSET 0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GATHER4_ALPHA + // + // 1 = API supports gather4 on alpha channel. + // 0 = API does not support gather4 on alpha channel. + // + #if (FXAA_HLSL_5 == 1) + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif +#endif + +/*============================================================================ + FXAA CONSOLE PS3 - TUNING KNOBS +============================================================================*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS + // + // Consoles the sharpness of edges on PS3 only. + // Non-PS3 tuning is done with shader input. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 8.0 is sharper + // 4.0 is softer + // 2.0 is really soft (good for vector graphics inputs) + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD + // + // Only effects PS3. + // Non-PS3 tuning is done with shader input. + // + // The minimum amount of local contrast required to apply algorithm. + // The console setting has a different mapping than the quality setting. + // + // This only applies when FXAA_EARLY_EXIT is 1. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 0.25 and 0.125. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 0.125 leaves less aliasing, but is softer + // 0.25 leaves more aliasing, and is sharper + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125 + #else + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25 + #endif +#endif + +/*============================================================================ + FXAA QUALITY - TUNING KNOBS +------------------------------------------------------------------------------ +NOTE the other tuning knobs are now in the shader function inputs! +============================================================================*/ +#ifndef FXAA_QUALITY__PRESET + // + // Choose the quality preset. + // This needs to be compiled into the shader as it effects code. + // Best option to include multiple presets is to + // in each shader define the preset, then include this file. + // + // OPTIONS + // ----------------------------------------------------------------------- + // 10 to 15 - default medium dither (10=fastest, 15=highest quality) + // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) + // 39 - no dither, very expensive + // + // NOTES + // ----------------------------------------------------------------------- + // 12 = slightly faster then FXAA 3.9 and higher edge quality (default) + // 13 = about same speed as FXAA 3.9 and better than 12 + // 23 = closest to FXAA 3.9 visually and performance wise + // _ = the lowest digit is directly related to performance + // _ = the highest digit is directly related to style + // + #define FXAA_QUALITY__PRESET 12 +#endif + + +/*============================================================================ + + FXAA QUALITY - PRESETS + +============================================================================*/ + +/*============================================================================ + FXAA QUALITY - MEDIUM DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 10) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 3.0 + #define FXAA_QUALITY__P2 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 11) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 3.0 + #define FXAA_QUALITY__P3 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 12) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 4.0 + #define FXAA_QUALITY__P4 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 13) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 4.0 + #define FXAA_QUALITY__P5 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 14) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 4.0 + #define FXAA_QUALITY__P6 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 15) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 12.0 +#endif + +/*============================================================================ + FXAA QUALITY - LOW DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 20) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 2.0 + #define FXAA_QUALITY__P2 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 21) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 22) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 23) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 24) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 3.0 + #define FXAA_QUALITY__P6 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 25) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 26) + #define FXAA_QUALITY__PS 9 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 4.0 + #define FXAA_QUALITY__P8 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 27) + #define FXAA_QUALITY__PS 10 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 4.0 + #define FXAA_QUALITY__P9 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 28) + #define FXAA_QUALITY__PS 11 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 4.0 + #define FXAA_QUALITY__P10 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 29) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + +/*============================================================================ + FXAA QUALITY - EXTREME QUALITY +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 39) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.0 + #define FXAA_QUALITY__P2 1.0 + #define FXAA_QUALITY__P3 1.0 + #define FXAA_QUALITY__P4 1.0 + #define FXAA_QUALITY__P5 1.5 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + + + +/*============================================================================ + + API PORTING + +============================================================================*/ +#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1) + #define FxaaBool bool + #define FxaaDiscard discard + #define FxaaFloat float + #define FxaaFloat2 vec2 + #define FxaaFloat3 vec3 + #define FxaaFloat4 vec4 + #define FxaaHalf float + #define FxaaHalf2 vec2 + #define FxaaHalf3 vec3 + #define FxaaHalf4 vec4 + #define FxaaInt2 ivec2 + #define FxaaSat(x) clamp(x, 0.0, 1.0) + #define FxaaTex sampler2D +#else + #define FxaaBool bool + #define FxaaDiscard clip(-1) + #define FxaaFloat float + #define FxaaFloat2 float2 + #define FxaaFloat3 float3 + #define FxaaFloat4 float4 + #define FxaaHalf half + #define FxaaHalf2 half2 + #define FxaaHalf3 half3 + #define FxaaHalf4 half4 + #define FxaaSat(x) saturate(x) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_120 == 1) + // Requires, + // #version 120 + // And at least, + // #extension GL_EXT_gpu_shader4 : enable + // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9) + #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0) + #if (FXAA_FAST_PIXEL_OFFSET == 1) + #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o) + #else + #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0) + #endif + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_130 == 1) + // Requires "#version 130" or better + #define FxaaTexTop(t, p) textureLod(t, p, 0.0) + #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o) + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1) + #define FxaaInt2 float2 + #define FxaaTex sampler2D + #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0)) + #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0)) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_4 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_5 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) + #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p) + #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o) + #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p) + #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o) +#endif + + +/*============================================================================ + GREEN AS LUMA OPTION SUPPORT FUNCTION +============================================================================*/ +#if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; } +#else + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } +#endif + + + + +/*============================================================================ + + FXAA3 QUALITY - PC + +============================================================================*/ +#if (FXAA_PC == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy} = center of pixel + FxaaFloat2 pos, + // + // Used only for FXAA Console, and not used on the 360 version. + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + // + // Input color texture. + // {rgb_} = color in linear or perceptual color space + // if (FXAA_GREEN_AS_LUMA == 0) + // {___a} = luma in perceptual color space (not linear) + FxaaTex tex, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 2nd sampler. + // This sampler needs to have an exponent bias of -1. + FxaaTex fxaaConsole360TexExpBiasNegOne, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 3nd sampler. + // This sampler needs to have an exponent bias of -2. + FxaaTex fxaaConsole360TexExpBiasNegTwo, + // + // Only used on FXAA Quality. + // This must be from a constant/uniform. + // {x_} = 1.0/screenWidthInPixels + // {_y} = 1.0/screenHeightInPixels + FxaaFloat2 fxaaQualityRcpFrame, + // + // Only used on FXAA Console. + // This must be from a constant/uniform. + // This effects sub-pixel AA quality and inversely sharpness. + // Where N ranges between, + // N = 0.50 (default) + // N = 0.33 (sharper) + // {x___} = -N/screenWidthInPixels + // {_y__} = -N/screenHeightInPixels + // {__z_} = N/screenWidthInPixels + // {___w} = N/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt, + // + // Only used on FXAA Console. + // Not used on 360, but used on PS3 and PC. + // This must be from a constant/uniform. + // {x___} = -2.0/screenWidthInPixels + // {_y__} = -2.0/screenHeightInPixels + // {__z_} = 2.0/screenWidthInPixels + // {___w} = 2.0/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + // + // Only used on FXAA Console. + // Only used on 360 in place of fxaaConsoleRcpFrameOpt2. + // This must be from a constant/uniform. + // {x___} = 8.0/screenWidthInPixels + // {_y__} = 8.0/screenHeightInPixels + // {__z_} = -4.0/screenWidthInPixels + // {___w} = -4.0/screenHeightInPixels + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + FxaaFloat fxaaQualitySubpix, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + FxaaFloat fxaaQualityEdgeThreshold, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaQualityEdgeThresholdMin, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // 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. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + FxaaFloat fxaaConsoleEdgeSharpness, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3. + // Due to the PS3 being ALU bound, + // 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. + // The console setting has a different mapping than the quality setting. + // Other platforms can use other values. + // 0.125 leaves less aliasing, but is softer (default!!!) + // 0.25 leaves more aliasing, and is sharper + FxaaFloat fxaaConsoleEdgeThreshold, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // The console setting has a different mapping than the quality setting. + // This only applies when FXAA_EARLY_EXIT is 1. + // This does not apply to PS3, + // PS3 was simplified to avoid more shader instructions. + // 0.06 - faster but more aliasing in darks + // 0.05 - default + // 0.04 - slower and less aliasing in darks + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaConsoleEdgeThresholdMin, + // + // Extra constants for 360 FXAA Console only. + // Use zeros or anything else for other platforms. + // These must be in physical constant registers and NOT immedates. + // Immedates will result in compiler un-optimizing. + // {xyzw} = float4(1.0, -1.0, 0.25, -0.25) + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posM; + posM.x = pos.x; + posM.y = pos.y; + #if (FXAA_GATHER4_ALPHA == 1) + #if (FXAA_DISCARD == 0) + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + #endif + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1)); + #else + FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1)); + #endif + #if (FXAA_DISCARD == 1) + #define lumaM luma4A.w + #endif + #define lumaE luma4A.z + #define lumaS luma4A.x + #define lumaSE luma4A.y + #define lumaNW luma4B.w + #define lumaN luma4B.z + #define lumaW luma4B.x + #else + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat maxSM = max(lumaS, lumaM); + FxaaFloat minSM = min(lumaS, lumaM); + FxaaFloat maxESM = max(lumaE, maxSM); + FxaaFloat minESM = min(lumaE, minSM); + FxaaFloat maxWN = max(lumaN, lumaW); + FxaaFloat minWN = min(lumaN, lumaW); + FxaaFloat rangeMax = max(maxWN, maxESM); + FxaaFloat rangeMin = min(minWN, minESM); + FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold; + FxaaFloat range = rangeMax - rangeMin; + FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled); + FxaaBool earlyExit = range < rangeMaxClamped; +/*--------------------------------------------------------------------------*/ + if(earlyExit) + #if (FXAA_DISCARD == 1) + FxaaDiscard; + #else + return rgbyM; + #endif +/*--------------------------------------------------------------------------*/ + #if (FXAA_GATHER4_ALPHA == 0) + FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #else + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNS = lumaN + lumaS; + FxaaFloat lumaWE = lumaW + lumaE; + FxaaFloat subpixRcpRange = 1.0/range; + FxaaFloat subpixNSWE = lumaNS + lumaWE; + FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS; + FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNESE = lumaNE + lumaSE; + FxaaFloat lumaNWNE = lumaNW + lumaNE; + FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE; + FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNWSW = lumaNW + lumaSW; + FxaaFloat lumaSWSE = lumaSW + lumaSE; + FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2); + FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2); + FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW; + FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE; + FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4; + FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4; +/*--------------------------------------------------------------------------*/ + FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE; + FxaaFloat lengthSign = fxaaQualityRcpFrame.x; + FxaaBool horzSpan = edgeHorz >= edgeVert; + FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE; +/*--------------------------------------------------------------------------*/ + if(!horzSpan) lumaN = lumaW; + if(!horzSpan) lumaS = lumaE; + if(horzSpan) lengthSign = fxaaQualityRcpFrame.y; + FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM; +/*--------------------------------------------------------------------------*/ + FxaaFloat gradientN = lumaN - lumaM; + FxaaFloat gradientS = lumaS - lumaM; + FxaaFloat lumaNN = lumaN + lumaM; + FxaaFloat lumaSS = lumaS + lumaM; + FxaaBool pairN = abs(gradientN) >= abs(gradientS); + FxaaFloat gradient = max(abs(gradientN), abs(gradientS)); + if(pairN) lengthSign = -lengthSign; + FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange); +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posB; + posB.x = posM.x; + posB.y = posM.y; + FxaaFloat2 offNP; + offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; + offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; + if(!horzSpan) posB.x += lengthSign * 0.5; + if( horzSpan) posB.y += lengthSign * 0.5; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posN; + posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; + posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; + FxaaFloat2 posP; + posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; + posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; + FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; + FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); + FxaaFloat subpixE = subpixC * subpixC; + FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP)); +/*--------------------------------------------------------------------------*/ + if(!pairN) lumaNN = lumaSS; + FxaaFloat gradientScaled = gradient * 1.0/4.0; + FxaaFloat lumaMM = lumaM - lumaNN * 0.5; + FxaaFloat subpixF = subpixD * subpixE; + FxaaBool lumaMLTZero = lumaMM < 0.0; +/*--------------------------------------------------------------------------*/ + lumaEndN -= lumaNN * 0.5; + lumaEndP -= lumaNN * 0.5; + FxaaBool doneN = abs(lumaEndN) >= gradientScaled; + FxaaBool doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; + FxaaBool doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; +/*--------------------------------------------------------------------------*/ + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 3) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 4) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 5) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 6) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 7) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 8) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 9) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 10) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 11) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 12) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } +/*--------------------------------------------------------------------------*/ + FxaaFloat dstN = posM.x - posN.x; + FxaaFloat dstP = posP.x - posM.x; + if(!horzSpan) dstN = posM.y - posN.y; + if(!horzSpan) dstP = posP.y - posM.y; +/*--------------------------------------------------------------------------*/ + FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero; + FxaaFloat spanLength = (dstP + dstN); + FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero; + FxaaFloat spanLengthRcp = 1.0/spanLength; +/*--------------------------------------------------------------------------*/ + FxaaBool directionN = dstN < dstP; + FxaaFloat dst = min(dstN, dstP); + FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP; + FxaaFloat subpixG = subpixF * subpixF; + FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5; + FxaaFloat subpixH = subpixG * fxaaQualitySubpix; +/*--------------------------------------------------------------------------*/ + FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0; + FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH); + if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign; + if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign; + #if (FXAA_DISCARD == 1) + return FxaaTexTop(tex, posM); + #else + return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); + #endif +} +/*==========================================================================*/ +#endif + + + + +/*============================================================================ + + FXAA3 CONSOLE - PC VERSION + +------------------------------------------------------------------------------ +Instead of using this on PC, I'd suggest just using FXAA Quality with + #define FXAA_QUALITY__PRESET 10 +Or + #define FXAA_QUALITY__PRESET 20 +Either are higher qualilty and almost as fast as this on modern PC GPUs. +============================================================================*/ +#if (FXAA_PC_CONSOLE == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy)); + FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw)); + FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy)); + FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw)); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy); + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat lumaM = rgbyM.w; + #else + FxaaFloat lumaM = rgbyM.y; + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw); + lumaNe += 1.0/384.0; + FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe); + FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw); + FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMinM = min(lumaMin, lumaM); + FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled); + FxaaFloat lumaMaxM = max(lumaMax, lumaM); + FxaaFloat dirSwMinusNe = lumaSw - lumaNe; + FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM; + FxaaFloat dirSeMinusNw = lumaSe - lumaNw; + if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir; + dir.x = dirSwMinusNe + dirSeMinusNw; + dir.y = dirSwMinusNe - dirSeMinusNw; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir1 = normalize(dir.xy); + FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw); + FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness; + FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw); + FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyA = rgbyN1 + rgbyP1; + FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25); +/*--------------------------------------------------------------------------*/ + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax); + #else + FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax); + #endif + if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5; + return rgbyB; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - 360 PIXEL SHADER + +------------------------------------------------------------------------------ +This optimized version thanks to suggestions from Andy Luedke. +Should be fully tex bound in all cases. +As of the FXAA 3.11 release, I have still not tested this code, +however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10. +And note this is replacing the old unoptimized version. +If it does not work, please let me know so I can fix it. +============================================================================*/ +#if (FXAA_360 == 1) +/*--------------------------------------------------------------------------*/ +[reduceTempRegUsage(4)] +float4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + float4 lumaNwNeSwSe; + #if (FXAA_GREEN_AS_LUMA == 0) + asm { + tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #else + asm { + tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #endif +/*--------------------------------------------------------------------------*/ + lumaNwNeSwSe.y += 1.0/384.0; + float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y); + float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y); +/*--------------------------------------------------------------------------*/ + float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + float lumaMinM = min(lumaMin, rgbyM.w); + float lumaMaxM = max(lumaMax, rgbyM.w); + #else + float lumaMinM = min(lumaMin, rgbyM.y); + float lumaMaxM = max(lumaMax, rgbyM.y); + #endif + if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM; +/*--------------------------------------------------------------------------*/ + float2 dir; + dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx); + dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy); + dir = normalize(dir); +/*--------------------------------------------------------------------------*/ + float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw; +/*--------------------------------------------------------------------------*/ + float4 dir2; + float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness; + dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5); + dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw; +/*--------------------------------------------------------------------------*/ + float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0)); + float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0)); + float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0)); + float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ + float4 rgbyA = rgbyN1 + rgbyP1; + float4 rgbyB = rgbyN2 + rgbyP2 * 0.5 + rgbyA; +/*--------------------------------------------------------------------------*/ + float4 rgbyR = ((rgbyB.w - lumaMax) > 0.0) ? rgbyA : rgbyB; + rgbyR = ((rgbyB.w - lumaMin) > 0.0) ? rgbyR : rgbyA; + return rgbyR; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT) + +============================================================================== +The code below does not exactly match the assembly. +I have a feeling that 12 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h0.w(TRUE), v5.xwxx, #0 + 6: addh h0.z(TRUE), -h2, h0.w + 7: texpkb h1.w(TRUE), v5, #0 + 9: addh h0.x(TRUE), h0.z, -h1.w + 10: addh h3.w(TRUE), h0.z, h1 + 11: texpkb h2.w(TRUE), v5.zwzz, #0 + 13: addh h0.z(TRUE), h3.w, -h2.w + 14: addh h0.x(TRUE), h2.w, h0 + 15: nrmh h1.xz(TRUE), h0_n + 16: minh_m8 h0.x(TRUE), |h1|, |h1.z| + 17: maxh h4.w(TRUE), h0, h1 + 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n + 19: movr r1.zw(TRUE), v4.xxxy + 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww + 22: minh h5.w(TRUE), h0, h1 + 23: texpkb h0(TRUE), r2.xzxx, #0 + 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1 + 27: maxh h4.x(TRUE), h2.z, h2.w + 28: texpkb h1(TRUE), r0.zwzz, #0 + 30: addh_d2 h1(TRUE), h0, h1 + 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 33: texpkb h0(TRUE), r0, #0 + 35: minh h4.z(TRUE), h2, h2.w + 36: fenct TRUE + 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 39: texpkb h2(TRUE), r1, #0 + 41: addh_d2 h0(TRUE), h0, h2 + 42: maxh h2.w(TRUE), h4, h4.x + 43: minh h2.x(TRUE), h5.w, h4.z + 44: addh_d2 h0(TRUE), h0, h1 + 45: slth h2.x(TRUE), h0.w, h2 + 46: sgth h2.w(TRUE), h0, h2 + 47: movh h0(TRUE), h0 + 48: addx.c0 rc(TRUE), h2, h2.w + 49: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-; + | | | + 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-; + | | | + 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---; + | SCB1 | add | 10: ADDh h3.w, h0.---z, h1; + | | | + 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h2.w---, h0; + | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-; + | | | + 5 | SCT1 | mov | 15: NRMh h1.xz, h0; + | SRB | nrm | 15: NRMh h1.xz, h0; + | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|; + | SCB1 | max | 17: MAXh h4.w, h0, h1; + | | | + 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0; + | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy; + | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-; + | SCB1 | min | 22: MINh h5.w, h0, h1; + | | | + 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---; + | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1; + | | | + 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | SCB0/1 | add | 30: ADDh/2 h1, h0, h1; + | | | + 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--; + | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0; + | SCB1 | min | 35: MINh h4.z, h2, h2.--w-; + | | | + 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--; + | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0; + | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0; + | SCB0/1 | add | 41: ADDh/2 h0, h0, h2; + | | | + 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---; + | SCT1 | max | 42: MAXh h2.w, h4, h4.---x; + | SCB0/1 | add | 44: ADDh/2 h0, h0, h1; + | | | + 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2; + | SCT1 | set | 46: SGTh h2.w, h0, h2; + | SCB0/1 | mul | 47: MOVh h0, h0; + | | | + 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---; + | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1; +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 0% 0% 50% + 6: 100% 0% 75% + 7: 0% 100% 75% + 8: 0% 100% 100% + 9: 0% 100% 25% + 10: 0% 100% 100% + 11: 50% 0% 100% + 12: 50% 0% 100% + 13: 25% 0% 100% +MEAN: 17% 61% 67% -#extension GL_ARB_texture_rectangle : enable +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 0% 100% + 2: 0% 0% 100% 0% 100% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 0% 0% 0% 100% 100% + 6: 100% 100% 0% 100% 100% + 7: 0% 0% 100% 100% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 0% 100% + 10: 0% 0% 100% 100% 100% + 11: 100% 100% 0% 100% 100% + 12: 100% 100% 0% 100% 100% + 13: 100% 0% 0% 100% 100% + +MEAN: 30% 23% 61% 76% 100% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 13 cycles, 3 r regs, 923,076,923 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O3 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 dir; + half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + lumaNe.w += half(1.0/512.0); + dir.x = -lumaNe.w; + dir.z = -lumaNe.w; + #else + lumaNe.y += half(1.0/512.0); + dir.x = -lumaNe.y; + dir.z = -lumaNe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSw.w; + dir.z += lumaSw.w; + #else + dir.x += lumaSw.y; + dir.z += lumaSw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x -= lumaNw.w; + dir.z += lumaNw.w; + #else + dir.x -= lumaNw.y; + dir.z += lumaNw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSe.w; + dir.z -= lumaSe.w; + #else + dir.x += lumaSe.y; + dir.z -= lumaSe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half4 dir1_pos; + dir1_pos.xy = normalize(dir.xyz).xz; + half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (7) + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (8) + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (9) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (11) + // compilier moves these scalar ops up to other cycles + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w)); + half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w)); + #else + half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y)); + half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y)); + #endif + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (12) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif +/*--------------------------------------------------------------------------*/ +// (13) + if(twoTapLt || twoTapGt) rgby2 = rgby1; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT) + +============================================================================== +The code mostly matches the assembly. +I have a feeling that 14 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks). +Will look at fixing this for FXAA 3.12. +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h1.w(TRUE), v5.xwxx, #0 + 6: addh h0.x(TRUE), h1.w, -h2.y + 7: texpkb h2.w(TRUE), v5.zwzz, #0 + 9: minh h4.w(TRUE), h2.y, h2 + 10: maxh h5.x(TRUE), h2.y, h2.w + 11: texpkb h0.w(TRUE), v5, #0 + 13: addh h3.w(TRUE), -h0, h0.x + 14: addh h0.x(TRUE), h0.w, h0 + 15: addh h0.z(TRUE), -h2.w, h0.x + 16: addh h0.x(TRUE), h2.w, h3.w + 17: minh h5.y(TRUE), h0.w, h1.w + 18: nrmh h2.xz(TRUE), h0_n + 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z| + 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w + 21: movr r1.zw(TRUE), v4.xxxy + 22: maxh h2.w(TRUE), h0, h1 + 23: fenct TRUE + 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 26: texpkb h0(TRUE), r0, #0 + 28: maxh h5.x(TRUE), h2.w, h5 + 29: minh h5.w(TRUE), h5.y, h4 + 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 32: texpkb h2(TRUE), r1, #0 + 34: addh_d2 h2(TRUE), h0, h2 + 35: texpkb h1(TRUE), v4, #0 + 37: maxh h5.y(TRUE), h5.x, h1.w + 38: minh h4.w(TRUE), h1, h5 + 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 41: texpkb h0(TRUE), r0, #0 + 43: addh_m8 h5.z(TRUE), h5.y, -h4.w + 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 46: texpkb h3(TRUE), r2, #0 + 48: addh_d2 h0(TRUE), h0, h3 + 49: addh_d2 h3(TRUE), h0, h2 + 50: movh h0(TRUE), h3 + 51: slth h3.x(TRUE), h3.w, h5.w + 52: sgth h3.w(TRUE), h3, h5.x + 53: addx.c0 rc(TRUE), h3.x, h3 + 54: slth.c0 rc(TRUE), h5.z, h5 + 55: movh h0(c0.NE.w), h2 + 56: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--; + | | | + 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---; + | | | + 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---; + | SCB1 | min | 9: MINh h4.w, h2.---y, h2; + | | | + 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h0.w---, h0; + | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x; + | | | + 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---; + | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-; + | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--; + | | | + 6 | SCT1 | mov | 18: NRMh h2.xz, h0; + | SRB | nrm | 18: NRMh h2.xz, h0; + | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|; + | | | + 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--; + | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy; + | SCB1 | max | 22: MAXh h2.w, h0, h1; + | | | + 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0; + | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0; + | SCB0 | max | 28: MAXh h5.x, h2.w---, h5; + | SCB1 | min | 29: MINh h5.w, h5.---y, h4; + | | | + 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0; + | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0; + | SCB0/1 | add | 34: ADDh/2 h2, h0, h2; + | | | + 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--; + | SCB1 | min | 38: MINh h4.w, h1, h5; + | | | + 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--; + | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0; + | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--; + | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-; + | | | + 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0; + | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0; + | SCB0/1 | add | 48: ADDh/2 h0, h0, h3; + | | | + 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2; + | SCB0/1 | mul | 50: MOVh h0, h3; + | | | + 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---; + | SCT1 | set | 52: SGTh h3.w, h3, h5.---x; + | SCB0 | set | 54: SLThc0 rc, h5.z---, h5; + | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3; + | | | + 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2; + | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 50% 0% 25% + 6: 0% 0% 25% + 7: 100% 0% 25% + 8: 0% 100% 50% + 9: 0% 100% 100% + 10: 0% 100% 50% + 11: 0% 100% 75% + 12: 0% 100% 100% + 13: 100% 0% 100% + 14: 50% 0% 50% + 15: 100% 0% 100% + +MEAN: 26% 60% 56% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 100% 0% + 2: 0% 0% 100% 100% 0% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 100% 100% 0% 100% 0% + 6: 0% 0% 0% 0% 100% + 7: 100% 100% 0% 0% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 100% 100% + 10: 0% 0% 100% 100% 100% + 11: 0% 0% 100% 100% 100% + 12: 0% 0% 100% 100% 100% + 13: 100% 100% 0% 100% 100% + 14: 100% 100% 0% 100% 100% + 15: 100% 100% 0% 100% 100% + +MEAN: 33% 33% 60% 86% 80% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 15 cycles, 3 r regs, 800,000,000 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O2 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaNe = rgbyNe.w + half(1.0/512.0); + #else + half lumaNe = rgbyNe.y + half(1.0/512.0); + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaSwNegNe = lumaSw.w - lumaNe; + #else + half lumaSwNegNe = lumaSw.y - lumaNe; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNwSw = max(lumaNw.w, lumaSw.w); + half lumaMinNwSw = min(lumaNw.w, lumaSw.w); + #else + half lumaMaxNwSw = max(lumaNw.y, lumaSw.y); + half lumaMinNwSw = min(lumaNw.y, lumaSw.y); + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half dirZ = lumaNw.w + lumaSwNegNe; + half dirX = -lumaNw.w + lumaSwNegNe; + #else + half dirZ = lumaNw.y + lumaSwNegNe; + half dirX = -lumaNw.y + lumaSwNegNe; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half3 dir; + dir.y = 0.0; + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x = lumaSe.w + dirX; + dir.z = -lumaSe.w + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.w); + #else + dir.x = lumaSe.y + dirX; + dir.z = -lumaSe.y + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir1_pos; + dir1_pos.xy = normalize(dir).xz; + half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (7) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNeSe = max(lumaNe, lumaSe.w); + #else + half lumaMaxNeSe = max(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (8) + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe); + half lumaMin = min(lumaMinNwSw, lumaMinNeSe); +/*--------------------------------------------------------------------------*/ +// (9) + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxM = max(lumaMax, rgbyM.w); + half lumaMinM = min(lumaMin, rgbyM.w); + #else + half lumaMaxM = max(lumaMax, rgbyM.y); + half lumaMinM = min(lumaMin, rgbyM.y); + #endif +/*--------------------------------------------------------------------------*/ +// (11) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD; +/*--------------------------------------------------------------------------*/ +// (12) + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (13) + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (14) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif + bool earlyExit = lumaRangeM < lumaMax; + bool twoTap = twoTapLt || twoTapGt; +/*--------------------------------------------------------------------------*/ +// (15) + if(twoTap) rgby2 = rgby1; + if(earlyExit) rgby2 = rgbyM; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect edgeMap; +uniform sampler2D diffuseMap; uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; -uniform sampler2D bloomMap; + +uniform vec2 tc_scale; +uniform vec2 rcp_screen_res; +uniform vec4 rcp_frame_opt; +uniform vec4 rcp_frame_opt2; +uniform vec2 screen_res; uniform float depth_cutoff; uniform float norm_cutoff; @@ -41,9 +2095,10 @@ uniform float tan_pixel_angle; uniform float magnification; uniform mat4 inv_proj; -uniform vec2 screen_res; varying vec2 vary_fragcoord; +varying vec2 vary_tc; + float getDepth(vec2 pos_screen) { @@ -76,8 +2131,8 @@ void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc) float sc = calc_cof(d); float wg = 0.25; - - vec4 s = texture2DRect(diffuseRect, tc); + + vec4 s = texture2D(diffuseMap, tc*tc_scale/screen_res); // de-weight dull areas to make highlights 'pop' wg += s.r+s.g+s.b; @@ -97,7 +2152,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve { float wg = 0.25; - vec4 s = texture2DRect(diffuseRect, tc); + vec4 s = texture2D(diffuseMap, tc*tc_scale/screen_res); // de-weight dull areas to make highlights 'pop' wg += s.r+s.g+s.b; @@ -107,7 +2162,6 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve } } - void main() { vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; @@ -117,7 +2171,7 @@ void main() float depth = getDepth(tc); - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + vec4 diff = texture2D(diffuseMap, vary_fragcoord.xy*tc_scale/screen_res); { float w = 1.0; @@ -131,6 +2185,7 @@ void main() // sample quite uniformly spaced points within a circle, for a circular 'bokeh' //if (depth < focal_distance) + if (sc > 0.5) { while (sc > 0.5) { @@ -146,10 +2201,30 @@ void main() sc -= 1.0; } } + else + { + diff = FxaaPixelShader(vary_tc, //pos + vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos + diffuseMap, //tex + diffuseMap, + diffuseMap, + rcp_screen_res, //fxaaQualityRcpFrame + vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt + rcp_frame_opt, //fxaaConsoleRcpFrameOpt2 + rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2 + 0.75, //fxaaQualitySubpix + 0.166, //fxaaQualityEdgeThreshold + 0.0833, //fxaaQualityEdgeThresholdMin + 8.0, //fxaaConsoleEdgeSharpness + 0.125, //fxaaConsoleEdgeThreshold + 0.05, //fxaaConsoleEdgeThresholdMin + vec4(0,0,0,0)); //fxaaConsole360ConstDir + + + } diff /= w; } - vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor = diff + bloom; + gl_FragColor = diff; } diff --git a/indra/newview/app_settings/shaders/class1/interface/debugF.glsl b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl new file mode 100644 index 0000000000..d43bf3fb50 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl @@ -0,0 +1,31 @@ +/** + * @file debugF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform vec4 color; + +void main() +{ + gl_FragColor = color; +} diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl new file mode 100644 index 0000000000..2f64fdb7bc --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl @@ -0,0 +1,32 @@ +/** + * @file debugV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +attribute vec3 position; + +void main() +{ + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +} + diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl new file mode 100644 index 0000000000..c263f4dc6a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl @@ -0,0 +1,33 @@ +/** + * @file splattexturerectF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect screenMap; + +void main() +{ + gl_FragColor = texture2DRect(screenMap, gl_TexCoord[0].xy) * gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl new file mode 100644 index 0000000000..085970f549 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl @@ -0,0 +1,36 @@ +/** + * @file splattexturerectV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +attribute vec3 position; +attribute vec2 texcoord0; +attribute vec4 diffuse_color; + +void main() +{ + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = vec4(texcoord0,0,1); + gl_FrontColor = diffuse_color; +} + diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b1c7b7f159..d7d5e5f432 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2876,10 +2876,9 @@ void renderNormals(LLDrawable* drawablep) { const LLVolumeFace& face = volume->getVolumeFace(i); - gGL.begin(LLRender::LINES); - for (S32 j = 0; j < face.mNumVertices; ++j) { + gGL.begin(LLRender::LINES); LLVector4a n,p; n.setMul(face.mNormals[j], scale); @@ -2898,9 +2897,8 @@ void renderNormals(LLDrawable* drawablep) gGL.vertex3fv(face.mPositions[j].getF32ptr()); gGL.vertex3fv(p.getF32ptr()); } + gGL.end(); } - - gGL.end(); } gGL.popMatrix(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index de9d853c7c..9fac986bf1 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -65,9 +65,11 @@ LLVector4 gShinyOrigin; LLGLSLShader gOcclusionProgram; LLGLSLShader gCustomAlphaProgram; LLGLSLShader gGlowCombineProgram; +LLGLSLShader gSplatTextureRectProgram; LLGLSLShader gGlowCombineFXAAProgram; LLGLSLShader gTwoTextureAddProgram; LLGLSLShader gOneTextureNoColorProgram; +LLGLSLShader gDebugProgram; //object shaders LLGLSLShader gObjectSimpleProgram; @@ -216,6 +218,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gOneTextureNoColorProgram); mShaderList.push_back(&gSolidColorProgram); mShaderList.push_back(&gOcclusionProgram); + mShaderList.push_back(&gDebugProgram); mShaderList.push_back(&gObjectEmissiveProgram); mShaderList.push_back(&gObjectEmissiveWaterProgram); mShaderList.push_back(&gObjectFullbrightProgram); @@ -670,9 +673,11 @@ void LLViewerShaderMgr::setShaders() void LLViewerShaderMgr::unloadShaders() { gOcclusionProgram.unload(); + gDebugProgram.unload(); gUIProgram.unload(); gCustomAlphaProgram.unload(); gGlowCombineProgram.unload(); + gSplatTextureRectProgram.unload(); gGlowCombineFXAAProgram.unload(); gTwoTextureAddProgram.unload(); gOneTextureNoColorProgram.unload(); @@ -2713,6 +2718,22 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gCustomAlphaProgram.createShader(NULL, NULL); } + if (success) + { + gSplatTextureRectProgram.mName = "Splat Texture Rect Shader"; + gSplatTextureRectProgram.mShaderFiles.clear(); + gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER_ARB)); + gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSplatTextureRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gSplatTextureRectProgram.createShader(NULL, NULL); + if (success) + { + gSplatTextureRectProgram.bind(); + gSplatTextureRectProgram.uniform1i("screenMap", 0); + gSplatTextureRectProgram.unbind(); + } + } + if (success) { gGlowCombineProgram.mName = "Glow Combine Shader"; @@ -2805,6 +2826,16 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gOcclusionProgram.createShader(NULL, NULL); } + if (success) + { + gDebugProgram.mName = "Debug Shader"; + gDebugProgram.mShaderFiles.clear(); + gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugV.glsl", GL_VERTEX_SHADER_ARB)); + gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDebugProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gDebugProgram.createShader(NULL, NULL); + } + if( !success ) { mVertexShaderLevel[SHADER_INTERFACE] = 0; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index c63260fb2e..1c9d7f8453 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -273,7 +273,9 @@ extern LLVector4 gShinyOrigin; extern LLGLSLShader gOcclusionProgram; extern LLGLSLShader gCustomAlphaProgram; extern LLGLSLShader gGlowCombineProgram; +extern LLGLSLShader gSplatTextureRectProgram; extern LLGLSLShader gGlowCombineFXAAProgram; +extern LLGLSLShader gDebugProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 45268d203d..27672a05cb 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4126,6 +4126,11 @@ void LLPipeline::renderPhysicsDisplay() gGL.setColorMask(true, false); + if (LLGLSLShader::sNoFixedFunction) + { + gDebugProgram.bind(); + } + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { @@ -4155,8 +4160,13 @@ void LLPipeline::renderPhysicsDisplay() } } - gGL.flush(); + + if (LLGLSLShader::sNoFixedFunction) + { + gDebugProgram.unbind(); + } + mPhysicsDisplay.flush(); } @@ -6137,8 +6147,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM); if (!(gPipeline.canUseVertexShaders() && - sRenderGlow) || - (!sRenderDeferred && hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))) + sRenderGlow)) { return; } @@ -6569,19 +6578,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } - if (LLRenderTarget::sUseFBO) - { //copy depth buffer from mScreen to framebuffer - LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(), - 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); - } - gGL.setSceneBlendType(LLRender::BT_ALPHA); if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) { if (LLGLSLShader::sNoFixedFunction) { - gUIProgram.bind(); + gSplatTextureRectProgram.bind(); } gGL.setColorMask(true, false); @@ -6595,7 +6598,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.getTexUnit(0)->bind(&mPhysicsDisplay); - gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.begin(LLRender::TRIANGLES); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -6610,10 +6613,17 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (LLGLSLShader::sNoFixedFunction) { - gUIProgram.unbind(); + gSplatTextureRectProgram.unbind(); } + } + + if (LLRenderTarget::sUseFBO) + { //copy depth buffer from mScreen to framebuffer + LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(), + 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); } + glMatrixMode(GL_PROJECTION); glPopMatrix(); -- cgit v1.2.3 From 764b7a1ec0a92bd9948010ac76a7c4362d66acf6 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 22 Aug 2011 15:58:12 -0700 Subject: Mac build fixes. --- indra/llrender/llshadermgr.cpp | 2 ++ indra/newview/llviewerwindow.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 2334435644..b487cda4ef 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -704,6 +704,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL; dumpObjectLog(ret); +#if LL_WINDOWS std::stringstream ostr; //dump shader source for debugging for (GLuint i = 0; i < count; i++) @@ -719,6 +720,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; +#endif // LL_WINDOWS ret = 0; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9f66c074fd..254fa9d4a1 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3456,7 +3456,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, LLColor4 color(vovolume->getLightColor(), .5f); gGL.color4fv(color.mV); - F32 pixel_area = 100000.f; + //F32 pixel_area = 100000.f; // Render Outside gSphere.render(); -- cgit v1.2.3 From 11d7a7f197d31617602ff9c109674a783fd6fa71 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 23 Aug 2011 11:19:04 -0700 Subject: Mac crash fixes. Reviewed by davep. --- indra/newview/app_settings/shaders/class1/environment/waterV.glsl | 7 ++++--- indra/newview/llspatialpartition.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index b99fab2c0f..831a7de0ea 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -57,19 +57,20 @@ void main() float d = length(oEyeVec.xy); float ld = min(d, 2560.0); - position.xy = eyeVec.xy + oEyeVec.xy/d*ld; + vec3 lpos = position; + lpos.xy = eyeVec.xy + oEyeVec.xy/d*ld; view.xyz = oEyeVec; d = clamp(ld/1536.0-0.5, 0.0, 1.0); d *= d; - oPosition = vec4(position, 1.0); + oPosition = vec4(lpos, 1.0); oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); oPosition = modelViewProj * oPosition; refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); //get wave position parameter (create sweeping horizontal waves) - vec3 v = position.xyz; + vec3 v = lpos; v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; //push position for further horizon effect. diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index d7d5e5f432..78b2db2bde 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2416,7 +2416,7 @@ void pushVerts(LLFace* face, U32 mask) LLVertexBuffer* buffer = face->getVertexBuffer(); - if (buffer) + if (buffer && (face->getGeomCount() >= 3)) { buffer->setBuffer(mask); U16 start = face->getGeomStart(); -- cgit v1.2.3 From bf0d36bf889bb913fbc2a53c5a1b9818acb11ee6 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 24 Aug 2011 15:41:00 -0700 Subject: Mac rendering now with 100% fewer crashes when enabling shadows. --- indra/llrender/llglslshader.cpp | 2 ++ indra/llrender/llshadermgr.cpp | 3 +++ indra/newview/app_settings/settings.xml | 2 +- .../newview/app_settings/shaders/class1/deferred/postDeferredF.glsl | 2 +- .../app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 6 +++--- indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl | 4 +--- indra/newview/lltexlayer.cpp | 6 +++--- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 02bcc9e338..61648e527d 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -117,10 +117,12 @@ BOOL LLGLSLShader::createShader(vector * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); +#if !LL_DARWIN if (gGLManager.mGLVersion < 3.1f) { //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support) mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); } +#endif // !LL_DARWIN //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b487cda4ef..db3d7becd9 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -544,10 +544,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //set version to 1.20 text[count++] = strdup("#version 120\n"); + text[count++] = strdup("#define FXAA_GLSL_120 1\n"); + text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n"); } else { //set version to 1.30 text[count++] = strdup("#version 130\n"); + text[count++] = strdup("#define FXAA_GLSL_130 1\n"); } //copy preprocessor definitions into buffer diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ea986b16d..7c01731282 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7571,7 +7571,7 @@ Type Boolean Value - 1 + 0 RenderDebugNormalScale diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index cfcd8585f1..daef6a938c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -26,7 +26,7 @@ #extension GL_ARB_texture_rectangle : enable #define FXAA_PC 1 -#define FXAA_GLSL_130 1 +//#define FXAA_GLSL_130 1 #define FXAA_QUALITY__PRESET 12 /*============================================================================ diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index e9122fc9d3..f67615bdd5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -26,7 +26,7 @@ #extension GL_ARB_texture_rectangle : enable #define FXAA_PC 1 -#define FXAA_GLSL_130 1 +//#define FXAA_GLSL_130 1 #define FXAA_QUALITY__PRESET 12 /*============================================================================ diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 1809cff1e5..146fac56e9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -48,12 +48,12 @@ uniform float ssao_factor; uniform float ssao_factor_inv; varying vec2 vary_fragcoord; -varying vec4 vary_light; uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 shadow_res; uniform vec2 proj_shadow_res; +uniform vec3 sun_dir; uniform float shadow_bias; uniform float shadow_offset; @@ -132,10 +132,10 @@ void main() }*/ float shadow = 1.0; - float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); + float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); vec3 shadow_pos = pos.xyz + displace*norm; - vec3 offset = vary_light.xyz * (1.0-dp_directional_light); + vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 827ec15621..2cf7375d4d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -1,5 +1,5 @@ /** - * @file sunLightF.glsl + * @file sunLightV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -25,8 +25,6 @@ attribute vec3 position; - -varying vec4 vary_light; varying vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 87e7a57ae8..f44e62335d 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -306,9 +306,6 @@ BOOL LLTexLayerSetBuffer::render() success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight ); gGL.flush(); - LLVertexBuffer::unbind(); - LLGLSLShader::sNoFixedFunction = no_ff; - if(upload_now) { if (!success) @@ -338,6 +335,9 @@ BOOL LLTexLayerSetBuffer::render() doUpdate(); } + LLVertexBuffer::unbind(); + LLGLSLShader::sNoFixedFunction = no_ff; + // reset GL state gGL.setColorMask(true, true); gGL.setSceneBlendType(LLRender::BT_ALPHA); -- cgit v1.2.3 From f7a6ed85e40f53e5e28868bf34ac4dbc9bb204fb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Aug 2011 14:40:53 -0400 Subject: CHOP-763: Add LLView::TemporaryDrilldownFunc to support UI injection. Instead of unconditionally calling LLView::pointInView(), LLView::visibleAndContains() now consults a class-static boost::function called sDrilldown -- which is initialized to LLView::pointInView(). Introduce LLView::TemporaryDrilldownFunc, instantiated with a callable whose signature is compatible with LLView::pointInView(). This replaces sDrilldown, but only for the life of the TemporaryDrilldownFunc object. Introduce llview::TargetEvent, an object intended to serve as a TemporaryDrilldownFunc callable. Construct it with a desired target LLView* and pass it to TemporaryDrilldownFunc. When called with each candidate child LLView*, instead of selecting the one containing the particular (x, y) point, it selects the one that will lead to the ultimate desired target LLView*. Add optional 'recur' param to LLView::childFromPoint(); default is current one-level behavior. But when you pass recur=true, it should return the frontmost visible leaf LLView containing the passed (x, y) point. --- indra/llui/CMakeLists.txt | 2 ++ indra/llui/llview.cpp | 18 ++++++++++++--- indra/llui/llview.h | 31 ++++++++++++++++++++++++- indra/llui/llviewinject.cpp | 49 +++++++++++++++++++++++++++++++++++++++ indra/llui/llviewinject.h | 56 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 indra/llui/llviewinject.cpp create mode 100644 indra/llui/llviewinject.h diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 0bbdcfd6ff..9419f24809 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -111,6 +111,7 @@ set(llui_SOURCE_FILES llurlmatch.cpp llurlregistry.cpp llviewborder.cpp + llviewinject.cpp llviewmodel.cpp llview.cpp llviewquery.cpp @@ -214,6 +215,7 @@ set(llui_HEADER_FILES llurlmatch.h llurlregistry.h llviewborder.h + llviewinject.h llviewmodel.h llview.h llviewquery.h diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 6d0bd4d520..56b09791a4 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "llrender.h" #include "llevent.h" @@ -67,6 +68,8 @@ S32 LLView::sLastLeftXML = S32_MIN; S32 LLView::sLastBottomXML = S32_MIN; std::vector LLViewDrawContext::sDrawContextStack; +LLView::DrilldownFunc LLView::sDrilldown = + boost::bind(&LLView::pointInView, _1, _2, _3, HIT_TEST_USE_BOUNDING_RECT); //#if LL_DEBUG BOOL LLView::sIsDrawing = FALSE; @@ -645,7 +648,7 @@ void LLView::onMouseLeave(S32 x, S32 y, MASK mask) bool LLView::visibleAndContains(S32 local_x, S32 local_y) { - return pointInView(local_x, local_y) + return sDrilldown(this, local_x, local_y) && getVisible(); } @@ -789,10 +792,11 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) return NULL; } -LLView* LLView::childFromPoint(S32 x, S32 y) +LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) { - if (!getVisible() ) + if (!getVisible()) return false; + BOOST_FOREACH(LLView* viewp, mChildList) { S32 local_x = x - viewp->getRect().mLeft; @@ -801,6 +805,14 @@ LLView* LLView::childFromPoint(S32 x, S32 y) { continue; } + // Here we've found the first (frontmost) visible child at this level + // containing the specified point. Is the caller asking us to drill + // down and return the innermost leaf child at this point, or just the + // top-level child? + if (recur) + { + return viewp->childFromPoint(local_x, local_y, recur); + } return viewp; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index daea46d330..67634938fb 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -50,6 +50,7 @@ #include "llfocusmgr.h" #include +#include class LLSD; @@ -437,7 +438,7 @@ public: /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - virtual LLView* childFromPoint(S32 x, S32 y); + virtual LLView* childFromPoint(S32 x, S32 y, bool recur=false); // view-specific handlers virtual void onMouseEnter(S32 x, S32 y, MASK mask); @@ -599,7 +600,35 @@ private: LLView& getDefaultWidgetContainer() const; + // This allows special mouse-event targeting logic for testing. + typedef boost::function DrilldownFunc; + static DrilldownFunc sDrilldown; + public: + // This is the only public accessor to alter sDrilldown. This is not + // an accident. The intended usage pattern is like: + // { + // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); + // // ... test with myfunctor ... + // } // exiting block restores original LLView::sDrilldown + class TemporaryDrilldownFunc + { + public: + TemporaryDrilldownFunc(const DrilldownFunc& func): + mOldDrilldown(sDrilldown) + { + sDrilldown = func; + } + + ~TemporaryDrilldownFunc() + { + sDrilldown = mOldDrilldown; + } + + private: + DrilldownFunc mOldDrilldown; + }; + // Depth in view hierarchy during rendering static S32 sDepth; diff --git a/indra/llui/llviewinject.cpp b/indra/llui/llviewinject.cpp new file mode 100644 index 0000000000..46c5839f8e --- /dev/null +++ b/indra/llui/llviewinject.cpp @@ -0,0 +1,49 @@ +/** + * @file llviewinject.cpp + * @author Nat Goodspeed + * @date 2011-08-16 + * @brief Implementation for llviewinject. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Copyright (c) 2011, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llviewinject.h" +// STL headers +// std headers +// external library headers +// other Linden headers + +llview::TargetEvent::TargetEvent(LLView* view) +{ + // Walk up the view tree from target LLView to the root (NULL). If + // passed NULL, iterate 0 times. + for (; view; view = view->getParent()) + { + // At each level, operator() is going to ask: for a particular parent + // LLView*, which of its children should I select? So for this view's + // parent, select this view. + mChildMap[view->getParent()] = view; + } +} + +bool llview::TargetEvent::operator()(const LLView* view, S32 /*x*/, S32 /*y*/) const +{ + // We are being called to decide whether to direct an incoming mouse event + // to this child view. (Normal LLView processing is to check whether the + // incoming (x, y) is within the view.) Look up the parent to decide + // whether, for that parent, this is the previously-selected child. + ChildMap::const_iterator found(mChildMap.find(view->getParent())); + // If we're looking at a child whose parent isn't even in the map, never + // mind. + if (found == mChildMap.end()) + { + return false; + } + // So, is this the predestined child for this parent? + return (view == found->second); +} diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h new file mode 100644 index 0000000000..0de3d155c4 --- /dev/null +++ b/indra/llui/llviewinject.h @@ -0,0 +1,56 @@ +/** + * @file llviewinject.h + * @author Nat Goodspeed + * @date 2011-08-16 + * @brief Supplemental LLView functionality used for simulating UI events. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Copyright (c) 2011, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLVIEWINJECT_H) +#define LL_LLVIEWINJECT_H + +#include "llview.h" +#include + +namespace llview +{ + + /** + * TargetEvent is a callable with state, specifically intended for use as + * an LLView::TemporaryDrilldownFunc. Instantiate it with the desired + * target LLView*; pass it to a TemporaryDrilldownFunc instance; + * TargetEvent::operator() will then attempt to direct subsequent mouse + * events to the desired target LLView*. (This is an "attempt" because + * LLView will still balk unless the target LLView and every parent are + * visible and enabled.) + */ + class TargetEvent + { + public: + /** + * Construct TargetEvent with the desired target LLView*. (See + * LLUI::resolvePath() to obtain an LLView* given a string pathname.) + * This sets up for operator(). + */ + TargetEvent(LLView* view); + + /** + * This signature must match LLView::DrilldownFunc. When you install + * this TargetEvent instance using LLView::TemporaryDrilldownFunc, + * LLView will call this method to decide whether to propagate an + * incoming mouse event to the passed child LLView*. + */ + bool operator()(const LLView*, S32 x, S32 y) const; + + private: + // For a given parent LLView, identify which child to select. + typedef std::map ChildMap; + ChildMap mChildMap; + }; + +} // llview namespace + +#endif /* ! defined(LL_LLVIEWINJECT_H) */ -- cgit v1.2.3 From 79f14b7febf512e96a7d63eff8e6db895a7e72cf Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Aug 2011 14:54:38 -0400 Subject: CHOP-763: Move llwindowlistener.{h,cpp} from llwindow to newview. Instantiate LLWindowListener on LLViewerWindow instead of on LLWindow. This permits LLWindowListener to use machinery from llui, e.g. LLUI::resolvePath(). Document planned new ["path"], ["reply"] params to "keyDown", "keyUp", "mouseDown", "mouseUp", "mouseMove" operations; document relationship between ["path"] and ["x"] and ["y"]. NEW PARAMS NOT YET IMPLEMENTED. --- indra/llwindow/CMakeLists.txt | 2 - indra/llwindow/llwindow.cpp | 9 -- indra/llwindow/llwindow.h | 2 - indra/llwindow/llwindowlistener.cpp | 234 ---------------------------------- indra/llwindow/llwindowlistener.h | 55 -------- indra/newview/CMakeLists.txt | 2 + indra/newview/llviewerwindow.cpp | 9 +- indra/newview/llviewerwindow.h | 4 +- indra/newview/llwindowlistener.cpp | 247 ++++++++++++++++++++++++++++++++++++ indra/newview/llwindowlistener.h | 55 ++++++++ 10 files changed, 315 insertions(+), 304 deletions(-) delete mode 100644 indra/llwindow/llwindowlistener.cpp delete mode 100644 indra/llwindow/llwindowlistener.h create mode 100644 indra/newview/llwindowlistener.cpp create mode 100644 indra/newview/llwindowlistener.h diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 3d89867bc1..341bddfffd 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -38,7 +38,6 @@ set(llwindow_SOURCE_FILES llkeyboardheadless.cpp llwindowheadless.cpp llwindowcallbacks.cpp - llwindowlistener.cpp ) set(llwindow_HEADER_FILES @@ -48,7 +47,6 @@ set(llwindow_HEADER_FILES llkeyboardheadless.h llwindowheadless.h llwindowcallbacks.h - llwindowlistener.h ) set(viewer_SOURCE_FILES diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 71a5df910d..dc3a1099b1 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -41,8 +41,6 @@ #include "llkeyboard.h" #include "linked_lists.h" #include "llwindowcallbacks.h" -#include "llwindowlistener.h" -#include // @@ -118,17 +116,10 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mFlags(flags), mHighSurrogate(0) { - // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to - // pass its value right now. Instead, pass it a nullary function that - // will, when we later need it, return the value of gKeyboard. - // boost::lambda::var() constructs such a functor on the fly. - mListener = new LLWindowListener(callbacks, boost::lambda::var(gKeyboard)); } LLWindow::~LLWindow() { - delete mListener; - mListener = NULL; } //virtual diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 6bdc01ae88..e8a86a1880 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -36,7 +36,6 @@ class LLSplashScreen; class LLPreeditor; class LLWindowCallbacks; -class LLWindowListener; // Refer to llwindow_test in test/common/llwindow for usage example @@ -189,7 +188,6 @@ protected: BOOL mHideCursorPermanent; U32 mFlags; U16 mHighSurrogate; - LLWindowListener* mListener; // Handle a UTF-16 encoding unit received from keyboard. // Converting the series of UTF-16 encoding units to UTF-32 data, diff --git a/indra/llwindow/llwindowlistener.cpp b/indra/llwindow/llwindowlistener.cpp deleted file mode 100644 index 006aaa75e7..0000000000 --- a/indra/llwindow/llwindowlistener.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @file llwindowlistener.cpp - * @brief EventAPI interface for injecting input into LLWindow - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llwindowlistener.h" - -#include "llcoord.h" -#include "llkeyboard.h" -#include "llwindowcallbacks.h" -#include - -LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter) - : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), - mWindow(window), - mKbGetter(kbgetter) -{ - std::string keySomething = - "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified "; - std::string keyExplain = - "(integer keycode values, or keysym string from any addKeyName() call in\n" - "http://hg.secondlife.com/viewer-development/src/tip/indra/llwindow/llkeyboard.cpp )"; - std::string mask = - "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n" - "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n" - "to form the mask used with the event."; - - std::string mouseSomething = - "Given [\"button\"], [\"x\"] and [\"y\"], inject the given mouse "; - std::string mouseExplain = - "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")"; - - add("keyDown", - keySomething + "keypress event.\n" + keyExplain + '\n' + mask, - &LLWindowListener::keyDown); - add("keyUp", - keySomething + "key release event.\n" + keyExplain + '\n' + mask, - &LLWindowListener::keyUp); - add("mouseDown", - mouseSomething + "click event.\n" + mouseExplain + '\n' + mask, - &LLWindowListener::mouseDown); - add("mouseUp", - mouseSomething + "release event.\n" + mouseExplain + '\n' + mask, - &LLWindowListener::mouseUp); - add("mouseMove", - std::string("Given [\"x\"] and [\"y\"], inject the given mouse movement event.\n") + - mask, - &LLWindowListener::mouseMove); - add("mouseScroll", - "Given an integer number of [\"clicks\"], inject the given mouse scroll event.\n" - "(positive clicks moves downward through typical content)", - &LLWindowListener::mouseScroll); -} - -template -class StringLookup -{ -private: - std::string mDesc; - typedef std::map Map; - Map mMap; - -public: - StringLookup(const std::string& desc): mDesc(desc) {} - - MAPPED lookup(const typename Map::key_type& key) const - { - typename Map::const_iterator found = mMap.find(key); - if (found == mMap.end()) - { - LL_WARNS("LLWindowListener") << "Unknown " << mDesc << " '" << key << "'" << LL_ENDL; - return MAPPED(); - } - return found->second; - } - -protected: - void add(const typename Map::key_type& key, const typename Map::mapped_type& value) - { - mMap.insert(typename Map::value_type(key, value)); - } -}; - -// helper for getMask() -static MASK lookupMask_(const std::string& maskname) -{ - // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not - // supported by maskFromString(). Handle that specially. - if (maskname == "MAC_CONTROL") - { - return MASK_MAC_CONTROL; - } - else - { - // In case of lookup failure, return MASK_NONE, which won't affect our - // caller's OR. - MASK mask(MASK_NONE); - LLKeyboard::maskFromString(maskname, &mask); - return mask; - } -} - -static MASK getMask(const LLSD& event) -{ - LLSD masknames(event["mask"]); - if (! masknames.isArray()) - { - // If event["mask"] is a single string, perform normal lookup on it. - return lookupMask_(masknames); - } - - // Here event["mask"] is an array of mask-name strings. OR together their - // corresponding bits. - MASK mask(MASK_NONE); - for (LLSD::array_const_iterator ai(masknames.beginArray()), aend(masknames.endArray()); - ai != aend; ++ai) - { - mask |= lookupMask_(*ai); - } - return mask; -} - -static KEY getKEY(const LLSD& event) -{ - if (event.has("keysym")) - { - // Initialize to KEY_NONE; that way we can ignore the bool return from - // keyFromString() and, in the lookup-fail case, simply return KEY_NONE. - KEY key(KEY_NONE); - LLKeyboard::keyFromString(event["keysym"], &key); - return key; - } - else if (event.has("keycode")) - { - return KEY(event["keycode"].asInteger()); - } - else - { - return KEY(event["char"].asString()[0]); - } -} - -void LLWindowListener::keyDown(LLSD const & evt) -{ - mKbGetter()->handleTranslatedKeyDown(getKEY(evt), getMask(evt)); -} - -void LLWindowListener::keyUp(LLSD const & evt) -{ - mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); -} - -// for WhichButton -typedef BOOL (LLWindowCallbacks::*MouseFunc)(LLWindow *, LLCoordGL, MASK); -struct Actions -{ - Actions(const MouseFunc& d, const MouseFunc& u): down(d), up(u), valid(true) {} - Actions(): valid(false) {} - MouseFunc down, up; - bool valid; -}; - -struct WhichButton: public StringLookup -{ - WhichButton(): StringLookup("mouse button") - { - add("LEFT", Actions(&LLWindowCallbacks::handleMouseDown, - &LLWindowCallbacks::handleMouseUp)); - add("RIGHT", Actions(&LLWindowCallbacks::handleRightMouseDown, - &LLWindowCallbacks::handleRightMouseUp)); - add("MIDDLE", Actions(&LLWindowCallbacks::handleMiddleMouseDown, - &LLWindowCallbacks::handleMiddleMouseUp)); - } -}; -static WhichButton buttons; - -static LLCoordGL getPos(const LLSD& event) -{ - return LLCoordGL(event["x"].asInteger(), event["y"].asInteger()); -} - -void LLWindowListener::mouseDown(LLSD const & evt) -{ - Actions actions(buttons.lookup(evt["button"])); - if (actions.valid) - { - (mWindow->*(actions.down))(NULL, getPos(evt), getMask(evt)); - } -} - -void LLWindowListener::mouseUp(LLSD const & evt) -{ - Actions actions(buttons.lookup(evt["button"])); - if (actions.valid) - { - (mWindow->*(actions.up))(NULL, getPos(evt), getMask(evt)); - } -} - -void LLWindowListener::mouseMove(LLSD const & evt) -{ - mWindow->handleMouseMove(NULL, getPos(evt), getMask(evt)); -} - -void LLWindowListener::mouseScroll(LLSD const & evt) -{ - S32 clicks = evt["clicks"].asInteger(); - - mWindow->handleScrollWheel(NULL, clicks); -} - diff --git a/indra/llwindow/llwindowlistener.h b/indra/llwindow/llwindowlistener.h deleted file mode 100644 index 74e577ff93..0000000000 --- a/indra/llwindow/llwindowlistener.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file llwindowlistener.h - * @brief EventAPI interface for injecting input into LLWindow - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLWINDOWLISTENER_H -#define LL_LLWINDOWLISTENER_H - -#include "lleventapi.h" -#include - -class LLKeyboard; -class LLWindowCallbacks; - -class LLWindowListener : public LLEventAPI -{ -public: - typedef boost::function KeyboardGetter; - LLWindowListener(LLWindowCallbacks * window, const KeyboardGetter& kbgetter); - - void keyDown(LLSD const & evt); - void keyUp(LLSD const & evt); - void mouseDown(LLSD const & evt); - void mouseUp(LLSD const & evt); - void mouseMove(LLSD const & evt); - void mouseScroll(LLSD const & evt); - -private: - LLWindowCallbacks * mWindow; - KeyboardGetter mKbGetter; -}; - - -#endif // LL_LLWINDOWLISTENER_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 935dd2e887..bd080f2ac4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -599,6 +599,7 @@ set(viewer_SOURCE_FILES llweb.cpp llwebsharing.cpp llwind.cpp + llwindowlistener.cpp llwlanimator.cpp llwldaycycle.cpp llwlhandlers.cpp @@ -1153,6 +1154,7 @@ set(viewer_HEADER_FILES llweb.h llwebsharing.h llwind.h + llwindowlistener.h llwlanimator.h llwldaycycle.h llwlhandlers.h diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 988c4ed1a2..0501b61592 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "llagent.h" #include "llagentcamera.h" @@ -198,6 +199,7 @@ #include "llfloaternotificationsconsole.h" #include "llnearbychat.h" +#include "llwindowlistener.h" #include "llviewerwindowlistener.h" #include "llpaneltopinfobar.h" @@ -1552,7 +1554,12 @@ LLViewerWindow::LLViewerWindow( mResDirty(false), mStatesDirty(false), mCurrResolutionIndex(0), - mViewerWindowListener(new LLViewerWindowListener(this)), + // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to + // pass its value right now. Instead, pass it a nullary function that + // will, when we later need it, return the value of gKeyboard. + // boost::lambda::var() constructs such a functor on the fly. + mWindowListener(new LLWindowListener(this, boost::lambda::var(gKeyboard))), + mViewerWindowListener(new LLViewerWindowListener(this)), mProgressView(NULL) { LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert")); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ff49ed1f62..48599ebb00 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -62,6 +62,7 @@ class LLImageFormatted; class LLHUDIcon; class LLWindow; class LLRootView; +class LLWindowListener; class LLViewerWindowListener; class LLPopupView; @@ -455,7 +456,8 @@ protected: bool mStatesDirty; U32 mCurrResolutionIndex; - boost::scoped_ptr mViewerWindowListener; + boost::scoped_ptr mWindowListener; + boost::scoped_ptr mViewerWindowListener; protected: static std::string sSnapshotBaseName; diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp new file mode 100644 index 0000000000..e5deaa42cf --- /dev/null +++ b/indra/newview/llwindowlistener.cpp @@ -0,0 +1,247 @@ +/** + * @file llwindowlistener.cpp + * @brief EventAPI interface for injecting input into LLWindow + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llwindowlistener.h" + +#include "llcoord.h" +#include "llkeyboard.h" +#include "llwindowcallbacks.h" +#include "llui.h" +#include + +LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter) + : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), + mWindow(window), + mKbGetter(kbgetter) +{ + std::string keySomething = + "Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified "; + std::string keyExplain = + "(integer keycode values, or keysym string from any addKeyName() call in\n" + "http://hg.secondlife.com/viewer-development/src/tip/indra/llwindow/llkeyboard.cpp )\n"; + std::string mask = + "Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n" + "\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n" + "to form the mask used with the event."; + + std::string given = "Given "; + std::string mouseParams = + "optional [\"path\"], optional [\"x\"] and [\"y\"], inject the requested mouse "; + std::string buttonParams = + std::string("[\"button\"], ") + mouseParams; + std::string buttonExplain = + "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n"; + std::string paramsExplain = + "[\"path\"] is as for LLUI::resolvePath(), described in\n" + "http://hg.secondlife.com/viewer-development/src/tip/indra/llui/llui.h\n" + "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n" + "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n" + "in the center of the LLView selected by [\"path\"].\n" + "You may specify [\"path\"] with both [\"x\"] and [\"y\"], will use your (x, y).\n" + "This may cause the LLView selected by [\"path\"] to reject the event.\n" + "Optional [\"reply\"] requests a reply event on the named LLEventPump.\n" + "reply[\"error\"] isUndefined (None) on success, else an explanatory message.\n"; + + add("keyDown", + keySomething + "keypress event.\n" + keyExplain + mask, + &LLWindowListener::keyDown); + add("keyUp", + keySomething + "key release event.\n" + keyExplain + mask, + &LLWindowListener::keyUp); + add("mouseDown", + given + buttonParams + "click event.\n" + buttonExplain + paramsExplain + mask, + &LLWindowListener::mouseDown); + add("mouseUp", + given + buttonParams + "release event.\n" + buttonExplain + paramsExplain + mask, + &LLWindowListener::mouseUp); + add("mouseMove", + given + mouseParams + "movement event.\n" + paramsExplain + mask, + &LLWindowListener::mouseMove); + add("mouseScroll", + "Given an integer number of [\"clicks\"], inject the requested mouse scroll event.\n" + "(positive clicks moves downward through typical content)", + &LLWindowListener::mouseScroll); +} + +template +class StringLookup +{ +private: + std::string mDesc; + typedef std::map Map; + Map mMap; + +public: + StringLookup(const std::string& desc): mDesc(desc) {} + + MAPPED lookup(const typename Map::key_type& key) const + { + typename Map::const_iterator found = mMap.find(key); + if (found == mMap.end()) + { + LL_WARNS("LLWindowListener") << "Unknown " << mDesc << " '" << key << "'" << LL_ENDL; + return MAPPED(); + } + return found->second; + } + +protected: + void add(const typename Map::key_type& key, const typename Map::mapped_type& value) + { + mMap.insert(typename Map::value_type(key, value)); + } +}; + +// helper for getMask() +static MASK lookupMask_(const std::string& maskname) +{ + // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not + // supported by maskFromString(). Handle that specially. + if (maskname == "MAC_CONTROL") + { + return MASK_MAC_CONTROL; + } + else + { + // In case of lookup failure, return MASK_NONE, which won't affect our + // caller's OR. + MASK mask(MASK_NONE); + LLKeyboard::maskFromString(maskname, &mask); + return mask; + } +} + +static MASK getMask(const LLSD& event) +{ + LLSD masknames(event["mask"]); + if (! masknames.isArray()) + { + // If event["mask"] is a single string, perform normal lookup on it. + return lookupMask_(masknames); + } + + // Here event["mask"] is an array of mask-name strings. OR together their + // corresponding bits. + MASK mask(MASK_NONE); + for (LLSD::array_const_iterator ai(masknames.beginArray()), aend(masknames.endArray()); + ai != aend; ++ai) + { + mask |= lookupMask_(*ai); + } + return mask; +} + +static KEY getKEY(const LLSD& event) +{ + if (event.has("keysym")) + { + // Initialize to KEY_NONE; that way we can ignore the bool return from + // keyFromString() and, in the lookup-fail case, simply return KEY_NONE. + KEY key(KEY_NONE); + LLKeyboard::keyFromString(event["keysym"], &key); + return key; + } + else if (event.has("keycode")) + { + return KEY(event["keycode"].asInteger()); + } + else + { + return KEY(event["char"].asString()[0]); + } +} + +void LLWindowListener::keyDown(LLSD const & evt) +{ + mKbGetter()->handleTranslatedKeyDown(getKEY(evt), getMask(evt)); +} + +void LLWindowListener::keyUp(LLSD const & evt) +{ + mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); +} + +// for WhichButton +typedef BOOL (LLWindowCallbacks::*MouseFunc)(LLWindow *, LLCoordGL, MASK); +struct Actions +{ + Actions(const MouseFunc& d, const MouseFunc& u): down(d), up(u), valid(true) {} + Actions(): valid(false) {} + MouseFunc down, up; + bool valid; +}; + +struct WhichButton: public StringLookup +{ + WhichButton(): StringLookup("mouse button") + { + add("LEFT", Actions(&LLWindowCallbacks::handleMouseDown, + &LLWindowCallbacks::handleMouseUp)); + add("RIGHT", Actions(&LLWindowCallbacks::handleRightMouseDown, + &LLWindowCallbacks::handleRightMouseUp)); + add("MIDDLE", Actions(&LLWindowCallbacks::handleMiddleMouseDown, + &LLWindowCallbacks::handleMiddleMouseUp)); + } +}; +static WhichButton buttons; + +static LLCoordGL getPos(const LLSD& event) +{ + return LLCoordGL(event["x"].asInteger(), event["y"].asInteger()); +} + +void LLWindowListener::mouseDown(LLSD const & evt) +{ + Actions actions(buttons.lookup(evt["button"])); + if (actions.valid) + { + (mWindow->*(actions.down))(NULL, getPos(evt), getMask(evt)); + } +} + +void LLWindowListener::mouseUp(LLSD const & evt) +{ + Actions actions(buttons.lookup(evt["button"])); + if (actions.valid) + { + (mWindow->*(actions.up))(NULL, getPos(evt), getMask(evt)); + } +} + +void LLWindowListener::mouseMove(LLSD const & evt) +{ + mWindow->handleMouseMove(NULL, getPos(evt), getMask(evt)); +} + +void LLWindowListener::mouseScroll(LLSD const & evt) +{ + S32 clicks = evt["clicks"].asInteger(); + + mWindow->handleScrollWheel(NULL, clicks); +} + diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h new file mode 100644 index 0000000000..74e577ff93 --- /dev/null +++ b/indra/newview/llwindowlistener.h @@ -0,0 +1,55 @@ +/** + * @file llwindowlistener.h + * @brief EventAPI interface for injecting input into LLWindow + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWINDOWLISTENER_H +#define LL_LLWINDOWLISTENER_H + +#include "lleventapi.h" +#include + +class LLKeyboard; +class LLWindowCallbacks; + +class LLWindowListener : public LLEventAPI +{ +public: + typedef boost::function KeyboardGetter; + LLWindowListener(LLWindowCallbacks * window, const KeyboardGetter& kbgetter); + + void keyDown(LLSD const & evt); + void keyUp(LLSD const & evt); + void mouseDown(LLSD const & evt); + void mouseUp(LLSD const & evt); + void mouseMove(LLSD const & evt); + void mouseScroll(LLSD const & evt); + +private: + LLWindowCallbacks * mWindow; + KeyboardGetter mKbGetter; +}; + + +#endif // LL_LLWINDOWLISTENER_H -- cgit v1.2.3 From 1d31559b30a32c4ebfde7dc2c42baef840be7c4d Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Fri, 26 Aug 2011 15:06:14 -0500 Subject: implement path option for key events. --- indra/newview/llwindowlistener.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index e5deaa42cf..3d756ef9b9 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -29,9 +29,13 @@ #include "llwindowlistener.h" #include "llcoord.h" +#include "llfocusmgr.h" #include "llkeyboard.h" #include "llwindowcallbacks.h" #include "llui.h" +#include "llview.h" +#include "llviewerwindow.h" +#include "llrootview.h" #include LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter) @@ -117,8 +121,10 @@ protected: } }; +namespace { + // helper for getMask() -static MASK lookupMask_(const std::string& maskname) +MASK lookupMask_(const std::string& maskname) { // It's unclear to me whether MASK_MAC_CONTROL is important, but it's not // supported by maskFromString(). Handle that specially. @@ -136,7 +142,7 @@ static MASK lookupMask_(const std::string& maskname) } } -static MASK getMask(const LLSD& event) +MASK getMask(const LLSD& event) { LLSD masknames(event["mask"]); if (! masknames.isArray()) @@ -156,7 +162,7 @@ static MASK getMask(const LLSD& event) return mask; } -static KEY getKEY(const LLSD& event) +KEY getKEY(const LLSD& event) { if (event.has("keysym")) { @@ -176,13 +182,36 @@ static KEY getKEY(const LLSD& event) } } +} // namespace + void LLWindowListener::keyDown(LLSD const & evt) { - mKbGetter()->handleTranslatedKeyDown(getKEY(evt), getMask(evt)); + if (evt.has("path")) + { + LLView * target_view = + LLUI::resolvePath(gViewerWindow->getRootView(), evt["path"]); + if ((target_view != 0) && target_view->isAvailable()) + { + gFocusMgr.setKeyboardFocus(target_view); + KEY key = getKEY(evt); + MASK mask = getMask(evt); + if (!target_view->handleKey(key, mask, true)) target_view->handleUnicodeChar(key, true); + } + else + { + ; // TODO: Don't silently fail if target not available. + } + } + else + { + mKbGetter()->handleTranslatedKeyDown(getKEY(evt), getMask(evt)); + } } void LLWindowListener::keyUp(LLSD const & evt) { + if (evt.has("path")) return; // LLView only handles key down. + mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); } -- cgit v1.2.3 From 7821ff23baafff4e7712a126c17c3947e7b4989e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 27 Aug 2011 00:38:53 -0500 Subject: SH-2242 Physics shape display works again, added asserts to flush out areas where state being consumed by a shader does not match state being provided by vertex buffers. --- indra/llrender/llrender.cpp | 54 ++++++---------------- indra/llrender/llvertexbuffer.cpp | 50 +++++++++++++++++++- .../shaders/class1/deferred/bumpV.glsl | 4 +- .../shaders/class1/interface/highlightF.glsl | 4 +- .../app_settings/shaders/class1/objects/bumpV.glsl | 2 - indra/newview/lldrawpoolalpha.cpp | 3 +- indra/newview/lldrawpoolwlsky.cpp | 4 +- indra/newview/llselectmgr.cpp | 12 ++--- indra/newview/llspatialpartition.cpp | 19 ++------ indra/newview/llviewerdisplay.cpp | 12 +++++ indra/newview/pipeline.cpp | 2 - 11 files changed, 89 insertions(+), 77 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 03a45c35dc..ea398c61de 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1583,15 +1583,11 @@ void LLRender::color3fv(const GLfloat* c) void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - S32 loc = -1; - if (shader) - { - loc = shader->getUniformLocation("color"); - } + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); - if (loc >= 0) + if (shader) { - shader->uniform4f(loc, r,g,b,1.f); + shader->uniform4f("color", r,g,b,1.f); } else { @@ -1602,15 +1598,11 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) void LLRender::diffuseColor3fv(const F32* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - S32 loc = -1; - if (shader) - { - loc = shader->getUniformLocation("color"); - } + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); - if (loc >= 0) + if (shader) { - shader->uniform4f(loc, c[0], c[1], c[2], 1.f); + shader->uniform4f("color", c[0], c[1], c[2], 1.f); } else { @@ -1621,35 +1613,26 @@ void LLRender::diffuseColor3fv(const F32* c) void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - S32 loc = -1; - if (shader) - { - loc = shader->getUniformLocation("color"); - } + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); - if (loc >= 0) + if (shader) { - shader->uniform4f(loc, r,g,b,a); + shader->uniform4f("color", r,g,b,a); } else { glColor4f(r,g,b,a); } - } void LLRender::diffuseColor4fv(const F32* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - S32 loc = -1; - if (shader) - { - loc = shader->getUniformLocation("color"); - } + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); - if (loc >= 0) + if (shader) { - shader->uniform4fv(loc, 1, c); + shader->uniform4fv("color", 1, c); } else { @@ -1660,15 +1643,11 @@ void LLRender::diffuseColor4fv(const F32* c) void LLRender::diffuseColor4ubv(const U8* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - S32 loc = -1; - if (shader) - { - loc = shader->getUniformLocation("color"); - } + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); - if (loc >= 0) + if (shader) { - shader->uniform4f(loc, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); + shader->uniform4f("color", c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); } else { @@ -1676,9 +1655,6 @@ void LLRender::diffuseColor4ubv(const U8* c) } } - - - void LLRender::debugTexUnits(void) { LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 5d19168842..86352215ff 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -364,8 +364,26 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con setupClientArrays(MAP_VERTEX | MAP_NORMAL); - glVertexPointer(3, GL_FLOAT, 0, pos[0].mV); - glNormalPointer(GL_FLOAT, 0, norm[0].mV); + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader) + { + S32 loc = shader->getAttribLocation(LLVertexBuffer::TYPE_VERTEX); + if (loc > -1) + { + glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV); + } + loc = shader->getAttribLocation(LLVertexBuffer::TYPE_NORMAL); + if (loc > -1) + { + glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV); + } + } + else + { + glVertexPointer(3, GL_FLOAT, 0, pos[0].mV); + glNormalPointer(GL_FLOAT, 0, norm[0].mV); + } glDrawArrays(sGLMode[mode], 0, count); } @@ -1730,6 +1748,34 @@ void LLVertexBuffer::setBuffer(U32 data_mask, S32 type) //set up pointers if the data mask is different ... BOOL setup = (sLastMask != data_mask); + if (gDebugGL && data_mask != 0) + { + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + if (shader) + { + U32 required_mask = 0; + for (U32 i = 0; i < LLVertexBuffer::TYPE_MAX; ++i) + { + if (shader->getAttribLocation(i) > -1) + { + U32 required = 1 << i; + if ((data_mask & required) == 0) + { + llwarns << "Missing attribute: " << i << llendl; + } + + required_mask |= required; + + } + } + + if ((data_mask & required_mask) != required_mask) + { + llerrs << "Shader consumption mismatches data provision." << llendl; + } + } + } + if (useVBOs()) { if (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)) diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 99ddeaf0b9..b724def93d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -27,7 +27,7 @@ attribute vec3 position; attribute vec4 diffuse_color; attribute vec3 normal; attribute vec2 texcoord0; -attribute vec2 texcoord2; +attribute vec3 binormal; varying vec3 vary_mat0; varying vec3 vary_mat1; @@ -40,7 +40,7 @@ void main() gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); vec3 n = normalize(gl_NormalMatrix * normal); - vec3 b = normalize(gl_NormalMatrix * vec4(texcoord2,0,1).xyz); + vec3 b = normalize(gl_NormalMatrix * binormal); vec3 t = cross(b, n); vary_mat0 = vec3(t.x, b.x, n.x); diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl index 4c0455502f..3a48205101 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl @@ -24,10 +24,10 @@ */ -uniform vec4 highlight_color; +uniform vec4 color; uniform sampler2D diffuseMap; void main() { - gl_FragColor = highlight_color*texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = color*texture2D(diffuseMap, gl_TexCoord[0].xy); } diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl index bb6f0aa5e8..7d38e07d65 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl @@ -25,7 +25,6 @@ attribute vec3 position; -attribute vec4 diffuse_color; attribute vec2 texcoord0; attribute vec2 texcoord1; @@ -35,5 +34,4 @@ void main() gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); gl_TexCoord[1] = gl_TextureMatrix[1] * vec4(texcoord1,0,1); - gl_FrontColor = diffuse_color; } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index a3f8eb377a..1e04cd9c17 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -322,13 +322,12 @@ void LLDrawPoolAlpha::render(S32 pass) if(shaders) { gHighlightProgram.bind(); - gHighlightProgram.uniform4f("highlight_color", 1,0,0,1); } else { gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - gGL.diffuseColor4f(1,0,0,1); } + gGL.diffuseColor4f(1,0,0,1); LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f); gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ; diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index e4de92490e..852de39781 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -269,7 +269,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() { if (gPipeline.canUseVertexShaders()) { - gUIProgram.bind(); + gHighlightProgram.bind(); } // *NOTE: even though we already bound this texture above for the // stars register combiners, we bind again here for defensive reasons, @@ -289,7 +289,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (gPipeline.canUseVertexShaders()) { - gUIProgram.unbind(); + gHighlightProgram.unbind(); } } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 568c967a9a..48cccc12ef 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5637,7 +5637,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); if (shader) { - gHighlightProgram.uniform4f("highlight_color", color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); pushWireframe(drawable); } else @@ -5661,14 +5661,8 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); - if (shader) - { - gHighlightProgram.uniform4f("highlight_color", color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); - } - else - { - gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); - } + gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); + LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); glLineWidth(3.f); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 78b2db2bde..e0c3b43110 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2944,7 +2944,7 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo else { gMeshRepo.buildPhysicsMesh(*decomp); - gGL.color3f(0,1,1); + gGL.diffuseColor4f(0,1,1,1); drawBoxOutline(center, size); } @@ -3078,7 +3078,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) { renderMeshBaseHull(volume, data_mask, color, line_color); } -#if LL_WINDOWS else { LLVolumeParams volume_params = volume->getVolume()->getParams(); @@ -3190,13 +3189,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else { - gGL.color3f(1,0,1); + gGL.diffuseColor4f(1,0,1,1); drawBoxOutline(center, size); } LLPrimitive::sVolumeManager->unrefVolume(phys_volume); } -#endif //LL_WINDOWS } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX) { @@ -3210,7 +3208,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE) { - LLVolumeParams volume_params; + /*LLVolumeParams volume_params; volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE ); volume_params.setBeginAndEndS( 0.f, 1.f ); volume_params.setBeginAndEndT( 0.f, 1.f ); @@ -3220,7 +3218,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.diffuseColor4fv(color.mV); pushVerts(sphere); - LLPrimitive::sVolumeManager->unrefVolume(sphere); + LLPrimitive::sVolumeManager->unrefVolume(sphere);*/ } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER) { @@ -3290,15 +3288,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } gGL.popMatrix(); - - /*{ //analytical shape, just push visual rep. - gGL.diffuseColor3fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - pushVerts(drawable, data_mask); - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - pushVerts(drawable, data_mask); - }*/ } void renderPhysicsShapes(LLSpatialGroup* group) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 39053fe9e4..eeb33ea5d2 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -719,6 +719,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); gPipeline.generateHighlight(*LLViewerCamera::getInstance()); + gPipeline.renderPhysicsDisplay(); } LLGLState::checkStates(); @@ -1454,6 +1455,11 @@ void render_ui_2d() void render_disconnected_background() { + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gGL.color4f(1,1,1,1); if (!gDisconnectedImagep && gDisconnected) { @@ -1523,6 +1529,12 @@ void render_disconnected_background() glPopMatrix(); } gGL.flush(); + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } + } void display_cleanup() diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 27672a05cb..8d5bc22e6f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4480,8 +4480,6 @@ void LLPipeline::renderDebug() { gUIProgram.unbind(); } - - gPipeline.renderPhysicsDisplay(); } void LLPipeline::rebuildPools() -- cgit v1.2.3 From c8b8b153f14b65fa7d833d787df6c03539eb85a8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 27 Aug 2011 00:48:14 -0500 Subject: SH-2242 Don't make LLDynamicTexture targets use shaders all the time (revisit later). --- indra/newview/lldynamictexture.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 4955b6224e..f9a213a86f 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -210,6 +210,9 @@ BOOL LLViewerDynamicTexture::updateAllInstances() LLGLSLShader::bindNoShader(); LLVertexBuffer::unbind(); + bool no_ff = LLGLSLShader::sNoFixedFunction; + LLGLSLShader::sNoFixedFunction = false; + BOOL result = FALSE; BOOL ret = FALSE ; for( S32 order = 0; order < ORDER_COUNT; order++ ) @@ -240,6 +243,8 @@ BOOL LLViewerDynamicTexture::updateAllInstances() } } + LLGLSLShader::sNoFixedFunction = no_ff; + return ret; } -- cgit v1.2.3 From 7ee10ae1def26708fa44c25355982aa56195d5f9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 27 Aug 2011 01:30:31 -0500 Subject: SH-2242 Remove old multisample shaders and make FXAA turn itself off when FSAA is disabled. --- .../shaders/class1/deferred/blurLightMSF.glsl | 131 -------- .../class1/deferred/multiPointLightMSF.glsl | 155 ---------- .../shaders/class1/deferred/multiSpotLightMSF.glsl | 250 --------------- .../shaders/class1/deferred/pointLightMSF.glsl | 126 -------- .../shaders/class1/deferred/postDeferredMSF.glsl | 151 --------- .../class1/deferred/postDeferredNoDoFMSF.glsl | 55 ---- .../class1/deferred/postDeferredNoDoFNoFXAAF.glsl | 41 +++ .../class1/deferred/postDeferredNoFXAAF.glsl | 153 +++++++++ .../shaders/class1/deferred/softenLightMSF.glsl | 342 --------------------- .../shaders/class1/deferred/spotLightMSF.glsl | 252 --------------- .../shaders/class1/deferred/sunLightMSF.glsl | 35 --- .../shaders/class1/deferred/sunLightSSAOMSF.glsl | 140 --------- indra/newview/llviewershadermgr.cpp | 121 +------- indra/newview/pipeline.cpp | 43 ++- 14 files changed, 240 insertions(+), 1755 deletions(-) delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl deleted file mode 100644 index c858eb7a3a..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file blurLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS depthMap; -uniform sampler2DMS normalMap; -uniform sampler2DRect lightMap; - -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform vec3 kern[4]; -uniform float kern_scale; - -varying vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec3 texture2DMS3(sampler2DMS tex, ivec2 tc) -{ - vec3 ret = vec3(0,0,0); - for (int i = 0; i < samples; i++) - { - ret += texelFetch(tex, tc, i).rgb; - } - - return ret/samples; -} - -float texture2DMS1(sampler2DMS tex, ivec2 tc) -{ - float ret = 0; - for (int i = 0; i < samples; i++) - { - ret += texelFetch(tex, tc, i).r; - } - - return ret/samples; -} - -vec4 getPosition(ivec2 pos_screen) -{ - float depth = texture2DMS1(depthMap, pos_screen.xy); - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - vec2 tc = vary_fragcoord.xy; - ivec2 itc = ivec2(tc); - - vec3 norm = texture2DMS3(normalMap, itc).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - vec3 pos = getPosition(itc).xyz; - vec4 ccol = texture2DRect(lightMap, tc).rgba; - - vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); - dlt /= max(-pos.z*dist_factor, 1.0); - - vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' - vec4 col = defined_weight.xyxx * ccol; - - // relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances - float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; - - // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large - tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); - - for (int i = 1; i < 4; i++) - { - vec2 samptc = tc + kern[i].z*dlt; - vec3 samppos = getPosition(ivec2(samptc)).xyz; - float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= pointplanedist_tolerance_pow2) - { - col += texture2DRect(lightMap, samptc)*kern[i].xyxx; - defined_weight += kern[i].xy; - } - } - for (int i = 1; i < 4; i++) - { - vec2 samptc = vec2(tc - kern[i].z*dlt); - vec3 samppos = getPosition(ivec2(samptc)).xyz; - float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= pointplanedist_tolerance_pow2) - { - col += texture2DRect(lightMap, samptc)*kern[i].xyxx; - defined_weight += kern[i].xy; - } - } - - col /= defined_weight.xyxx; - col.y *= col.y; - - gl_FragColor = col; -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl deleted file mode 100644 index 863bac19cf..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @file multiPointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS depthMap; -uniform sampler2DMS diffuseRect; -uniform sampler2DMS specularRect; -uniform sampler2DMS normalMap; -uniform sampler2D noiseMap; -uniform sampler2D lightFunc; - - -uniform vec3 env_mat[3]; -uniform float sun_wash; - -uniform int light_count; - -#define MAX_LIGHT_COUNT 16 -uniform vec4 light[MAX_LIGHT_COUNT]; -uniform vec4 light_col[MAX_LIGHT_COUNT]; - -varying vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform float far_z; - -uniform mat4 inv_proj; - -vec4 getPosition(ivec2 pos_screen, int sample) -{ - float depth = texelFetch(depthMap, pos_screen, sample).r; - vec2 sc = vec2(pos_screen.xy)*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; - ivec2 itc = ivec2(frag); - - int wght = 0; - vec3 fcol = vec3(0,0,0); - - for (int s = 0; s < samples; ++s) - { - vec3 pos = getPosition(itc, s).xyz; - if (pos.z >= far_z) - { - vec3 norm = texelFetch(normalMap, itc, s).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - norm = normalize(norm); - vec4 spec = texelFetch(specularRect, itc, s); - vec3 diff = texelFetch(diffuseRect, itc, s).rgb; - float noise = texture2D(noiseMap, frag.xy/128.0).b; - vec3 out_col = vec3(0,0,0); - vec3 npos = normalize(-pos); - - // As of OSX 10.6.7 ATI Apple's crash when using a variable size loop - for (int i = 0; i < MAX_LIGHT_COUNT; ++i) - { - bool light_contrib = (i < light_count); - - vec3 lv = light[i].xyz-pos; - float dist2 = dot(lv,lv); - dist2 /= light[i].w; - if (dist2 > 1.0) - { - light_contrib = false; - } - - float da = dot(norm, lv); - if (da < 0.0) - { - light_contrib = false; - } - - if (light_contrib) - { - lv = normalize(lv); - da = dot(norm, lv); - - float fa = light_col[i].a+1.0; - float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= noise; - - float lit = da * dist_atten; - - vec3 col = light_col[i].rgb*lit*diff; - //vec3 col = vec3(dist2, light_col[i].a, lit); - - if (spec.a > 0.0) - { - //vec3 ref = dot(pos+lv, norm); - - float sa = dot(normalize(lv+npos),norm); - - if (sa > 0.0) - { - sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); - sa *= noise; - col += da*sa*light_col[i].rgb*spec.rgb; - } - } - - out_col += col; - } - } - - fcol += out_col; - ++wght; - } - } - - if (wght <= 0) - { - discard; - } - - gl_FragColor.rgb = fcol/samples; - gl_FragColor.a = 0.0; - - -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl deleted file mode 100644 index 10285817c2..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @file multiSpotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -//class 1 -- no shadows - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS diffuseRect; -uniform sampler2DMS specularRect; -uniform sampler2DMS depthMap; -uniform sampler2DMS normalMap; -uniform sampler2D noiseMap; -uniform sampler2D lightFunc; -uniform sampler2D projectionMap; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; -uniform float shadow_fade; - -varying vec4 vary_light; - -varying vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = tc-vec2(0.5); - - float det = max(1.0-lod/(proj_lod*0.5), 0.0); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - - -vec4 getPosition(ivec2 pos_screen, int sample) -{ - float depth = texelFetch(depthMap, pos_screen, sample).r; - vec2 sc = vec2(pos_screen.xy)*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - int wght = 0; - - vec3 fcol = vec3(0,0,0); - - vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; - - ivec2 itc = ivec2(frag.xy); - - for (int i = 0; i < samples; ++i) - { - vec3 pos = getPosition(itc, i).xyz; - vec3 lv = vary_light.xyz-pos.xyz; - float dist2 = dot(lv,lv); - dist2 /= vary_light.w; - if (dist2 <= 1.0) - { - vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; - - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z >= 0.0) - { - proj_tc.xyz /= proj_tc.w; - - float fa = gl_Color.a+1.0; - float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); - if (dist_atten > 0.0) - { - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 col = vec3(0,0,0); - - vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; - - float noise = texture2D(noiseMap, frag.xy/128.0).b; - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float lit = 0.0; - float amb_da = proj_ambiance; - - if (da > 0.0) - { - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; - - lit = da * dist_atten * noise; - - col = lcol*lit*diff_tex; - amb_da += (da*0.5)*proj_ambiance; - } - - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*proj_ambiance; - - amb_da *= dist_atten * noise; - - amb_da = min(amb_da, 1.0-lit); - - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; - } - - - vec4 spec = texelFetch(specularRect, itc, i); - if (spec.a > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc.xy /= stc.w; - - float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); - - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; - } - } - } - } - - fcol += col; - ++wght; - } - } - } - } - - if (wght <= 0) - { - discard; - } - - gl_FragColor.rgb = fcol/samples; - gl_FragColor.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl deleted file mode 100644 index cdce58c84e..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @file pointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS depthMap; -uniform sampler2DMS diffuseRect; -uniform sampler2DMS specularRect; -uniform sampler2DMS normalMap; -uniform sampler2D noiseMap; -uniform sampler2D lightFunc; - - -uniform vec3 env_mat[3]; -uniform float sun_wash; - -varying vec4 vary_light; - -varying vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; -uniform vec4 viewport; - -vec4 getPosition(ivec2 pos_screen, int sample) -{ - float depth = texelFetch(depthMap, pos_screen, sample).r; - vec2 sc = (vec2(pos_screen.xy)-viewport.xy)*2.0; - sc /= viewport.zw; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; - - ivec2 itc = ivec2(frag.xy); - - int wght = 0; - vec3 fcol = vec3(0,0,0); - - for (int s = 0; s < samples; ++s) - { - vec3 pos = getPosition(itc, s).xyz; - vec3 lv = vary_light.xyz-pos; - float dist2 = dot(lv,lv); - dist2 /= vary_light.w; - if (dist2 <= 1.0) - { - vec3 norm = texelFetch(normalMap, itc, s).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - float da = dot(norm, lv); - if (da >= 0.0) - { - norm = normalize(norm); - lv = normalize(lv); - da = dot(norm, lv); - - float noise = texture2D(noiseMap, frag.xy/128.0).b; - - vec3 col = texelFetch(diffuseRect, itc, s).rgb; - float fa = gl_Color.a+1.0; - float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); - float lit = da * dist_atten * noise; - - col = gl_Color.rgb*lit*col; - - vec4 spec = texelFetch(specularRect, itc, s); - if (spec.a > 0.0) - { - float sa = dot(normalize(lv-normalize(pos)),norm); - if (sa > 0.0) - { - sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); - sa *= noise; - col += da*sa*gl_Color.rgb*spec.rgb; - } - } - - fcol += col; - ++wght; - } - } - } - - if (wght <= 0) - { - discard; - } - - gl_FragColor.rgb = fcol/samples; - gl_FragColor.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl deleted file mode 100644 index 792102a64d..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @file postDeferredF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS diffuseRect; -uniform sampler2DMS edgeMap; -uniform sampler2DMS depthMap; -uniform sampler2DMS normalMap; -uniform sampler2D bloomMap; - -uniform float depth_cutoff; -uniform float norm_cutoff; -uniform float focal_distance; -uniform float blur_constant; -uniform float tan_pixel_angle; -uniform float magnification; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -varying vec2 vary_fragcoord; - -vec4 texture2DMS(sampler2DMS tex, ivec2 tc) -{ - vec4 ret = vec4(0,0,0,0); - for (int i = 0; i < samples; ++i) - { - ret += texelFetch(tex, tc, i); - } - - return ret/samples; -} - -float getDepth(ivec2 pos_screen) -{ - float z = texture2DMS(depthMap, pos_screen.xy).r; - z = z*2.0-1.0; - vec4 ndc = vec4(0.0, 0.0, z, 1.0); - vec4 p = inv_proj*ndc; - return p.z/p.w; -} - -float calc_cof(float depth) -{ - float sc = abs(depth-focal_distance)/-depth*blur_constant; - - sc /= magnification; - - // tan_pixel_angle = pixel_length/-depth; - float pixel_length = tan_pixel_angle*-focal_distance; - - sc = sc/pixel_length; - sc *= 1.414; - - return sc; -} - -void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ivec2 tc) -{ - float d = getDepth(tc); - - float sc = calc_cof(d); - - if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius - || d < cur_depth) //sampled pixel is further away than current pixel - { - float wg = 0.25; - - vec4 s = texture2DMS(diffuseRect, tc); - // de-weight dull areas to make highlights 'pop' - wg += s.r+s.g+s.b; - - diff += wg*s; - - w += wg; - } -} - - -void main() -{ - ivec2 itc = ivec2(vary_fragcoord.xy); - - vec3 norm = texture2DMS(normalMap, itc).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - - float depth = getDepth(itc); - - vec4 diff = texture2DMS(diffuseRect, itc); - - { - float w = 1.0; - - float sc = calc_cof(depth); - sc = min(abs(sc), 10.0); - - float fd = depth*0.5f; - - float PI = 3.14159265358979323846264; - - int isc = int(sc); - - // sample quite uniformly spaced points within a circle, for a circular 'bokeh' - //if (depth < focal_distance) - { - for (int x = -isc; x <= isc; x+=2) - { - for (int y = -isc; y <= isc; y+=2) - { - ivec2 cur_samp = ivec2(x,y); - float cur_sc = length(vec2(cur_samp)); - if (cur_sc < sc) - { - dofSample(diff, w, cur_sc, depth, itc+cur_samp); - } - } - } - } - - diff /= w; - } - - vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor = diff + bloom; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl deleted file mode 100644 index 41849858e7..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file postDeferredF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS diffuseRect; -uniform sampler2D bloomMap; - -uniform vec2 screen_res; -varying vec2 vary_fragcoord; - -vec4 texture2DMS(sampler2DMS tex, ivec2 tc) -{ - vec4 ret = vec4(0,0,0,0); - - for (int i = 0; i < samples; ++i) - { - ret += texelFetch(tex,tc,i); - } - - return ret/samples; -} - -void main() -{ - vec4 diff = texture2DMS(diffuseRect, ivec2(vary_fragcoord.xy)); - - vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor = diff + bloom; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl new file mode 100644 index 0000000000..b519dbc4b0 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl @@ -0,0 +1,41 @@ +/** + * @file postDeferredNoDoFF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect diffuseRect; +uniform sampler2D bloomMap; + +uniform vec2 screen_res; +varying vec2 vary_fragcoord; + +void main() +{ + vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + + vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); + gl_FragColor = diff + bloom; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl new file mode 100644 index 0000000000..861bb9f735 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl @@ -0,0 +1,153 @@ +/** + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect diffuseRect; +uniform sampler2DRect edgeMap; +uniform sampler2DRect depthMap; +uniform sampler2DRect normalMap; +uniform sampler2D bloomMap; + +uniform float depth_cutoff; +uniform float norm_cutoff; +uniform float focal_distance; +uniform float blur_constant; +uniform float tan_pixel_angle; +uniform float magnification; + +uniform mat4 inv_proj; +uniform vec2 screen_res; + +varying vec2 vary_fragcoord; + +float getDepth(vec2 pos_screen) +{ + float z = texture2DRect(depthMap, pos_screen.xy).r; + z = z*2.0-1.0; + vec4 ndc = vec4(0.0, 0.0, z, 1.0); + vec4 p = inv_proj*ndc; + return p.z/p.w; +} + +float calc_cof(float depth) +{ + float sc = abs(depth-focal_distance)/-depth*blur_constant; + + sc /= magnification; + + // tan_pixel_angle = pixel_length/-depth; + float pixel_length = tan_pixel_angle*-focal_distance; + + sc = sc/pixel_length; + sc *= 1.414; + + return sc; +} + +void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc) +{ + float d = getDepth(tc); + + float sc = calc_cof(d); + + float wg = 0.25; + + vec4 s = texture2DRect(diffuseRect, tc); + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; + + diff += wg*s; + + w += wg; +} + +void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, vec2 tc) +{ + float d = getDepth(tc); + + float sc = calc_cof(d); + + if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius + || d < cur_depth) //sampled pixel is further away than current pixel + { + float wg = 0.25; + + vec4 s = texture2DRect(diffuseRect, tc); + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; + + diff += wg*s; + + w += wg; + } +} + + +void main() +{ + vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; + norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm + + vec2 tc = vary_fragcoord.xy; + + float depth = getDepth(tc); + + vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + + { + float w = 1.0; + + float sc = calc_cof(depth); + sc = min(abs(sc), 10.0); + + float fd = depth*0.5f; + + float PI = 3.14159265358979323846264; + + // sample quite uniformly spaced points within a circle, for a circular 'bokeh' + //if (depth < focal_distance) + { + while (sc > 0.5) + { + int its = int(max(1.0,(sc*3.7))); + for (int i=0; i max_y.x) P *= (max_y.x / P.y); - if (P.y < -max_y.x) P *= (-max_y.x / P.y); - - vec3 tmpLightnorm = lightnorm.xyz; - - vec3 Pn = normalize(P); - float Plen = length(P); - - vec4 temp1 = vec4(0); - vec3 temp2 = vec3(0); - vec4 blue_weight; - vec4 haze_weight; - vec4 sunlight = sunlight_color; - vec4 light_atten; - - //sunlight attenuation effect (hue and brightness) due to atmosphere - //this is used later for sunlight modulation at various altitudes - light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); - //I had thought blue_density and haze_density should have equal weighting, - //but attenuation due to haze_density tends to seem too strong - - temp1 = blue_density + vec4(haze_density.r); - blue_weight = blue_density / temp1; - haze_weight = vec4(haze_density.r) / temp1; - - //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) - temp2.y = max(0.0, tmpLightnorm.y); - temp2.y = 1. / temp2.y; - sunlight *= exp( - light_atten * temp2.y); - - // main atmospheric scattering line integral - temp2.z = Plen * density_multiplier.x; - - // Transparency (-> temp1) - // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati - // compiler gets confused. - temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); - - //final atmosphere attenuation factor - setAtmosAttenuation(temp1.rgb); - - //compute haze glow - //(can use temp2.x as temp because we haven't used it yet) - temp2.x = dot(Pn, tmpLightnorm.xyz); - temp2.x = 1. - temp2.x; - //temp2.x is 0 at the sun and increases away from sun - temp2.x = max(temp2.x, .03); //was glow.y - //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - temp2.x *= glow.x; - //higher glow.x gives dimmer glow (because next step is 1 / "angle") - temp2.x = pow(temp2.x, glow.z); - //glow.z should be negative, so we're doing a sort of (1 / "angle") function - - //add "minimum anti-solar illumination" - temp2.x += .25; - - //increase ambient when there are more clouds - vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; - - /* decrease value and saturation (that in HSV, not HSL) for occluded areas - * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html - * // The following line of code performs the equivalent of: - * float ambAlpha = tmpAmbient.a; - * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis - * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); - * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); - */ - tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); - - //haze color - setAdditiveColor( - vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) - + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x - + tmpAmbient))); - - //brightness of surface both sunlight and ambient - setSunlitColor(vec3(sunlight * .5)); - setAmblitColor(vec3(tmpAmbient * .25)); - setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); -} - -vec3 atmosLighting(vec3 light) -{ - light *= getAtmosAttenuation().r; - light += getAdditiveColor(); - return (2.0 * light); -} - -vec3 atmosTransport(vec3 light) { - light *= getAtmosAttenuation().r; - light += getAdditiveColor() * 2.0; - return light; -} -vec3 atmosGetDiffuseSunlightColor() -{ - return getSunlitColor(); -} - -vec3 scaleDownLight(vec3 light) -{ - return (light / scene_light_strength ); -} - -vec3 scaleUpLight(vec3 light) -{ - return (light * scene_light_strength); -} - -vec3 atmosAmbient(vec3 light) -{ - return getAmblitColor() + light / 2.0; -} - -vec3 atmosAffectDirectionalLight(float lightIntensity) -{ - return getSunlitColor() * lightIntensity; -} - -vec3 scaleSoftClip(vec3 light) -{ - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} - -vec4 texture2DMS(sampler2DMS tex, ivec2 tc) -{ - vec4 ret = vec4(0,0,0,0); - - for (int i = 0; i < samples; ++i) - { - ret += texelFetch(tex,tc,i); - } - - return ret/samples; -} - -void main() -{ - vec2 tc = vary_fragcoord.xy; - ivec2 itc = ivec2(tc); - - vec4 fcol = vec4(0,0,0,0); - - for (int i = 0; i < samples; ++i) - { - float depth = texelFetch(depthMap, itc, i).r; - vec3 pos = getPosition_d(tc, depth).xyz; - vec3 norm = texelFetch(normalMap, itc, i).xyz; - - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; - - float da = max(dot(norm.xyz, vary_light.xyz), 0.0); - - vec4 diffuse = texelFetch(diffuseRect, itc, i); - vec3 col; - float bloom = 0.0; - - if (diffuse.a < 0.9) - { - vec4 spec = texelFetch(specularRect, itc, i); - - calcAtmospherics(pos.xyz, 1.0); - - col = atmosAmbient(vec3(0)); - col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a)); - - col *= diffuse.rgb; - - if (spec.a > 0.0) // specular reflection - { - // the old infinite-sky shiny reflection - // - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float sa = dot(refnormpersp, vary_light.xyz); - vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a; - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib); - col += spec_contrib; - } - - col = atmosLighting(col); - col = scaleSoftClip(col); - col = mix(col, diffuse.rgb, diffuse.a); - } - else - { - col = diffuse.rgb; - } - - fcol += vec4(col, bloom); - } - - gl_FragColor = fcol/samples; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl deleted file mode 100644 index 0c0171881f..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl +++ /dev/null @@ -1,252 +0,0 @@ -/** - * @file multiSpotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -//class 1 -- no shadows - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -uniform sampler2DMS diffuseRect; -uniform sampler2DMS specularRect; -uniform sampler2DMS depthMap; -uniform sampler2DMS normalMap; -uniform sampler2D noiseMap; -uniform sampler2D lightFunc; -uniform sampler2D projectionMap; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; -uniform int proj_shadow_idx; -uniform float shadow_fade; - -varying vec4 vary_light; - -varying vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = tc-vec2(0.5); - - float det = max(1.0-lod/(proj_lod*0.5), 0.0); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - - -vec4 getPosition(ivec2 pos_screen, int sample) -{ - float depth = texelFetch(depthMap, pos_screen, sample).r; - vec2 sc = vec2(pos_screen.xy)*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; - ivec2 itc = ivec2(frag.xy); - - vec3 fcol = vec3(0,0,0); - int wght = 0; - - for (int i = 0; i < samples; ++i) - { - vec3 pos = getPosition(itc, i).xyz; - vec3 lv = vary_light.xyz-pos.xyz; - float dist2 = dot(lv,lv); - dist2 /= vary_light.w; - if (dist2 <= 1.0) - { - vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0; - - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z >= 0.0) - { - proj_tc.xyz /= proj_tc.w; - - float fa = gl_Color.a+1.0; - float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); - if (dist_atten > 0.0) - { - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 col = vec3(0,0,0); - - vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb; - - float noise = texture2D(noiseMap, frag.xy/128.0).b; - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float lit = 0.0; - float amb_da = proj_ambiance; - - if (da > 0.0) - { - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; - - lit = da * dist_atten * noise; - - col = lcol*lit*diff_tex; - amb_da += (da*0.5)*proj_ambiance; - } - - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*proj_ambiance; - - amb_da *= dist_atten * noise; - - amb_da = min(amb_da, 1.0-lit); - - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; - } - - - vec4 spec = texelFetch(specularRect, itc, i); - if (spec.a > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc.xy /= stc.w; - - float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0); - - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb; - } - } - } - } - - fcol += col; - ++wght; - } - } - } - } - - if (wght <= 0) - { - discard; - } - - gl_FragColor.rgb = fcol/samples; - gl_FragColor.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl deleted file mode 100644 index 78ea15e87a..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -//class 1, no shadow, no SSAO, should never be called - -#extension GL_ARB_texture_rectangle : enable - -void main() -{ - gl_FragColor = vec4(0,0,0,0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl deleted file mode 100644 index abb64334ed..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl +++ /dev/null @@ -1,140 +0,0 @@ -/** - * @file sunLightSSAOF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_texture_multisample : enable - -//class 1 -- no shadow, SSAO only - -uniform sampler2DMS depthMap; -uniform sampler2DMS normalMap; -uniform sampler2D noiseMap; - - -// Inputs -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; -uniform float ssao_radius; -uniform float ssao_max_radius; -uniform float ssao_factor; -uniform float ssao_factor_inv; - -varying vec2 vary_fragcoord; -varying vec4 vary_light; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -uniform float shadow_bias; -uniform float shadow_offset; - -vec4 getPosition(ivec2 pos_screen, int sample) -{ - float depth = texelFetch(depthMap, pos_screen, sample).r; - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -//calculate decreases in ambient lighting when crowded out (SSAO) -float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample) -{ - float ret = 1.0; - - vec2 kern[8]; - // exponentially (^2) distant occlusion samples spread around origin - kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; - kern[1] = vec2(1.0, 0.0) * 0.250*0.250; - kern[2] = vec2(0.0, 1.0) * 0.375*0.375; - kern[3] = vec2(0.0, -1.0) * 0.500*0.500; - kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; - kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; - kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; - kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; - - vec2 pos_screen = vary_fragcoord.xy; - vec3 pos_world = pos.xyz; - vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; - - float angle_hidden = 0.0; - int points = 0; - - float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - - // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?) - for (int i = 0; i < 8; i++) - { - ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect)); - vec3 samppos_world = getPosition(samppos_screen, sample).xyz; - - vec3 diff = pos_world - samppos_world; - float dist2 = dot(diff, diff); - - // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area - // --> solid angle shrinking by the square of distance - //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 - //(k should vary inversely with # of samples, but this is taken care of later) - - angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); - - // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" - points = points + int(diff.z > -1.0); - } - - angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); - - ret = (1.0 - (float(points != 0) * angle_hidden)); - - return min(ret, 1.0); -} - -void main() -{ - vec2 pos_screen = vary_fragcoord.xy; - ivec2 itc = ivec2(pos_screen); - - float col = 0; - - for (int i = 0; i < samples; i++) - { - vec4 pos = getPosition(itc, i); - vec3 norm = texelFetch(normalMap, itc, i).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - col += calcAmbientOcclusion(pos,norm,i); - } - - col /= samples; - - gl_FragColor[0] = 1.0; - gl_FragColor[1] = col; - gl_FragColor[2] = 1.0; - gl_FragColor[3] = 1.0; -} diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 9fac986bf1..917462c1ee 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1159,8 +1159,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL success = TRUE; - U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); - bool multisample = samples > 1 && gGLManager.mHasTextureMultisample; + U32 samples = gSavedSettings.getU32("RenderFSAASamples"); + bool multisample = samples > 1; if (success) { @@ -1295,84 +1295,41 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() } if (success) - { - std::string fragment; - - if (multisample) - { - fragment = "deferred/pointLightMSF.glsl"; - } - else - { - fragment = "deferred/pointLightF.glsl"; - } - + { gDeferredLightProgram.mName = "Deferred Light Shader"; gDeferredLightProgram.mShaderFiles.clear(); gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredLightProgram.createShader(NULL, NULL); } if (success) { - std::string fragment; - if (multisample) - { - fragment = "deferred/multiPointLightMSF.glsl"; - } - else - { - fragment = "deferred/multiPointLightF.glsl"; - } - gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader"; gDeferredMultiLightProgram.mShaderFiles.clear(); gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredMultiLightProgram.createShader(NULL, NULL); } if (success) { - std::string fragment; - - if (multisample) - { - fragment = "deferred/spotLightMSF.glsl"; - } - else - { - fragment = "deferred/multiSpotLightF.glsl"; - } - gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader"; gDeferredSpotLightProgram.mShaderFiles.clear(); gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredSpotLightProgram.createShader(NULL, NULL); } if (success) { - std::string fragment; - - if (multisample) - { - fragment = "deferred/multiSpotLightMSF.glsl"; - } - else - { - fragment = "deferred/multiSpotLightF.glsl"; - } - gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader"; gDeferredMultiSpotLightProgram.mShaderFiles.clear(); gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL); } @@ -1383,25 +1340,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (gSavedSettings.getBOOL("RenderDeferredSSAO")) { - if (multisample) - { - fragment = "deferred/sunLightSSAOMSF.glsl"; - } - else - { - fragment = "deferred/sunLightSSAOF.glsl"; - } + fragment = "deferred/sunLightSSAOF.glsl"; } else { - if (multisample) - { - fragment = "deferred/sunLightMSF.glsl"; - } - else - { - fragment = "deferred/sunLightF.glsl"; - } + fragment = "deferred/sunLightF.glsl"; } gDeferredSunProgram.mName = "Deferred Sun Shader"; @@ -1414,21 +1357,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { - std::string fragment; - - if (multisample) - { - fragment = "deferred/blurLightMSF.glsl"; - } - else - { - fragment = "deferred/blurLightF.glsl"; - } - gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader"; gDeferredBlurLightProgram.mShaderFiles.clear(); gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredBlurLightProgram.createShader(NULL, NULL); } @@ -1516,21 +1448,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { - std::string fragment; - - if (multisample) - { - fragment = "deferred/softenLightMSF.glsl"; - } - else - { - fragment = "deferred/softenLightF.glsl"; - } - gDeferredSoftenProgram.mName = "Deferred Soften Shader"; gDeferredSoftenProgram.mShaderFiles.clear(); gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredSoftenProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; @@ -1627,11 +1548,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() std::string fragment; if (multisample) { - fragment = "deferred/postDeferredMSF.glsl"; + fragment = "deferred/postDeferredF.glsl"; } else { - fragment = "deferred/postDeferredF.glsl"; + fragment = "deferred/postDeferredNoFXAAF.glsl"; } gDeferredPostProgram.mName = "Deferred Post Shader"; @@ -1647,11 +1568,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() std::string fragment; if (multisample) { - fragment = "deferred/postDeferredNoDoFMSF.glsl"; + fragment = "deferred/postDeferredNoDoFF.glsl"; } else { - fragment = "deferred/postDeferredNoDoFF.glsl"; + fragment = "deferred/postDeferredNoDoFNoFXAAF.glsl"; } gDeferredPostNoDoFProgram.mName = "Deferred Post Shader"; @@ -1700,20 +1621,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { if (success) { - std::string fragment; - if (multisample) - { - fragment = "deferred/edgeMSF.glsl"; - } - else - { - fragment = "deferred/edgeF.glsl"; - } - gDeferredEdgeProgram.mName = "Deferred Edge Shader"; gDeferredEdgeProgram.mShaderFiles.clear(); gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredEdgeProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB)); + gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredEdgeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredEdgeProgram.createShader(NULL, NULL); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8d5bc22e6f..d9fa4881e7 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -592,11 +592,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); - if (gGLManager.mIsATI) - { //ATI doesn't like the way we use multisample texture - samples = 0; - } - //try to allocate screen buffers at requested resolution and samples // - on failure, shrink number of samples and try again // - if not multisampled, shrink resolution and try again (favor X resolution over Y) @@ -673,7 +668,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (!addDeferredAttachments(mDeferredScreen)) return false; if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; - if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false; + if (samples > 0) + { + if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false; + } + else + { + mFXAABuffer.release(); + } #if LL_DARWIN // As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO @@ -6322,6 +6324,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (LLPipeline::sRenderDeferred) { bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater(); + bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 1; + + if (multisample) { //bake out texture2D with RGBL for FXAA shader mFXAABuffer.bindTarget(); @@ -6344,8 +6349,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGlowCombineFXAAProgram.unbind(); mFXAABuffer.flush(); - gViewerWindow->setup3DViewport(); } + + gViewerWindow->setup3DViewport(); LLGLSLShader* shader = &gDeferredPostProgram; if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2) @@ -6358,8 +6364,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader = &gDeferredPostNoDoFProgram; dof_enabled = false; } - - + LLGLDisable blend(GL_BLEND); bindDeferredShader(*shader); @@ -6485,12 +6490,24 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f("magnification", magnification); } - S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); - if (channel > -1) + if (multisample) { - mFXAABuffer.bindTexture(0, channel); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); + if (channel > -1) + { + mFXAABuffer.bindTexture(0, channel); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + } } + else + { + S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); + if (channel > -1) + { + mScreen.bindTexture(0, channel); + } + } + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); -- cgit v1.2.3 From 34a620523a7f4511c8f008f2e9a9428f41281480 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 29 Aug 2011 13:27:17 -0500 Subject: a better way to inject key events. --- indra/newview/llwindowlistener.cpp | 27 ++++++++++++++++++++++----- indra/newview/llwindowlistener.h | 6 +++--- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 3d756ef9b9..4cadc8773d 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -35,10 +35,11 @@ #include "llui.h" #include "llview.h" #include "llviewerwindow.h" +#include "llviewerkeyboard.h" #include "llrootview.h" #include -LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter) +LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter) : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), mWindow(window), mKbGetter(kbgetter) @@ -195,7 +196,8 @@ void LLWindowListener::keyDown(LLSD const & evt) gFocusMgr.setKeyboardFocus(target_view); KEY key = getKEY(evt); MASK mask = getMask(evt); - if (!target_view->handleKey(key, mask, true)) target_view->handleUnicodeChar(key, true); + gViewerKeyboard.handleKey(key, mask, false); + if(key < 0x80) mWindow->handleUnicodeChar(key, mask); } else { @@ -210,9 +212,24 @@ void LLWindowListener::keyDown(LLSD const & evt) void LLWindowListener::keyUp(LLSD const & evt) { - if (evt.has("path")) return; // LLView only handles key down. - - mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); + if (evt.has("path")) + { + LLView * target_view = + LLUI::resolvePath(gViewerWindow->getRootView(), evt["path"]); + if ((target_view != 0) && target_view->isAvailable()) + { + gFocusMgr.setKeyboardFocus(target_view); + mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); + } + else + { + ; // TODO: Don't silently fail if target not available. + } + } + else + { + mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); + } } // for WhichButton diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h index 74e577ff93..26adff35ff 100644 --- a/indra/newview/llwindowlistener.h +++ b/indra/newview/llwindowlistener.h @@ -31,13 +31,13 @@ #include class LLKeyboard; -class LLWindowCallbacks; +class LLViewerWindow; class LLWindowListener : public LLEventAPI { public: typedef boost::function KeyboardGetter; - LLWindowListener(LLWindowCallbacks * window, const KeyboardGetter& kbgetter); + LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter); void keyDown(LLSD const & evt); void keyUp(LLSD const & evt); @@ -47,7 +47,7 @@ public: void mouseScroll(LLSD const & evt); private: - LLWindowCallbacks * mWindow; + LLViewerWindow * mWindow; KeyboardGetter mKbGetter; }; -- cgit v1.2.3 From f08d7fba9f2134a687169d8da478a44bdbe16955 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 29 Aug 2011 15:57:32 -0400 Subject: CHOP-763: Implement widget-pathname-based routing for mouse events. Send mouseDown(), mouseUp(), mouseMove() through static mouseEvent() helper function. Process new optional ["path"] param, validating corresponding LLView and capturing certain information about it for caller. Synthesize (x, y) pos if need be. Use LLView::TemporaryDrilldownFunc and llview::TargetEvent to temporarily hijack normal LLView mouse-event propagation. Define Response helper class to capture LLSD blob about the current request and ensure it gets sent on return. --- indra/newview/llwindowlistener.cpp | 199 ++++++++++++++++++++++++++++++++++--- 1 file changed, 183 insertions(+), 16 deletions(-) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 4cadc8773d..84126b7738 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -34,10 +34,19 @@ #include "llwindowcallbacks.h" #include "llui.h" #include "llview.h" +#include "llviewinject.h" #include "llviewerwindow.h" #include "llviewerkeyboard.h" #include "llrootview.h" +#include "llsdutil.h" +#include "stringize.h" +#include #include +#include +#include +#include + +namespace bll = boost::lambda; LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter) : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), @@ -233,12 +242,12 @@ void LLWindowListener::keyUp(LLSD const & evt) } // for WhichButton -typedef BOOL (LLWindowCallbacks::*MouseFunc)(LLWindow *, LLCoordGL, MASK); +typedef BOOL (LLWindowCallbacks::*MouseMethod)(LLWindow *, LLCoordGL, MASK); struct Actions { - Actions(const MouseFunc& d, const MouseFunc& u): down(d), up(u), valid(true) {} + Actions(const MouseMethod& d, const MouseMethod& u): down(d), up(u), valid(true) {} Actions(): valid(false) {} - MouseFunc down, up; + MouseMethod down, up; bool valid; }; @@ -256,38 +265,196 @@ struct WhichButton: public StringLookup }; static WhichButton buttons; -static LLCoordGL getPos(const LLSD& event) +struct Response +{ + Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey="reply"): + mResp(seed), + mReq(request), + mKey(replyKey) + {} + + ~Response() + { + // When you instantiate a stack Response object, if the original + // request requested a reply, send it when we leave this block, no + // matter how. + sendReply(mResp, mReq, mKey); + } + + void warn(const std::string& warning) + { + LL_WARNS("LLWindowListener") << warning << LL_ENDL; + mResp["warnings"].append(warning); + } + + void error(const std::string& error) + { + // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut + // down altogether. + LL_WARNS("LLWindowListener") << error << LL_ENDL; + + mResp["error"] = error; + } + + // set other keys... + LLSD& operator[](const LLSD::String& key) { return mResp[key]; } + + LLSD mResp, mReq; + LLSD::String mKey; +}; + +typedef boost::function MouseFunc; + +static void mouseEvent(const MouseFunc& func, const LLSD& request) { - return LLCoordGL(event["x"].asInteger(), event["y"].asInteger()); + // Ensure we send response + Response response(LLSD(), request); + // We haven't yet established whether the incoming request has "x" and "y", + // but capture this anyway, with 0 for omitted values. + LLCoordGL pos(request["x"].asInteger(), request["y"].asInteger()); + bool has_pos(request.has("x") && request.has("y")); + + boost::scoped_ptr tempfunc; + + // Documentation for mouseDown(), mouseUp() and mouseMove() claims you + // must either specify ["path"], or both of ["x"] and ["y"]. You MAY + // specify all. Let's say that passing "path" as an empty string is + // equivalent to not passing it at all. + std::string path(request["path"]); + if (path.empty()) + { + // Without "path", you must specify both "x" and "y". + if (! has_pos) + { + return response.error(STRINGIZE(request["op"].asString() << " request " + "without \"path\" must specify both \"x\" and \"y\": " + << request)); + } + } + else // ! path.empty() + { + LLView* root = LLUI::getRootView(); + LLView* target = LLUI::resolvePath(root, path); + if (! target) + { + return response.error(STRINGIZE(request["op"].asString() << " request " + "specified invalid \"path\": '" << path << "'")); + return; + } + + // Get info about this LLView* for when we send response. + response["path"] = target->getPathname(); + response["class"] = typeid(*target).name(); + bool visible_chain(target->isInVisibleChain()); + bool enabled_chain(target->isInEnabledChain()); + response["visible"] = target->getVisible(); + response["visible_chain"] = visible_chain; + response["enabled"] = target->getEnabled(); + response["enabled_chain"] = enabled_chain; + response["available"] = target->isAvailable(); + // Don't show caller the LLView's own relative rectangle; that only + // tells its dimensions. Provide actual location on screen. + LLRect rect(target->calcScreenRect()); + response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop)("right", rect.mRight)("bottom", rect.mBottom); + + // The intent of this test is to prevent trying to drill down to a + // widget in a hidden floater, or on a tab that's not current, etc. + if (! visible_chain) + { + return response.error(STRINGIZE(request["op"].asString() << " request " + "specified \"path\" not currently visible: '" + << path << "'")); + } + + // This test isn't folded in with the above error case since you can + // (e.g.) pop up a tooltip even for a disabled widget. + if (! enabled_chain) + { + response.warn(STRINGIZE(request["op"].asString() << " request " + "specified \"path\" not currently enabled: '" + << path << "'")); + } + + if (! has_pos) + { + pos.set(rect.getCenterX(), rect.getCenterY()); + // nonstandard warning tactic: probably usual case; we want event + // sender to know synthesized (x, y), but maybe don't need to log? + response["warnings"].append(STRINGIZE("using center point (" + << pos.mX << ", " << pos.mY << ")")); + } + + // recursive childFromPoint() should give us the frontmost, leafmost + // widget at the specified (x, y). + LLView* frontmost = root->childFromPoint(pos.mX, pos.mY, true); + if (frontmost != target) + { + response.warn(STRINGIZE(request["op"].asString() << " request " + "specified \"path\" = '" << path + << "', but frontmost LLView at (" << pos.mX << ", " << pos.mY + << ") is '" << frontmost->getPathname() << "'")); + } + + // Instantiate a TemporaryDrilldownFunc to route incoming mouse events + // to the target LLView*. But put it on the heap since "path" is + // optional. Nonetheless, manage it with a boost::scoped_ptr so it + // will be destroyed when we leave. + tempfunc.reset(new LLView::TemporaryDrilldownFunc(llview::TargetEvent(target))); + } + + // The question of whether the requested LLView actually handled the + // specified event is important enough, and its handling unclear enough, + // to warrant a separate response attribute. Instead of deciding here to + // make it a warning, or an error, let caller decide. + response["handled"] = func(pos, getMask(request)); + + // On exiting this scope, response will send, tempfunc will restore the + // normal pointInView(x, y) containment logic, etc. } -void LLWindowListener::mouseDown(LLSD const & evt) +void LLWindowListener::mouseDown(LLSD const & request) { - Actions actions(buttons.lookup(evt["button"])); + Actions actions(buttons.lookup(request["button"])); if (actions.valid) { - (mWindow->*(actions.down))(NULL, getPos(evt), getMask(evt)); + // Normally you can pass NULL to an LLWindow* without compiler + // complaint, but going through boost::lambda::bind() evidently + // bypasses that special case: it only knows you're trying to pass an + // int to a pointer. Explicitly cast NULL to the desired pointer type. + mouseEvent(bll::bind(actions.down, mWindow, + static_cast(NULL), bll::_1, bll::_2), + request); } } -void LLWindowListener::mouseUp(LLSD const & evt) +void LLWindowListener::mouseUp(LLSD const & request) { - Actions actions(buttons.lookup(evt["button"])); + Actions actions(buttons.lookup(request["button"])); if (actions.valid) { - (mWindow->*(actions.up))(NULL, getPos(evt), getMask(evt)); + mouseEvent(bll::bind(actions.up, mWindow, + static_cast(NULL), bll::_1, bll::_2), + request); } } -void LLWindowListener::mouseMove(LLSD const & evt) +void LLWindowListener::mouseMove(LLSD const & request) { - mWindow->handleMouseMove(NULL, getPos(evt), getMask(evt)); + // We want to call the same central mouseEvent() routine for + // handleMouseMove() as for button clicks. But handleMouseMove() returns + // void, whereas mouseEvent() accepts a function returning bool -- and + // uses that bool return. Use (void-lambda-expression, true) to construct + // a callable that returns bool anyway. Pass 'true' because we expect that + // our caller will usually treat 'false' as a problem. + mouseEvent((bll::bind(&LLWindowCallbacks::handleMouseMove, mWindow, + static_cast(NULL), bll::_1, bll::_2), + true), + request); } -void LLWindowListener::mouseScroll(LLSD const & evt) +void LLWindowListener::mouseScroll(LLSD const & request) { - S32 clicks = evt["clicks"].asInteger(); + S32 clicks = request["clicks"].asInteger(); mWindow->handleScrollWheel(NULL, clicks); } - -- cgit v1.2.3 From 5fb224bb8196e77259bef2a0ef60e82533c358a2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 09:52:25 -0400 Subject: CHOP-763: make sendReply() treat replyKey as optional. It's not worth bothering to tweak reply LLSD or attempt to send it if the incoming request has no replyKey, in effect not requesting a reply. This supports LLEventAPI operations for which the caller might or might not care about a reply, invoked using either send() (fire and forget) or request() (send request, wait for response). This logic should be central, instead of having to perform that test in every caller that cares. The major alternative would have been to treat missing replyKey as an error (whether LL_ERRS or exception). But since there's already a mechanism by which an LLEventAPI operation method can stipulate its replyKey as required, at this level we can let it be optional. --- indra/llcommon/llevents.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index ff03506e84..db1ea4792b 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -591,6 +591,17 @@ void LLReqID::stamp(LLSD& response) const bool sendReply(const LLSD& reply, const LLSD& request, const std::string& replyKey) { + // If the original request has no value for replyKey, it's pointless to + // construct or send a reply event: on which LLEventPump should we send + // it? Allow that to be optional: if the caller wants to require replyKey, + // it can so specify when registering the operation method. + if (! request.has(replyKey)) + { + return false; + } + + // Here the request definitely contains replyKey; reasonable to proceed. + // Copy 'reply' to modify it. LLSD newreply(reply); // Get the ["reqid"] element from request -- cgit v1.2.3 From 6e8ba7e1179c0ac8c3a085e010992ea91fb15114 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 09:53:43 -0400 Subject: CHOP-763: Introduce LLView::getPathname(). --- indra/llui/llview.cpp | 19 +++++++++++++++++++ indra/llui/llview.h | 1 + 2 files changed, 20 insertions(+) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 56b09791a4..474b568a87 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -31,6 +31,7 @@ #include "llview.h" #include +#include #include #include #include @@ -430,6 +431,24 @@ BOOL LLView::isInEnabledChain() const return enabled; } +static void buildPathname(std::ostream& out, const LLView* view) +{ + if (view) + { + // While we're not yet at root level, keep recurring towards top + buildPathname(out, view->getParent()); + } + // Build pathname into ostream on the way back from recursion. + out << '/' << view->getName(); +} + +std::string LLView::getPathname() const +{ + std::ostringstream out; + buildPathname(out, this); + return out.str(); +} + // virtual BOOL LLView::canFocusChildren() const { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 67634938fb..11f25bcd7f 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -444,6 +444,7 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); + std::string getPathname() const; template T* findChild(const std::string& name, BOOL recurse = TRUE) const { -- cgit v1.2.3 From 12dbf4c7b4a7bf64acaa7207c8bceffb64f021b3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 11:30:51 -0400 Subject: CHOP-763: Add Windows magic precompiled header #include. --- indra/newview/llwindowlistener.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 84126b7738..8d794e5380 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -24,6 +24,7 @@ * $/LicenseInfo$ */ +#include "llviewerprecompiledheaders.h" #include "linden_common.h" #include "llwindowlistener.h" -- cgit v1.2.3 From f08de06bf223c9876bd7495e36f61b19022938a7 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 30 Aug 2011 13:30:18 -0500 Subject: fix crash bug; exclude root from path. --- indra/llui/llview.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 474b568a87..0c8e3bace4 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -433,13 +433,20 @@ BOOL LLView::isInEnabledChain() const static void buildPathname(std::ostream& out, const LLView* view) { - if (view) + if (view == 0) return; + + if (view->getParent() != 0) { - // While we're not yet at root level, keep recurring towards top buildPathname(out, view->getParent()); + + // Build pathname into ostream on the way back from recursion. + out << '/' << view->getName(); } - // Build pathname into ostream on the way back from recursion. - out << '/' << view->getName(); + else + { + ; // Don't include root in the path. + } + } std::string LLView::getPathname() const -- cgit v1.2.3 From 713aa42f61d6d5791b26f56a73bd7cf7abb76f0d Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 30 Aug 2011 13:37:10 -0500 Subject: add responses to key events. --- indra/newview/llwindowlistener.cpp | 142 ++++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 57 deletions(-) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 8d794e5380..84a490f661 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -134,6 +134,57 @@ protected: namespace { +class Response +{ +public: + Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey="reply"): + mResp(seed), + mReq(request), + mKey(replyKey) + {} + + ~Response() + { + // When you instantiate a stack Response object, if the original + // request requested a reply, send it when we leave this block, no + // matter how. + sendReply(mResp, mReq, mKey); + } + + void warn(const std::string& warning) + { + LL_WARNS("LLWindowListener") << warning << LL_ENDL; + mResp["warnings"].append(warning); + } + + void error(const std::string& error) + { + // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut + // down altogether. + LL_WARNS("LLWindowListener") << error << LL_ENDL; + + mResp["error"] = error; + } + + // set other keys... + LLSD& operator[](const LLSD::String& key) { return mResp[key]; } + + LLSD mResp, mReq; + LLSD::String mKey; +}; + +void insertViewInformation(Response & response, LLView * target) +{ + // Get info about this LLView* for when we send response. + response["path"] = target->getPathname(); + response["class"] = typeid(*target).name(); + response["visible"] = target->getVisible(); + response["visible_chain"] = target->isInVisibleChain(); + response["enabled"] = target->getEnabled(); + response["enabled_chain"] = target->isInEnabledChain(); + response["available"] = target->isAvailable(); +} + // helper for getMask() MASK lookupMask_(const std::string& maskname) { @@ -197,12 +248,22 @@ KEY getKEY(const LLSD& event) void LLWindowListener::keyDown(LLSD const & evt) { + Response response(LLSD(), evt); + if (evt.has("path")) { + std::string path(evt["path"]); LLView * target_view = - LLUI::resolvePath(gViewerWindow->getRootView(), evt["path"]); - if ((target_view != 0) && target_view->isAvailable()) + LLUI::resolvePath(gViewerWindow->getRootView(), path); + if (target_view == 0) + { + response.error(STRINGIZE(evt["op"].asString() << " request " + "specified invalid \"path\": '" << path << "'")); + } + else if(target_view->isAvailable()) { + insertViewInformation(response, target_view); + gFocusMgr.setKeyboardFocus(target_view); KEY key = getKEY(evt); MASK mask = getMask(evt); @@ -211,7 +272,9 @@ void LLWindowListener::keyDown(LLSD const & evt) } else { - ; // TODO: Don't silently fail if target not available. + response.error(STRINGIZE(evt["op"].asString() << " request " + "element specified byt \"path\": '" << path << "'" + << " is not visible")); } } else @@ -222,18 +285,30 @@ void LLWindowListener::keyDown(LLSD const & evt) void LLWindowListener::keyUp(LLSD const & evt) { + Response response(LLSD(), evt); + if (evt.has("path")) { + std::string path(evt["path"]); LLView * target_view = - LLUI::resolvePath(gViewerWindow->getRootView(), evt["path"]); - if ((target_view != 0) && target_view->isAvailable()) + LLUI::resolvePath(gViewerWindow->getRootView(), path); + if (target_view == 0 ) + { + response.error(STRINGIZE(evt["op"].asString() << " request " + "specified invalid \"path\": '" << path << "'")); + } + else if (target_view->isAvailable()) { + insertViewInformation(response, target_view); + gFocusMgr.setKeyboardFocus(target_view); mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); } else { - ; // TODO: Don't silently fail if target not available. + response.error(STRINGIZE(evt["op"].asString() << " request " + "element specified byt \"path\": '" << path << "'" + << " is not visible")); } } else @@ -266,44 +341,6 @@ struct WhichButton: public StringLookup }; static WhichButton buttons; -struct Response -{ - Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey="reply"): - mResp(seed), - mReq(request), - mKey(replyKey) - {} - - ~Response() - { - // When you instantiate a stack Response object, if the original - // request requested a reply, send it when we leave this block, no - // matter how. - sendReply(mResp, mReq, mKey); - } - - void warn(const std::string& warning) - { - LL_WARNS("LLWindowListener") << warning << LL_ENDL; - mResp["warnings"].append(warning); - } - - void error(const std::string& error) - { - // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut - // down altogether. - LL_WARNS("LLWindowListener") << error << LL_ENDL; - - mResp["error"] = error; - } - - // set other keys... - LLSD& operator[](const LLSD::String& key) { return mResp[key]; } - - LLSD mResp, mReq; - LLSD::String mKey; -}; - typedef boost::function MouseFunc; static void mouseEvent(const MouseFunc& func, const LLSD& request) @@ -340,19 +377,10 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) { return response.error(STRINGIZE(request["op"].asString() << " request " "specified invalid \"path\": '" << path << "'")); - return; } - // Get info about this LLView* for when we send response. - response["path"] = target->getPathname(); - response["class"] = typeid(*target).name(); - bool visible_chain(target->isInVisibleChain()); - bool enabled_chain(target->isInEnabledChain()); - response["visible"] = target->getVisible(); - response["visible_chain"] = visible_chain; - response["enabled"] = target->getEnabled(); - response["enabled_chain"] = enabled_chain; - response["available"] = target->isAvailable(); + insertViewInformation(response, target); + // Don't show caller the LLView's own relative rectangle; that only // tells its dimensions. Provide actual location on screen. LLRect rect(target->calcScreenRect()); @@ -360,7 +388,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) // The intent of this test is to prevent trying to drill down to a // widget in a hidden floater, or on a tab that's not current, etc. - if (! visible_chain) + if (! target->isInVisibleChain()) { return response.error(STRINGIZE(request["op"].asString() << " request " "specified \"path\" not currently visible: '" @@ -369,7 +397,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) // This test isn't folded in with the above error case since you can // (e.g.) pop up a tooltip even for a disabled widget. - if (! enabled_chain) + if (! target->isInEnabledChain()) { response.warn(STRINGIZE(request["op"].asString() << " request " "specified \"path\" not currently enabled: '" -- cgit v1.2.3 From 71aec7439c1a8027880ac06d99f923ab8fa7111b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 15:22:44 -0400 Subject: CHOP-763: Introduce static LLView::getPathname(LLView*). Use it for LLWindowListener to safely report an LLView* which might be NULL. --- indra/llui/llview.cpp | 27 ++++++++++++++++----------- indra/llui/llview.h | 2 ++ indra/newview/llwindowlistener.cpp | 4 ++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 0c8e3bace4..77abb1c6bf 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -433,20 +433,15 @@ BOOL LLView::isInEnabledChain() const static void buildPathname(std::ostream& out, const LLView* view) { - if (view == 0) return; - - if (view->getParent() != 0) + if (! (view && view->getParent())) { - buildPathname(out, view->getParent()); - - // Build pathname into ostream on the way back from recursion. - out << '/' << view->getName(); - } - else - { - ; // Don't include root in the path. + return; // Don't include root in the path. } + buildPathname(out, view->getParent()); + + // Build pathname into ostream on the way back from recursion. + out << '/' << view->getName(); } std::string LLView::getPathname() const @@ -456,6 +451,16 @@ std::string LLView::getPathname() const return out.str(); } +//static +std::string LLView::getPathname(const LLView* view) +{ + if (! view) + { + return "NULL"; + } + return view->getPathname(); +} + // virtual BOOL LLView::canFocusChildren() const { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 11f25bcd7f..97151c4fb4 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -445,6 +445,8 @@ public: virtual void onMouseLeave(S32 x, S32 y, MASK mask); std::string getPathname() const; + // static method handles NULL pointer too + static std::string getPathname(const LLView*); template T* findChild(const std::string& name, BOOL recurse = TRUE) const { diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 84a490f661..05cb798732 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -273,7 +273,7 @@ void LLWindowListener::keyDown(LLSD const & evt) else { response.error(STRINGIZE(evt["op"].asString() << " request " - "element specified byt \"path\": '" << path << "'" + "element specified by \"path\": '" << path << "'" << " is not visible")); } } @@ -421,7 +421,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) response.warn(STRINGIZE(request["op"].asString() << " request " "specified \"path\" = '" << path << "', but frontmost LLView at (" << pos.mX << ", " << pos.mY - << ") is '" << frontmost->getPathname() << "'")); + << ") is '" << LLView::getPathname(frontmost) << "'")); } // Instantiate a TemporaryDrilldownFunc to route incoming mouse events -- cgit v1.2.3 From 54399f1f87af40633035df9ec1cbadf139844621 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Sep 2011 13:01:08 -0400 Subject: CHOP-763: publish LLControlGroup::typeStringToEnum(), typeEnumToString() These LLControlGroup methods were marked 'protected'. But they're important for introspection: LLControlVariable::type() returns an eControlType; understanding that value outside a C++ context requires typeEnumToString(). --- indra/llxml/llcontrol.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index e402061e1f..31eb59c16e 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -185,9 +185,10 @@ protected: ctrl_name_table_t mNameTable; std::string mTypeString[TYPE_COUNT]; +public: eControlType typeStringToEnum(const std::string& typestr); std::string typeEnumToString(eControlType typeenum); -public: + LLControlGroup(const std::string& name); ~LLControlGroup(); void cleanup(); -- cgit v1.2.3 From 3ddf3aef9b2f2bb85932bd33b9daac5e59d3018a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Sep 2011 13:12:23 -0400 Subject: CHOP-763: Promote Response class from llwindowlistener.cpp to LLEventAPI. This is a generally-useful idiom, extending the sendReply() convenience function -- it shouldn't remain buried in a single .cpp file. --- indra/llcommon/lleventapi.cpp | 30 +++++++++++++++ indra/llcommon/lleventapi.h | 78 ++++++++++++++++++++++++++++++++++++++ indra/newview/llwindowlistener.cpp | 43 +-------------------- 3 files changed, 110 insertions(+), 41 deletions(-) diff --git a/indra/llcommon/lleventapi.cpp b/indra/llcommon/lleventapi.cpp index 4270c8b511..ff5459c1eb 100644 --- a/indra/llcommon/lleventapi.cpp +++ b/indra/llcommon/lleventapi.cpp @@ -34,6 +34,7 @@ // std headers // external library headers // other Linden headers +#include "llerror.h" LLEventAPI::LLEventAPI(const std::string& name, const std::string& desc, const std::string& field): lbase(name, field), @@ -45,3 +46,32 @@ LLEventAPI::LLEventAPI(const std::string& name, const std::string& desc, const s LLEventAPI::~LLEventAPI() { } + +LLEventAPI::Response::Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey): + mResp(seed), + mReq(request), + mKey(replyKey) +{} + +LLEventAPI::Response::~Response() +{ + // When you instantiate a stack Response object, if the original + // request requested a reply, send it when we leave this block, no + // matter how. + sendReply(mResp, mReq, mKey); +} + +void LLEventAPI::Response::warn(const std::string& warning) +{ + LL_WARNS("LLEventAPI::Response") << warning << LL_ENDL; + mResp["warnings"].append(warning); +} + +void LLEventAPI::Response::error(const std::string& error) +{ + // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut + // down altogether. + LL_WARNS("LLEventAPI::Response") << error << LL_ENDL; + + mResp["error"] = error; +} diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h index d75d521e8e..332dee9550 100644 --- a/indra/llcommon/lleventapi.h +++ b/indra/llcommon/lleventapi.h @@ -76,6 +76,84 @@ public: LLEventDispatcher::add(name, desc, callable, required); } + /** + * Instantiate a Response object in any LLEventAPI subclass method that + * wants to guarantee a reply (if requested) will be sent on exit from the + * method. The reply will be sent if request.has(@a replyKey), default + * "reply". If specified, the value of request[replyKey] is the name of + * the LLEventPump on which to send the reply. Conventionally you might + * code something like: + * + * @code + * void MyEventAPI::someMethod(const LLSD& request) + * { + * // Send a reply event as long as request.has("reply") + * Response response(LLSD(), request); + * // ... + * // will be sent in reply event + * response["somekey"] = some_data; + * } + * @endcode + */ + class Response + { + public: + /** + * Instantiating a Response object in an LLEventAPI subclass method + * ensures that, if desired, a reply event will be sent. + * + * @a seed is the initial reply LLSD that will be further decorated before + * being sent as the reply + * + * @a request is the incoming request LLSD; we particularly care about + * [replyKey] and ["reqid"] + * + * @a replyKey [default "reply"] is the string name of the LLEventPump + * on which the caller wants a reply. If (! + * request.has(replyKey)), no reply will be sent. + */ + Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey="reply"); + ~Response(); + + /** + * @code + * if (some condition) + * { + * response.warn("warnings are logged and collected in [\"warnings\"]"); + * } + * @endcode + */ + void warn(const std::string& warning); + /** + * @code + * if (some condition isn't met) + * { + * // In a function returning void, you can validly 'return + * // expression' if the expression is itself of type void. But + * // returning is up to you; response.error() has no effect on + * // flow of control. + * return response.error("error message, logged and also sent as [\"error\"]"); + * } + * @endcode + */ + void error(const std::string& error); + + /** + * set other keys... + * + * @code + * // set any attributes you want to be sent in the reply + * response["info"] = some_value; + * // ... + * response["ok"] = went_well; + * @endcode + */ + LLSD& operator[](const LLSD::String& key) { return mResp[key]; } + + LLSD mResp, mReq; + LLSD::String mKey; + }; + private: std::string mDesc; }; diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 05cb798732..3e3287032c 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -134,46 +134,7 @@ protected: namespace { -class Response -{ -public: - Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey="reply"): - mResp(seed), - mReq(request), - mKey(replyKey) - {} - - ~Response() - { - // When you instantiate a stack Response object, if the original - // request requested a reply, send it when we leave this block, no - // matter how. - sendReply(mResp, mReq, mKey); - } - - void warn(const std::string& warning) - { - LL_WARNS("LLWindowListener") << warning << LL_ENDL; - mResp["warnings"].append(warning); - } - - void error(const std::string& error) - { - // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut - // down altogether. - LL_WARNS("LLWindowListener") << error << LL_ENDL; - - mResp["error"] = error; - } - - // set other keys... - LLSD& operator[](const LLSD::String& key) { return mResp[key]; } - - LLSD mResp, mReq; - LLSD::String mKey; -}; - -void insertViewInformation(Response & response, LLView * target) +void insertViewInformation(LLEventAPI::Response & response, LLView * target) { // Get info about this LLView* for when we send response. response["path"] = target->getPathname(); @@ -346,7 +307,7 @@ typedef boost::function MouseFunc; static void mouseEvent(const MouseFunc& func, const LLSD& request) { // Ensure we send response - Response response(LLSD(), request); + LLEventAPI::Response response(LLSD(), request); // We haven't yet established whether the incoming request has "x" and "y", // but capture this anyway, with 0 for omitted values. LLCoordGL pos(request["x"].asInteger(), request["y"].asInteger()); -- cgit v1.2.3 From 7215d1a9a9e6220d8744b662ab96feb41fc66ec8 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Sep 2011 14:05:37 -0400 Subject: CHOP-763: Extend LLEventAPI "LLViewerControl" API; add queries. This is a significant refactoring of planned (but as yet unimplemented) work, though in fact it's almost completely compatible with the only implemented operation. The set() operation now requires op="set", where before that was inferred because set() was the only possibility. Whereas before LLViewerControlListener dispatched to different bound methods on the "group" key, with four known "group" string values, it now dispatches on the "op" key, supporting "set", "toggle", "get", "groups", "vars" -- the last two exposing query functionality. LLControlGroup is actually derived from LLInstanceTracker, keyed on string names, so we can look up instances using LLControlGroup::getInstance(const std::string&), or enumerate all such names. LLControlGroup similarly permits iterating over all defined LLControlVariables. The static LLViewerControlListener instance has been wrapped in an unnamed namespace and removed from llviewercontrollistener.h. The availability of the API depends on LLEventPumps::obtain(), rather than normal C++ visibility. --- indra/newview/llviewercontrollistener.cpp | 231 +++++++++++++++++++++--------- indra/newview/llviewercontrollistener.h | 10 +- 2 files changed, 169 insertions(+), 72 deletions(-) diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp index 8bc25fa281..361b96221c 100644 --- a/indra/newview/llviewercontrollistener.cpp +++ b/indra/newview/llviewercontrollistener.cpp @@ -31,99 +31,196 @@ #include "llviewercontrollistener.h" #include "llviewercontrol.h" +#include "llcontrol.h" +#include "llerror.h" +#include "llsdutil.h" +#include "stringize.h" +#include -LLViewerControlListener gSavedSettingsListener; +namespace { + +LLViewerControlListener sSavedSettingsListener; + +} // unnamed namespace LLViewerControlListener::LLViewerControlListener() : LLEventAPI("LLViewerControl", - "LLViewerControl listener: set, toggle or set default for various controls", - "group") + "LLViewerControl listener: set, toggle or set default for various controls") { - add("Global", - "Set gSavedSettings control [\"key\"] to value [\"value\"]", - boost::bind(&LLViewerControlListener::set, &gSavedSettings, _1)); - add("PerAccount", - "Set gSavedPerAccountSettings control [\"key\"] to value [\"value\"]", - boost::bind(&LLViewerControlListener::set, &gSavedPerAccountSettings, _1)); - add("Warning", - "Set gWarningSettings control [\"key\"] to value [\"value\"]", - boost::bind(&LLViewerControlListener::set, &gWarningSettings, _1)); - add("Crash", - "Set gCrashSettings control [\"key\"] to value [\"value\"]", - boost::bind(&LLViewerControlListener::set, &gCrashSettings, _1)); - -#if 0 - add(/*"toggleControl",*/ "Global", boost::bind(&LLViewerControlListener::toggleControl, &gSavedSettings, _1)); - add(/*"toggleControl",*/ "PerAccount", boost::bind(&LLViewerControlListener::toggleControl, &gSavedPerAccountSettings, _1)); - add(/*"toggleControl",*/ "Warning", boost::bind(&LLViewerControlListener::toggleControl, &gWarningSettings, _1)); - add(/*"toggleControl",*/ "Crash", boost::bind(&LLViewerControlListener::toggleControl, &gCrashSettings, _1)); - - add(/*"setDefault",*/ "Global", boost::bind(&LLViewerControlListener::setDefault, &gSavedSettings, _1)); - add(/*"setDefault",*/ "PerAccount", boost::bind(&LLViewerControlListener::setDefault, &gSavedPerAccountSettings, _1)); - add(/*"setDefault",*/ "Warning", boost::bind(&LLViewerControlListener::setDefault, &gWarningSettings, _1)); - add(/*"setDefault",*/ "Crash", boost::bind(&LLViewerControlListener::setDefault, &gCrashSettings, _1)); -#endif // 0 + std::ostringstream groupnames; + groupnames << "[\"group\"] is one of "; + const char* delim = ""; + for (LLControlGroup::key_iter cgki(LLControlGroup::beginKeys()), + cgkend(LLControlGroup::endKeys()); + cgki != cgkend; ++cgki) + { + groupnames << delim << '"' << *cgki << '"'; + delim = ", "; + } + groupnames << '\n'; + std::string grouphelp(groupnames.str()); + std::string replyhelp("If [\"reply\"] requested, send new [\"value\"] on specified LLEventPump\n"); + + add("set", + std::string("Set [\"group\"] control [\"key\"] to optional value [\"value\"]\n" + "If [\"value\"] omitted, set to control's defined default value\n") + + grouphelp + replyhelp, + &LLViewerControlListener::set, + LLSDMap("group", LLSD())("key", LLSD())); + add("toggle", + std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp, + &LLViewerControlListener::toggle, + LLSDMap("group", LLSD())("key", LLSD())); + add("get", + std::string("Query [\"group\"] control [\"key\"], replying on LLEventPump [\"reply\"]\n") + + grouphelp, + &LLViewerControlListener::get, + LLSDMap("group", LLSD())("key", LLSD())("reply", LLSD())); + add("groups", + "Send on LLEventPump [\"reply\"] an array [\"groups\"] of valid group names", + &LLViewerControlListener::groups, + LLSDMap("reply", LLSD())); + add("vars", + std::string("For [\"group\"], send on LLEventPump [\"reply\"] an array [\"vars\"],\n" + "each of whose entries looks like:\n" + " [\"name\"], [\"type\"], [\"value\"], [\"comment\"]\n") + grouphelp, + &LLViewerControlListener::vars, + LLSDMap("group", LLSD())("reply", LLSD())); } -//static -void LLViewerControlListener::set(LLControlGroup * controls, LLSD const & event_data) +struct Info { - if(event_data.has("key")) + Info(const LLSD& request): + response(LLSD(), request), + groupname(request["group"]), + group(LLControlGroup::getInstance(groupname)), + key(request["key"]), + control(NULL) { - std::string key(event_data["key"]); + if (! group) + { + response.error(STRINGIZE("Unrecognized group '" << groupname << "'")); + return; + } - if(controls->controlExists(key)) + control = group->getControl(key); + if (! control) { - controls->setUntypedValue(key, event_data["value"]); + response.error(STRINGIZE("In group '" << groupname + << "', unrecognized control key '" << key << "'")); } - else + } + + ~Info() + { + // If in fact the request passed to our constructor names a valid + // group and key, grab the final value of the indicated control and + // stuff it in our response. Since this outer destructor runs before + // the contained Response destructor, this data will go into the + // response we send. + if (control) { - llwarns << "requested unknown control: \"" << key << '\"' << llendl; + response["name"] = control->getName(); + response["type"] = group->typeEnumToString(control->type()); + response["value"] = control->get(); + response["comment"] = control->getComment(); } } + + LLEventAPI::Response response; + std::string groupname; + LLControlGroup* group; + std::string key; + LLControlVariable* control; +}; + +//static +void LLViewerControlListener::set(LLSD const & request) +{ + Info info(request); + if (! info.control) + return; + + if (request.has("value")) + { + info.control->setValue(request["value"]); + } + else + { + info.control->resetToDefault(); + } } //static -void LLViewerControlListener::toggleControl(LLControlGroup * controls, LLSD const & event_data) +void LLViewerControlListener::toggle(LLSD const & request) { - if(event_data.has("key")) + Info info(request); + if (! info.control) + return; + + if (info.control->isType(TYPE_BOOLEAN)) + { + info.control->set(! info.control->get().asBoolean()); + } + else { - std::string key(event_data["key"]); + info.response.error(STRINGIZE("toggle of non-boolean '" << info.groupname + << "' control '" << info.key + << "', type is " + << info.group->typeEnumToString(info.control->type()))); + } +} - if(controls->controlExists(key)) - { - LLControlVariable * control = controls->getControl(key); - if(control->isType(TYPE_BOOLEAN)) - { - control->set(!control->get().asBoolean()); - } - else - { - llwarns << "requested toggle of non-boolean control: \"" << key << "\", type is " << control->type() << llendl; - } - } - else - { - llwarns << "requested unknown control: \"" << key << '\"' << llendl; - } +void LLViewerControlListener::get(LLSD const & request) +{ + // The Info constructor and destructor actually do all the work here. + Info info(request); +} + +void LLViewerControlListener::groups(LLSD const & request) +{ + // No Info, we're not looking up either a group or a control name. + Response response(LLSD(), request); + for (LLControlGroup::key_iter cgki(LLControlGroup::beginKeys()), + cgkend(LLControlGroup::endKeys()); + cgki != cgkend; ++cgki) + { + response["groups"].append(*cgki); } } -//static -void LLViewerControlListener::setDefault(LLControlGroup * controls, LLSD const & event_data) +struct CollectVars: public LLControlGroup::ApplyFunctor { - if(event_data.has("key")) + CollectVars(LLControlGroup* g): + mGroup(g) + {} + + virtual void apply(const std::string& name, LLControlVariable* control) { - std::string key(event_data["key"]); + vars.append(LLSDMap + ("name", name) + ("type", mGroup->typeEnumToString(control->type())) + ("value", control->get()) + ("comment", control->getComment())); + } - if(controls->controlExists(key)) - { - LLControlVariable * control = controls->getControl(key); - control->resetToDefault(); - } - else - { - llwarns << "requested unknown control: \"" << key << '\"' << llendl; - } + LLControlGroup* mGroup; + LLSD vars; +}; + +void LLViewerControlListener::vars(LLSD const & request) +{ + // This method doesn't use Info, because we're not looking up a specific + // control name. + Response response(LLSD(), request); + std::string groupname(request["group"]); + LLControlGroup* group(LLControlGroup::getInstance(groupname)); + if (! group) + { + return response.error(STRINGIZE("Unrecognized group '" << groupname << "'")); } + + CollectVars collector(group); + group->applyToAll(&collector); + response["vars"] = collector.vars; } diff --git a/indra/newview/llviewercontrollistener.h b/indra/newview/llviewercontrollistener.h index fd211b97af..2e72046924 100644 --- a/indra/newview/llviewercontrollistener.h +++ b/indra/newview/llviewercontrollistener.h @@ -40,11 +40,11 @@ public: LLViewerControlListener(); private: - static void set(LLControlGroup *controls, LLSD const & event_data); - static void toggleControl(LLControlGroup *controls, LLSD const & event_data); - static void setDefault(LLControlGroup *controls, LLSD const & event_data); + static void set(LLSD const & event_data); + static void toggle(LLSD const & event_data); + static void get(LLSD const & event_data); + static void groups(LLSD const & event_data); + static void vars(LLSD const & event_data); }; -extern LLViewerControlListener gSavedSettingsListener; - #endif // LL_LLVIEWERCONTROLLISTENER_H -- cgit v1.2.3 From 38c19f4e55c0f6a104de87dfb57313a6c529b4d6 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 1 Sep 2011 17:18:16 -0600 Subject: for SH-2242: fixes the assertion caused by gGL.diffuseColor4f when shadows is on. --- indra/newview/lldrawpoolavatar.cpp | 6 +++--- indra/newview/pipeline.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f0eb52909d..96c4efde3d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -353,15 +353,15 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) { sVertexProgram = &gDeferredAvatarShadowProgram; - //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f); - - gGL.diffuseColor4f(1,1,1,1); + //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f); if ((sShaderLevel > 0)) // for hardware blending { sRenderingSkinned = TRUE; sVertexProgram->bind(); } + + gGL.diffuseColor4f(1,1,1,1); } else { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d9fa4881e7..f821ab8e34 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4041,6 +4041,8 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) pool_set_t::iterator iter2 = iter1; if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0) { + poolp->prerender() ; + gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); @@ -8341,12 +8343,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.diffuseColor4f(1,1,1,1); stop_glerror(); - - gGL.setColorMask(false, false); //glCullFace(GL_FRONT); @@ -8357,6 +8355,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { //occlusion program is general purpose depth-only no-textures gOcclusionProgram.bind(); } + + gGL.diffuseColor4f(1,1,1,1); + gGL.setColorMask(false, false); + LLFastTimer ftm(FTM_SHADOW_SIMPLE); gGL.getTexUnit(0)->disable(); for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i) -- cgit v1.2.3 From 654cd3f89786e5c19cf26472ccf5a402a22ea661 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 4 Sep 2011 07:08:23 -0400 Subject: CHOP-763: Make LLView::TemporaryDrilldownFunc boost::noncopyable. Code review with Alain turned up the fact that TemporaryDrilldownFunc, simple to the point of naivety, doesn't address the case of its being copied. Making it boost::noncopyable should turn any such usage into a compile error. --- indra/llui/llview.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 97151c4fb4..fcae75c447 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -51,6 +51,7 @@ #include #include +#include class LLSD; @@ -614,7 +615,7 @@ public: // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); // // ... test with myfunctor ... // } // exiting block restores original LLView::sDrilldown - class TemporaryDrilldownFunc + class TemporaryDrilldownFunc: public boost::noncopyable { public: TemporaryDrilldownFunc(const DrilldownFunc& func): -- cgit v1.2.3 From e2552ec6737fe734ffd5b4768193c6a890d66f70 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 6 Sep 2011 17:45:47 +0300 Subject: STORM-1577 WIP Implemented translation via Microsoft Translator and Google Translate v2 APIs. --- indra/newview/app_settings/settings.xml | 33 ++++ indra/newview/lltranslate.cpp | 312 ++++++++++++++++++++++++++------ indra/newview/lltranslate.h | 87 ++------- indra/newview/llviewermessage.cpp | 7 +- 4 files changed, 316 insertions(+), 123 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0996f75fbb..2549538df2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10922,6 +10922,39 @@ Value 0 + TranslationService + + Comment + Translation API to use. (google_v1|google_v2|bing) + Persist + 1 + Type + String + Value + google_v1 + + GoogleTranslateAPIv2Key + + Comment + Google Translate API v2 key + Persist + 1 + Type + String + Value + + + BingTranslateAPIKey + + Comment + Bing AppID to use with the Microsoft Translator V2 API + Persist + 1 + Type + String + Value + + TutorialURL Comment diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 2f60b6b90b..e29ea373ce 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -37,74 +37,263 @@ #include "reader.h" -// These two are concatenated with the language specifiers to form a complete Google Translate URL -const char* LLTranslate::m_GoogleURL = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q="; -const char* LLTranslate::m_GoogleLangSpec = "&langpair="; -float LLTranslate::m_GoogleTimeout = 5; - -LLSD LLTranslate::m_Header; -// These constants are for the GET header. -const char* LLTranslate::m_AcceptHeader = "Accept"; -const char* LLTranslate::m_AcceptType = "text/plain"; -const char* LLTranslate::m_AgentHeader = "User-Agent"; - -// These constants are in the JSON returned from Google -const char* LLTranslate::m_GoogleData = "responseData"; -const char* LLTranslate::m_GoogleTranslation = "translatedText"; -const char* LLTranslate::m_GoogleLanguage = "detectedSourceLanguage"; +class LLTranslationAPIHandler +{ +public: + virtual void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const = 0; -//static -void LLTranslate::translateMessage(LLHTTPClient::ResponderPtr &result, const std::string &from_lang, const std::string &to_lang, const std::string &mesg) + virtual bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const = 0; + + virtual ~LLTranslationAPIHandler() {} + +protected: + static const int STATUS_OK = 200; +}; + +class LLGoogleV1Handler : public LLTranslationAPIHandler { - std::string url; - getTranslateUrl(url, from_lang, to_lang, mesg); + LOG_CLASS(LLGoogleV1Handler); + +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" + + LLURI::escape(text) + + "&langpair=" + from_lang + "%7C" + to_lang; + } + + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const + { + Json::Value root; + Json::Reader reader; + + if (!reader.parse(body, root)) + { + err_msg = reader.getFormatedErrorMessages(); + return false; + } + + // This API doesn't return proper status in the HTTP response header, + // but it is in the body. + status = root["responseStatus"].asInt(); + if (status != STATUS_OK) + { + err_msg = root["responseDetails"].asString(); + return false; + } + + const Json::Value& response_data = root["responseData"]; + translation = response_data.get("translatedText", "").asString(); + detected_lang = response_data.get("detectedSourceLanguage", "").asString(); + return true; + } +}; + +class LLGoogleV2Handler : public LLTranslationAPIHandler +{ + LOG_CLASS(LLGoogleV2Handler); + +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = std::string("https://www.googleapis.com/language/translate/v2?key=") + + getAPIKey() + "&q=" + LLURI::escape(text) + "&target=" + to_lang; + if (!from_lang.empty()) + { + url += "&source=" + from_lang; + } + } + + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const + { + Json::Value root; + Json::Reader reader; + + if (!reader.parse(body, root)) + { + err_msg = reader.getFormatedErrorMessages(); + return false; + } + + if (status != STATUS_OK) + { + const Json::Value& error = root["error"]; + err_msg = error["message"].asString(); + status = error["code"].asInt(); + return false; + } + + const Json::Value& response_data = root["data"]["translations"][0U]; + translation = response_data["translatedText"].asString(); + detected_lang = response_data["detectedSourceLanguage"].asString(); + return true; + } + +private: + static std::string getAPIKey() + { + return gSavedSettings.getString("GoogleTranslateAPIv2Key"); + } +}; + +class LLBingHandler : public LLTranslationAPIHandler +{ + LOG_CLASS(LLBingHandler); - std::string user_agent = llformat("%s %d.%d.%d (%d)", - LLVersionInfo::getChannel().c_str(), - LLVersionInfo::getMajor(), - LLVersionInfo::getMinor(), - LLVersionInfo::getPatch(), - LLVersionInfo::getBuild()); +public: + /*virtual*/ void getTranslateURL( + std::string &url, + const std::string &from_lang, + const std::string &to_lang, + const std::string &text) const + { + url = std::string("http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=") + + getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + to_lang; + if (!from_lang.empty()) + { + url += "&from=" + from_lang; + } + } - if (!m_Header.size()) + /*virtual*/ bool parseResponse( + int& status, + const std::string& body, + std::string& translation, + std::string& detected_lang, + std::string& err_msg) const { - m_Header.insert(m_AcceptHeader, LLSD(m_AcceptType)); - m_Header.insert(m_AgentHeader, LLSD(user_agent)); + if (status != STATUS_OK) + { + size_t begin = body.find("Message: "); + size_t end = body.find("

", begin); + err_msg = body.substr(begin, end-begin); + LLStringUtil::replaceString(err_msg, " ", ""); // strip CR + return false; + } + + // Sample response: Hola + size_t begin = body.find(">"); + if (begin == std::string::npos || begin >= (body.size() - 1)) + { + return false; + } + + size_t end = body.find("", ++begin); + if (end == std::string::npos || end < begin) + { + return false; + } + + detected_lang = ""; // unsupported by this API + translation = body.substr(begin, end-begin); + LLStringUtil::replaceString(translation, " ", ""); // strip CR + return true; } - LLHTTPClient::get(url, result, m_Header, m_GoogleTimeout); +private: + static std::string getAPIKey() + { + return gSavedSettings.getString("BingTranslateAPIKey"); + } +}; + +LLTranslate::TranslationReceiver::TranslationReceiver(const std::string& from_lang, const std::string& to_lang) +: mFromLang(from_lang) +, mToLang(to_lang) +, mHandler(LLTranslate::getPreferredHandler()) +{ } -//static -void LLTranslate::getTranslateUrl(std::string &translate_url, const std::string &from_lang, const std::string &to_lang, const std::string &mesg) +// virtual +void LLTranslate::TranslationReceiver::completedRaw( + U32 http_status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { - char * curl_str = curl_escape(mesg.c_str(), mesg.size()); - std::string const escaped_mesg(curl_str); - curl_free(curl_str); - - translate_url = m_GoogleURL - + escaped_mesg + m_GoogleLangSpec - + from_lang // 'from' language; empty string for auto - + "%7C" // | - + to_lang; // 'to' language + LLBufferStream istr(channels, buffer.get()); + std::stringstream strstrm; + strstrm << istr.rdbuf(); + + const std::string body = strstrm.str(); + std::string translation, detected_lang, err_msg; + int status = http_status; + if (mHandler.parseResponse(status, body, translation, detected_lang, err_msg)) + { + // Fix up the response + LLStringUtil::replaceString(translation, "<", "<"); + LLStringUtil::replaceString(translation, ">",">"); + LLStringUtil::replaceString(translation, ""","\""); + LLStringUtil::replaceString(translation, "'","'"); + LLStringUtil::replaceString(translation, "&","&"); + LLStringUtil::replaceString(translation, "'","'"); + + handleResponse(translation, detected_lang); + } + else + { + llwarns << "Translation request failed: " << err_msg << llendl; + LL_DEBUGS("Translate") << "HTTP status: " << status << " " << reason << LL_ENDL; + LL_DEBUGS("Translate") << "Error response body: " << body << LL_ENDL; + handleFailure(status, err_msg); + } } //static -bool LLTranslate::parseGoogleTranslate(const std::string& body, std::string &translation, std::string &detected_language) +void LLTranslate::translateMessage( + TranslationReceiverPtr &receiver, + const std::string &from_lang, + const std::string &to_lang, + const std::string &mesg) { - Json::Value root; - Json::Reader reader; - - bool success = reader.parse(body, root); - if (!success) + std::string url; + receiver->mHandler.getTranslateURL(url, from_lang, to_lang, mesg); + + static const float REQUEST_TIMEOUT = 5; + static LLSD sHeader; + + if (!sHeader.size()) { - LL_WARNS("Translate") << "Non valid response from Google Translate API: '" << reader.getFormatedErrorMessages() << "'" << LL_ENDL; - return false; + std::string user_agent = llformat("%s %d.%d.%d (%d)", + LLVersionInfo::getChannel().c_str(), + LLVersionInfo::getMajor(), + LLVersionInfo::getMinor(), + LLVersionInfo::getPatch(), + LLVersionInfo::getBuild()); + + sHeader.insert("Accept", "text/plain"); + sHeader.insert("User-Agent", user_agent); } - - translation = root[m_GoogleData].get(m_GoogleTranslation, "").asString(); - detected_language = root[m_GoogleData].get(m_GoogleLanguage, "").asString(); - return true; + + LL_DEBUGS("Translate") << "Sending translation request: " << url << LL_ENDL; + LLHTTPClient::get(url, receiver, sHeader, REQUEST_TIMEOUT); } //static @@ -119,3 +308,22 @@ std::string LLTranslate::getTranslateLanguage() return language; } +// static +const LLTranslationAPIHandler& LLTranslate::getPreferredHandler() +{ + static LLGoogleV1Handler google_v1; + static LLGoogleV2Handler google_v2; + static LLBingHandler bing; + + std::string service = gSavedSettings.getString("TranslationService"); + if (service == "google_v2") + { + return google_v2; + } + else if (service == "google_v1") + { + return google_v1; + } + + return bing; +} diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index e85a42e878..1dee792f7b 100644 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -30,89 +30,42 @@ #include "llhttpclient.h" #include "llbufferstream.h" +class LLTranslationAPIHandler; + class LLTranslate { LOG_CLASS(LLTranslate); + public : class TranslationReceiver: public LLHTTPClient::Responder { - protected: - TranslationReceiver(const std::string &from_lang, const std::string &to_lang) - : m_fromLang(from_lang), - m_toLang(to_lang) - { - } - - virtual void handleResponse(const std::string &translation, const std::string &recognized_lang) {}; - virtual void handleFailure() {}; - public: - ~TranslationReceiver() - { - } - - virtual void completedRaw( U32 status, - const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) - { - if (200 <= status && status < 300) - { - LLBufferStream istr(channels, buffer.get()); - std::stringstream strstrm; - strstrm << istr.rdbuf(); + /*virtual*/ void completedRaw( + U32 http_status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer); - const std::string result = strstrm.str(); - std::string translation; - std::string detected_language; + protected: + friend class LLTranslate; - if (!parseGoogleTranslate(result, translation, detected_language)) - { - handleFailure(); - return; - } - - // Fix up the response - LLStringUtil::replaceString(translation, "<", "<"); - LLStringUtil::replaceString(translation, ">",">"); - LLStringUtil::replaceString(translation, ""","\""); - LLStringUtil::replaceString(translation, "'","'"); - LLStringUtil::replaceString(translation, "&","&"); - LLStringUtil::replaceString(translation, "'","'"); + TranslationReceiver(const std::string& from_lang, const std::string& to_lang); - handleResponse(translation, detected_language); - } - else - { - LL_WARNS("Translate") << "HTTP request for Google Translate failed with status " << status << ", reason: " << reason << LL_ENDL; - handleFailure(); - } - } + virtual void handleResponse(const std::string &translation, const std::string &recognized_lang) = 0; + virtual void handleFailure(int status, const std::string& err_msg) = 0; - protected: - const std::string m_toLang; - const std::string m_fromLang; + std::string mFromLang; + std::string mToLang; + const LLTranslationAPIHandler& mHandler; }; - static void translateMessage(LLHTTPClient::ResponderPtr &result, const std::string &from_lang, const std::string &to_lang, const std::string &mesg); - static float m_GoogleTimeout; + typedef boost::intrusive_ptr TranslationReceiverPtr; + + static void translateMessage(TranslationReceiverPtr &receiver, const std::string &from_lang, const std::string &to_lang, const std::string &mesg); static std::string getTranslateLanguage(); private: - static void getTranslateUrl(std::string &translate_url, const std::string &from_lang, const std::string &to_lang, const std::string &text); - static bool parseGoogleTranslate(const std::string& body, std::string &translation, std::string &detected_language); - - static LLSD m_Header; - static const char* m_GoogleURL; - static const char* m_GoogleLangSpec; - static const char* m_AcceptHeader; - static const char* m_AcceptType; - static const char* m_AgentHeader; - static const char* m_UserAgent; - - static const char* m_GoogleData; - static const char* m_GoogleTranslation; - static const char* m_GoogleLanguage; + static const LLTranslationAPIHandler& getPreferredHandler(); }; #endif diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 68745d5aeb..ff02214194 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3138,7 +3138,7 @@ protected: { // filter out non-interesting responeses if ( !translation.empty() - && (m_toLang != detected_language) + && (mToLang != detected_language) && (LLStringUtil::compareInsensitive(translation, m_origMesg) != 0) ) { m_chat.mText += " (" + translation + ")"; @@ -3147,9 +3147,8 @@ protected: LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs); } - void handleFailure() + void handleFailure(int status, const std::string& err_msg) { - LLTranslate::TranslationReceiver::handleFailure(); m_chat.mText += " (?)"; LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs); @@ -3388,7 +3387,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) const std::string from_lang = ""; // leave empty to trigger autodetect const std::string to_lang = LLTranslate::getTranslateLanguage(); - LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args); + LLTranslate::TranslationReceiverPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args); LLTranslate::translateMessage(result, from_lang, to_lang, mesg); } else -- cgit v1.2.3 From ecba41419f6470cc3d85bbb277ef88ebbf266feb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Sep 2011 13:25:27 -0400 Subject: CHOP-763: Nested LLEventAPI::Response class needs LL_COMMON_API too. Apparently the outer class's LL_COMMON_API marker affects all outer class members, but not nested classes. Making it explicit fixes Windows link errors. --- indra/llcommon/lleventapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h index 332dee9550..64d038ade4 100644 --- a/indra/llcommon/lleventapi.h +++ b/indra/llcommon/lleventapi.h @@ -95,7 +95,7 @@ public: * } * @endcode */ - class Response + class LL_COMMON_API Response { public: /** -- cgit v1.2.3 From e23ecf311c729be7e6611ef2fe21badaf9f1c3ed Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 00:09:49 +0300 Subject: STORM-1577 WIP Implemented chat translation preferences management. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterpreference.cpp | 9 + indra/newview/llfloaterpreference.h | 1 + indra/newview/llfloatertranslationsettings.cpp | 146 ++++++++++++++ indra/newview/llfloatertranslationsettings.h | 59 ++++++ indra/newview/llviewerfloaterreg.cpp | 2 + .../xui/en/floater_translation_settings.xml | 222 +++++++++++++++++++++ .../default/xui/en/panel_preferences_chat.xml | 12 ++ 8 files changed, 453 insertions(+) create mode 100644 indra/newview/llfloatertranslationsettings.cpp create mode 100644 indra/newview/llfloatertranslationsettings.h create mode 100644 indra/newview/skins/default/xui/en/floater_translation_settings.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a117d9a593..e7ca2a4294 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -237,6 +237,7 @@ set(viewer_SOURCE_FILES llfloatertools.cpp llfloatertopobjects.cpp llfloatertos.cpp + llfloatertranslationsettings.cpp llfloateruipreview.cpp llfloaterurlentry.cpp llfloatervoiceeffect.cpp @@ -799,6 +800,7 @@ set(viewer_HEADER_FILES llfloatertools.h llfloatertopobjects.h llfloatertos.h + llfloatertranslationsettings.h llfloateruipreview.h llfloaterurlentry.h llfloatervoiceeffect.h diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d65928e385..07c07d608a 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -345,6 +345,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this)); mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); + mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -602,6 +603,9 @@ void LLFloaterPreference::cancel() } // hide joystick pref floater LLFloaterReg::hideInstance("pref_joystick"); + + // hide translation settings floater + LLFloaterReg::hideInstance("prefs_translation"); // cancel hardware menu LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); @@ -1553,6 +1557,11 @@ void LLFloaterPreference::onClickProxySettings() LLFloaterReg::showInstance("prefs_proxy"); } +void LLFloaterPreference::onClickTranslationSettings() +{ + LLFloaterReg::showInstance("prefs_translation"); +} + void LLFloaterPreference::updateDoubleClickControls() { // check is one of double-click actions settings enabled diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index ef9bc2dd53..ee6bb235be 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -157,6 +157,7 @@ public: void onChangeMaturity(); void onClickBlockList(); void onClickProxySettings(); + void onClickTranslationSettings(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); void getUIColor(LLUICtrl* ctrl, const LLSD& param); diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp new file mode 100644 index 0000000000..56f101d149 --- /dev/null +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -0,0 +1,146 @@ +/** + * @file llfloatertranslationsettings.cpp + * @brief Machine translation settings for chat + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatertranslationsettings.h" + +// Viewer includes +#include "llviewercontrol.h" // for gSavedSettings + +// Linden library includes +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" +#include "llradiogroup.h" + +LLFloaterTranslationSettings::LLFloaterTranslationSettings(const LLSD& key) +: LLFloater(key) +, mMachineTranslationCB(NULL) +, mLanguageCombo(NULL) +, mTranslationServiceRadioGroup(NULL) +, mBingAPIKeyEditor(NULL) +, mGoogleAPIKeyEditor(NULL) +{ +} + +// virtual +BOOL LLFloaterTranslationSettings::postBuild() +{ + mMachineTranslationCB = getChild("translate_chat_checkbox"); + mLanguageCombo = getChild("translate_language_combo"); + mTranslationServiceRadioGroup = getChild("translation_service_rg"); + mBingAPIKeyEditor = getChild("bing_api_key"); + mGoogleAPIKeyEditor = getChild("google_api_key"); + + mMachineTranslationCB->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this)); + mTranslationServiceRadioGroup->setCommitCallback(boost::bind(&LLFloaterTranslationSettings::updateControlsEnabledState, this)); + getChild("ok_btn")->setClickedCallback(boost::bind(&LLFloaterTranslationSettings::onBtnOK, this)); + getChild("cancel_btn")->setClickedCallback(boost::bind(&LLFloater::closeFloater, this, false)); + + center(); + return TRUE; +} + +// virtual +void LLFloaterTranslationSettings::onOpen(const LLSD& key) +{ + mMachineTranslationCB->setValue(gSavedSettings.getBOOL("TranslateChat")); + mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE); + mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE); + mBingAPIKeyEditor->setText(gSavedSettings.getString("BingTranslateAPIKey")); + mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIv2Key")); + + updateControlsEnabledState(); +} + +std::string LLFloaterTranslationSettings::getSelectedService() const +{ + return mTranslationServiceRadioGroup->getSelectedValue().asString(); +} + +void LLFloaterTranslationSettings::showError(const std::string& err_name) +{ + LLSD args; + args["MESSAGE"] = getString(err_name); + LLNotificationsUtil::add("GenericAlert", args); +} + +bool LLFloaterTranslationSettings::validate() +{ + bool translate_chat = mMachineTranslationCB->getValue().asBoolean(); + if (!translate_chat) return true; + + std::string service = getSelectedService(); + if (service == "bing" && mBingAPIKeyEditor->getText().empty()) + { + showError("no_bing_api_key"); + return false; + } + + if (service == "google_v2" && mGoogleAPIKeyEditor->getText().empty()) + { + showError("no_google_api_key"); + return false; + } + + return true; +} + +void LLFloaterTranslationSettings::updateControlsEnabledState() +{ + // Enable/disable controls based on the checkbox value. + bool on = mMachineTranslationCB->getValue().asBoolean(); + std::string service = getSelectedService(); + + mTranslationServiceRadioGroup->setEnabled(on); + mLanguageCombo->setEnabled(on); + + getChild("bing_api_key_label")->setEnabled(on); + mBingAPIKeyEditor->setEnabled(on); + + getChild("google_api_key_label")->setEnabled(on); + mGoogleAPIKeyEditor->setEnabled(on); + + mBingAPIKeyEditor->setEnabled(service == "bing"); + mGoogleAPIKeyEditor->setEnabled(service == "google_v2"); +} + +void LLFloaterTranslationSettings::onBtnOK() +{ + if (validate()) + { + gSavedSettings.setBOOL("TranslateChat", mMachineTranslationCB->getValue().asBoolean()); + gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString()); + gSavedSettings.setString("TranslationService", getSelectedService()); + gSavedSettings.setString("BingTranslateAPIKey", mBingAPIKeyEditor->getText()); + gSavedSettings.setString("GoogleTranslateAPIv2Key", mGoogleAPIKeyEditor->getText()); + closeFloater(false); + } +} diff --git a/indra/newview/llfloatertranslationsettings.h b/indra/newview/llfloatertranslationsettings.h new file mode 100644 index 0000000000..1c03b86f4d --- /dev/null +++ b/indra/newview/llfloatertranslationsettings.h @@ -0,0 +1,59 @@ +/** + * @file llfloatertranslationsettings.h + * @brief Machine translation settings for chat + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERTRANSLATIONSETTINGS_H +#define LL_LLFLOATERTRANSLATIONSETTINGS_H + +#include "llfloater.h" + +class LLCheckBoxCtrl; +class LLComboBox; +class LLLineEditor; +class LLRadioGroup; + +class LLFloaterTranslationSettings : public LLFloater +{ +public: + LLFloaterTranslationSettings(const LLSD& key); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + std::string getSelectedService() const; + void showError(const std::string& err_name); + bool validate(); + void updateControlsEnabledState(); + void onMachineTranslationToggle(); + void onBtnOK(); + + LLCheckBoxCtrl* mMachineTranslationCB; + LLComboBox* mLanguageCombo; + LLLineEditor* mBingAPIKeyEditor; + LLLineEditor* mGoogleAPIKeyEditor; + LLRadioGroup* mTranslationServiceRadioGroup; +}; + +#endif // LL_LLFLOATERTRANSLATIONSETTINGS_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index fecc6d91bd..3be26d87e2 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -102,6 +102,7 @@ #include "llfloatertools.h" #include "llfloatertos.h" #include "llfloatertopobjects.h" +#include "llfloatertranslationsettings.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" #include "llfloaterwhitelistentry.h" @@ -234,6 +235,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("perm_prefs", "floater_perm_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml new file mode 100644 index 0000000000..40a176830c --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -0,0 +1,222 @@ + + + + Bing Translator requires and appID to function. + Google Translate requires an API key to function. + + + + Translate chat into: + + + + + + + + + + + + + + + + + + + + + + + + Choose translation service to use: + + + + + + + + + Bing [http://www.bing.com/developers/createapp.aspx AppID]: + + + + + Google [http://code.google.com/apis/language/translate/v2/pricing.html API key]: + + + + + ([http://code.google.com/apis/language/translate/v2/pricing.html pricing]) + + + \ No newline at end of file -- cgit v1.2.3 From 7975ab138b6ac54fc831613e4d3dfb913c5efbd2 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 16:14:47 +0300 Subject: STORM-1577 Removed support for Google Translate v1 API. --- indra/newview/app_settings/settings.xml | 10 ++-- indra/newview/llfloatertranslationsettings.cpp | 8 +-- indra/newview/lltranslate.cpp | 67 +++------------------- .../xui/en/floater_translation_settings.xml | 4 +- 4 files changed, 18 insertions(+), 71 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2549538df2..2f1a2093b2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10925,18 +10925,18 @@ TranslationService Comment - Translation API to use. (google_v1|google_v2|bing) + Translation API to use. (google|bing) Persist 1 Type String Value - google_v1 + bing - GoogleTranslateAPIv2Key + GoogleTranslateAPIKey Comment - Google Translate API v2 key + Google Translate API key Persist 1 Type @@ -10947,7 +10947,7 @@ BingTranslateAPIKey Comment - Bing AppID to use with the Microsoft Translator V2 API + Bing AppID to use with the Microsoft Translator API Persist 1 Type diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 56f101d149..107205aed3 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -75,7 +75,7 @@ void LLFloaterTranslationSettings::onOpen(const LLSD& key) mLanguageCombo->setSelectedByValue(gSavedSettings.getString("TranslateLanguage"), TRUE); mTranslationServiceRadioGroup->setSelectedByValue(gSavedSettings.getString("TranslationService"), TRUE); mBingAPIKeyEditor->setText(gSavedSettings.getString("BingTranslateAPIKey")); - mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIv2Key")); + mGoogleAPIKeyEditor->setText(gSavedSettings.getString("GoogleTranslateAPIKey")); updateControlsEnabledState(); } @@ -104,7 +104,7 @@ bool LLFloaterTranslationSettings::validate() return false; } - if (service == "google_v2" && mGoogleAPIKeyEditor->getText().empty()) + if (service == "google" && mGoogleAPIKeyEditor->getText().empty()) { showError("no_google_api_key"); return false; @@ -129,7 +129,7 @@ void LLFloaterTranslationSettings::updateControlsEnabledState() mGoogleAPIKeyEditor->setEnabled(on); mBingAPIKeyEditor->setEnabled(service == "bing"); - mGoogleAPIKeyEditor->setEnabled(service == "google_v2"); + mGoogleAPIKeyEditor->setEnabled(service == "google"); } void LLFloaterTranslationSettings::onBtnOK() @@ -140,7 +140,7 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslateLanguage", mLanguageCombo->getSelectedValue().asString()); gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", mBingAPIKeyEditor->getText()); - gSavedSettings.setString("GoogleTranslateAPIv2Key", mGoogleAPIKeyEditor->getText()); + gSavedSettings.setString("GoogleTranslateAPIKey", mGoogleAPIKeyEditor->getText()); closeFloater(false); } } diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index e29ea373ce..6576cbbe64 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -59,57 +59,9 @@ protected: static const int STATUS_OK = 200; }; -class LLGoogleV1Handler : public LLTranslationAPIHandler +class LLGoogleHandler : public LLTranslationAPIHandler { - LOG_CLASS(LLGoogleV1Handler); - -public: - /*virtual*/ void getTranslateURL( - std::string &url, - const std::string &from_lang, - const std::string &to_lang, - const std::string &text) const - { - url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" - + LLURI::escape(text) - + "&langpair=" + from_lang + "%7C" + to_lang; - } - - /*virtual*/ bool parseResponse( - int& status, - const std::string& body, - std::string& translation, - std::string& detected_lang, - std::string& err_msg) const - { - Json::Value root; - Json::Reader reader; - - if (!reader.parse(body, root)) - { - err_msg = reader.getFormatedErrorMessages(); - return false; - } - - // This API doesn't return proper status in the HTTP response header, - // but it is in the body. - status = root["responseStatus"].asInt(); - if (status != STATUS_OK) - { - err_msg = root["responseDetails"].asString(); - return false; - } - - const Json::Value& response_data = root["responseData"]; - translation = response_data.get("translatedText", "").asString(); - detected_lang = response_data.get("detectedSourceLanguage", "").asString(); - return true; - } -}; - -class LLGoogleV2Handler : public LLTranslationAPIHandler -{ - LOG_CLASS(LLGoogleV2Handler); + LOG_CLASS(LLGoogleHandler); public: /*virtual*/ void getTranslateURL( @@ -159,7 +111,7 @@ public: private: static std::string getAPIKey() { - return gSavedSettings.getString("GoogleTranslateAPIv2Key"); + return gSavedSettings.getString("GoogleTranslateAPIKey"); } }; @@ -311,18 +263,13 @@ std::string LLTranslate::getTranslateLanguage() // static const LLTranslationAPIHandler& LLTranslate::getPreferredHandler() { - static LLGoogleV1Handler google_v1; - static LLGoogleV2Handler google_v2; - static LLBingHandler bing; + static LLGoogleHandler google; + static LLBingHandler bing; std::string service = gSavedSettings.getString("TranslationService"); - if (service == "google_v2") - { - return google_v2; - } - else if (service == "google_v1") + if (service == "google") { - return google_v1; + return google; } return bing; diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml index 40a176830c..f21f64fcf6 100644 --- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -137,10 +137,10 @@ layout="topleft" name="bing" /> -- cgit v1.2.3 From 1fad7d997d99715cc88b6e69ae325f28be413206 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 19:12:35 +0300 Subject: STORM-1577 Made parsing translation responses more robust. JsonCpp is prone to aborting the program on failed assertions, so be super-careful and verify the response format. --- indra/newview/lltranslate.cpp | 72 +++++++++++++++++++++++--- indra/newview/skins/default/xui/en/strings.xml | 3 ++ 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 6576cbbe64..895d8f78eb 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -31,6 +31,7 @@ #include #include "llbufferstream.h" +#include "lltrans.h" #include "llui.h" #include "llversioninfo.h" #include "llviewercontrol.h" @@ -94,21 +95,66 @@ public: return false; } + if (!root.isObject()) // empty response? should not happen + { + return false; + } + if (status != STATUS_OK) { - const Json::Value& error = root["error"]; - err_msg = error["message"].asString(); - status = error["code"].asInt(); + // Request failed. Extract error message from the response. + parseErrorResponse(root, status, err_msg); return false; } - const Json::Value& response_data = root["data"]["translations"][0U]; - translation = response_data["translatedText"].asString(); - detected_lang = response_data["detectedSourceLanguage"].asString(); - return true; + // Request succeeded, extract translation from the response. + return parseTranslation(root, translation, detected_lang); } private: + static void parseErrorResponse( + const Json::Value& root, + int& status, + std::string& err_msg) + { + const Json::Value& error = root.get("error", 0); + if (!error.isObject() || !error.isMember("message") || !error.isMember("code")) + { + return; + } + + err_msg = error["message"].asString(); + status = error["code"].asInt(); + } + + static bool parseTranslation( + const Json::Value& root, + std::string& translation, + std::string& detected_lang) + { + const Json::Value& data = root.get("data", 0); + if (!data.isObject() || !data.isMember("translations")) + { + return false; + } + + const Json::Value& translations = data["translations"]; + if (!translations.isArray() || translations.size() == 0) + { + return false; + } + + const Json::Value& first = translations[0U]; + if (!first.isObject() || !first.isMember("translatedText")) + { + return false; + } + + translation = first["translatedText"].asString(); + detected_lang = first.get("detectedSourceLanguage", "").asString(); + return true; + } + static std::string getAPIKey() { return gSavedSettings.getString("GoogleTranslateAPIKey"); @@ -143,7 +189,12 @@ public: { if (status != STATUS_OK) { - size_t begin = body.find("Message: "); + static const std::string MSG_BEGIN_MARKER = "Message: "; + size_t begin = body.find(MSG_BEGIN_MARKER); + if (begin != std::string::npos) + { + begin += MSG_BEGIN_MARKER.size(); + } size_t end = body.find("

", begin); err_msg = body.substr(begin, end-begin); LLStringUtil::replaceString(err_msg, " ", ""); // strip CR @@ -211,6 +262,11 @@ void LLTranslate::TranslationReceiver::completedRaw( } else { + if (err_msg.empty()) + { + err_msg = LLTrans::getString("TranslationResponseParseError"); + } + llwarns << "Translation request failed: " << err_msg << llendl; LL_DEBUGS("Translate") << "HTTP status: " << status << " " << reason << LL_ENDL; LL_DEBUGS("Translate") << "Error response body: " << body << LL_ENDL; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2094275bed..146665b47d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3502,6 +3502,9 @@ Try enclosing path to the editor with double quotes. Error parsing the external editor command. External editor failed to run. + + Error parsing translation response. + Esc Space -- cgit v1.2.3 From ef01821337a0dc428fd090ae94c8cc9d9a13bdb5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 7 Sep 2011 19:29:57 +0300 Subject: STORM-1577 WIP Removed old translation settings controls. They are now superceded with a separate floater. --- .../default/xui/en/panel_preferences_chat.xml | 119 +-------------------- 1 file changed, 2 insertions(+), 117 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 3fbf484ab2..28db34f4d4 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -204,129 +204,14 @@ name="nearby_toasts_fadingtime" top_pad="3" width="325" /> - - - - - Use machine translation while chatting (powered by Google) - - - Translate chat into: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml deleted file mode 100644 index 477f210352..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Loading... - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml b/indra/newview/skins/minimal/xui/en/floater_media_browser.xml deleted file mode 100644 index 4862146c94..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - http://www.secondlife.com - - - http://support.secondlife.com - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml b/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml deleted file mode 100644 index 74ac885202..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml b/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml deleted file mode 100644 index 83b1260620..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_web_content.xml b/indra/newview/skins/minimal/xui/en/floater_web_content.xml deleted file mode 100644 index 1d9a967d5a..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_web_content.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml b/indra/newview/skins/minimal/xui/en/inspect_avatar.xml deleted file mode 100644 index 853d5f8735..0000000000 --- a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -[AGE] - - -[SL_PROFILE] - - - - - - This is my second life description and I really think it is great. But for some reason my description is super extra long because I like to talk a whole lot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml deleted file mode 100644 index abddc59296..0000000000 --- a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - + -- cgit v1.2.3 From cb699e3f2d64999e9817d0c4df5b7f9484e8e722 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 27 Sep 2011 10:52:47 -0700 Subject: EXP-1252 Opening chat history crashes browser (from dev work in progress) EXP-1253 Entering text in chat bar does not show for other users (dev work in progress) --- indra/newview/llbottomtray.cpp | 6 +++--- indra/newview/llnearbychat.cpp | 39 +++++++-------------------------------- indra/newview/llnearbychat.h | 6 +++--- 3 files changed, 13 insertions(+), 38 deletions(-) diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 7a60903950..55c63edd74 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -400,7 +400,7 @@ void LLBottomTray::onMouselookModeOut() { mIsInLiteMode = false; mBottomTrayLite->setVisible(FALSE); - mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); + //mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); setVisible(TRUE); } @@ -413,8 +413,8 @@ void LLBottomTray::onMouselookModeIn() getParent()->addChild(mBottomTrayLite); mBottomTrayLite->setShape(getLocalRect()); - mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); - mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); + //mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); + //mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); mIsInLiteMode = true; } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 361912a5cb..8d57ae3a32 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -58,7 +58,7 @@ static const S32 RESIZE_BAR_THICKNESS = 3; LLNearbyChat::LLNearbyChat(const LLSD& key) - : LLDockableFloater(NULL, false, false, key) + : LLFloater(key) ,mChatHistory(NULL) { @@ -86,20 +86,9 @@ BOOL LLNearbyChat::postBuild() mChatHistory = getChild("chat_history"); - if(!LLDockableFloater::postBuild()) + if(!LLFloater::postBuild()) return false; - if (getDockControl() == NULL) - { - setDockControl(new LLDockControl( - LLFloaterReg::getInstance("chat_bar"), this, - getDockTongue(), LLDockControl::TOP, boost::bind(&LLNearbyChat::getAllowedRect, this, _1))); - } - - //fix for EXT-4621 - //chrome="true" prevents floater from stilling capture - setIsChrome(true); - //chrome="true" hides floater caption if (mDragHandle) mDragHandle->setTitleVisible(TRUE); @@ -118,20 +107,6 @@ void LLNearbyChat::applySavedVariables() setRect(rect); } } - - - if(!LLFloater::getControlGroup()->controlExists(mDocStateControl)) - { - setDocked(true); - } - else - { - if (mDocStateControl.size() > 1) - { - bool dockState = LLFloater::getControlGroup()->getBOOL(mDocStateControl); - setDocked(dockState); - } - } } std::string appendTime() @@ -229,17 +204,17 @@ void LLNearbyChat::setVisible(BOOL visible) } } - LLDockableFloater::setVisible(visible); + LLFloater::setVisible(visible); } void LLNearbyChat::onOpen(const LLSD& key ) { - LLDockableFloater::onOpen(key); + LLFloater::onOpen(key); } void LLNearbyChat::setRect (const LLRect &rect) { - LLDockableFloater::setRect(rect); + LLFloater::setRect(rect); } void LLNearbyChat::getAllowedRect(LLRect& rect) @@ -367,7 +342,7 @@ BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) if(mChatHistory) mChatHistory->setFocus(TRUE); - return LLDockableFloater::handleMouseDown(x, y, mask); + return LLFloater::handleMouseDown(x, y, mask); } void LLNearbyChat::draw() @@ -380,5 +355,5 @@ void LLNearbyChat::draw() setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); } - LLDockableFloater::draw(); + LLFloater::draw(); } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 2ea79797f8..834a31bbf0 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -1,4 +1,4 @@ -/** + /** * @file llnearbychat.h * @brief nearby chat history scrolling panel implementation * @@ -27,14 +27,14 @@ #ifndef LL_LLNEARBYCHAT_H_ #define LL_LLNEARBYCHAT_H_ -#include "lldockablefloater.h" #include "llscrollbar.h" #include "llviewerchat.h" +#include "llfloater.h" class LLResizeBar; class LLChatHistory; -class LLNearbyChat: public LLDockableFloater +class LLNearbyChat: public LLFloater { public: LLNearbyChat(const LLSD& key); -- cgit v1.2.3 From 0f3221e25d6261d7f29b5b37391156c07fde1d0c Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 27 Sep 2011 21:05:05 +0300 Subject: EXP-1225 FIXED Added a floater for My Inventory side tab. - Replaced calls to LLSideTray with LLFloaterSidePanelContainer. - Added LLFloaterSidePanelContainer::getPanel() for getting custom type panels. --- indra/newview/llavataractions.cpp | 12 +++-- indra/newview/llfloatersidepanelcontainer.cpp | 18 ++++++- indra/newview/llfloatersidepanelcontainer.h | 23 +++++++++ indra/newview/llinspectobject.cpp | 3 +- indra/newview/llinventoryfunctions.cpp | 17 +++++-- indra/newview/llinventorypanel.cpp | 57 ++++++++-------------- indra/newview/llpanelmaininventory.cpp | 12 +++-- indra/newview/llpanelmarketplaceinbox.cpp | 16 +++--- indra/newview/llpanelmarketplaceoutbox.cpp | 17 ++++--- indra/newview/llsidepanelinventory.cpp | 20 +++++--- indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewerinventory.cpp | 3 +- indra/newview/llviewermenu.cpp | 14 +++--- .../skins/default/xui/en/floater_my_inventory.xml | 20 ++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 4 +- .../skins/minimal/xui/en/panel_bottomtray.xml | 2 +- 16 files changed, 158 insertions(+), 81 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_my_inventory.xml diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4cdfcea64e..efb46166b8 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -47,6 +47,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterwebcontent.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -438,8 +439,7 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) void LLAvatarActions::share(const LLUUID& id) { LLSD key; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - + LLFloaterSidePanelContainer::showPanel("my_inventory", key); LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id); @@ -696,9 +696,11 @@ std::set LLAvatarActions::getInventorySelectedUUIDs() if (inventory_selected_uuids.empty()) { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + } } return inventory_selected_uuids; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index cf66fd1792..c73ec90a12 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -33,6 +33,9 @@ #include "llsidetraypanelcontainer.h" #include "lltransientfloatermgr.h" +//static +const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); + LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params) : LLFloater(key, params) { @@ -48,7 +51,7 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild("main_panel")->onOpen(key); + getChild(sMainPanelName)->onOpen(key); } LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) @@ -82,6 +85,17 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) { - floaterp->openChildPanel("main_panel", panel_name); + floaterp->openChildPanel(sMainPanelName, panel_name); } } + +LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); + if (floaterp) + { + return floaterp->findChild(panel_name, true); + } + + return NULL; +} diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 7b4e7643ae..0d17a14c0b 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -51,6 +51,29 @@ public: LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& panel_name); + + static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName); + + /** + * Gets the panel of given type T (doesn't show it or do anything else with it). + * + * @param floater_name a string specifying the floater to be searched for a child panel. + * @param panel_name a string specifying the child panel to get. + * @returns a pointer to the panel of given type T. + */ + template + static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName) + { + T* panel = dynamic_cast(getPanel(floater_name, panel_name)); + if (!panel) + { + llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; + } + return panel; + } + +private: + static const std::string sMainPanelName; }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index ee076f68ea..29d7a4a6b0 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -28,6 +28,7 @@ #include "llinspectobject.h" // Viewer +#include "llfloatersidepanelcontainer.h" #include "llinspect.h" #include "llmediaentry.h" #include "llnotificationsutil.h" // *TODO: Eliminate, add LLNotificationsUtil wrapper @@ -640,7 +641,7 @@ void LLInspectObject::onClickMoreInfo() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); closeFloater(); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 0af013fde5..acec02b507 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -47,6 +47,7 @@ #include "llappviewer.h" //#include "llfirstuse.h" #include "llfloaterinventory.h" +#include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llfolderview.h" #include "llgesturemgr.h" @@ -459,22 +460,28 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id) { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", item_uuid).with("object", object_id)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", item_uuid).with("object", object_id)); } void show_item_profile(const LLUUID& item_uuid) { LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid); - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", linked_uuid)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", linked_uuid)); } void show_item_original(const LLUUID& item_uuid) { + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) + { + llwarns << "Could not find My Inventory floater" << llendl; + return; + } + //sidetray inventory panel - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); - bool reset_inventory_filter = !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"); + bool reset_inventory_filter = !floater_my_inventory->isInVisibleChain(); LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (!active_panel) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 173e5c6ae6..c4f810fc93 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -35,6 +35,7 @@ #include "llavataractions.h" #include "llfloaterinventory.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llimfloater.h" #include "llimview.h" @@ -1071,10 +1072,9 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) BOOL is_inventorysp_active() { - if (!LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) return FALSE; - LLSidepanelInventory *inventorySP = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (!inventorySP) return FALSE; - return inventorySP->isMainInventoryPanelActive(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE; + return sidepanel_inventory->isMainInventoryPanelActive(); } // static @@ -1084,34 +1084,24 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) LLInventoryPanel* res = NULL; LLFloater* active_inv_floaterp = NULL; - // A. If the inventory side panel is open, use that preferably. - if (is_inventorysp_active()) + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) { - LLSidepanelInventory *inventorySP = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (inventorySP) - { - return inventorySP->getActivePanel(); - } + llwarns << "Could not find My Inventory floater" << llendl; + return FALSE; } - // or if it is in floater undocked from sidetray get it and remember z order of floater to later compare it - // with other inventory floaters order. - else if (!LLSideTray::getInstance()->isTabAttached("sidebar_inventory")) + + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + + // A. If the inventory side panel floater is open, use that preferably. + if (is_inventorysp_active()) { - LLSidepanelInventory *inventorySP = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - LLFloater* inv_floater = LLFloaterReg::findInstance("side_bar_tab", LLSD("sidebar_inventory")); - if (inventorySP && inv_floater) - { - res = inventorySP->getActivePanel(); - z_min = gFloaterView->getZOrder(inv_floater); - active_inv_floaterp = inv_floater; - } - else - { - llwarns << "Inventory tab is detached from sidetray, but either panel or floater were not found!" << llendl; - } + // Get the floater's z order to compare it to other inventory floaters' order later. + res = sidepanel_inventory->getActivePanel(); + z_min = gFloaterView->getZOrder(floater_my_inventory); + active_inv_floaterp = floater_my_inventory; } - + // B. Iterate through the inventory floaters and return whichever is on top. LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) @@ -1141,14 +1131,9 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) // C. If no panels are open and we don't want to force open a panel, then just abort out. if (!auto_open) return NULL; - // D. Open the inventory side panel and use that. - LLSD key; - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast(LLSideTray::getInstance()->showPanel("sidepanel_inventory", key)); - if (sidepanel_inventory) - { - return sidepanel_inventory->getActivePanel(); - } + // D. Open the inventory side panel floater and use that. + floater_my_inventory->openFloater(); + return sidepanel_inventory->getActivePanel(); return NULL; } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 858f5cf575..c1341af2ef 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -38,6 +38,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llfiltereditor.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterreg.h" #include "llmenubutton.h" #include "lloutfitobserver.h" @@ -579,8 +580,13 @@ void LLPanelMainInventory::updateItemcountText() void LLPanelMainInventory::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (!sidepanel_inventory) + { + llwarns << "Could not find Inventory Panel in My Inventory floater" << llendl; + return; + } + sidepanel_inventory->clearSelections(false, true, true); } @@ -1164,7 +1170,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) if (command_name == "share") { - LLSidepanelInventory* parent = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel("my_inventory"); return parent ? parent->canShare() : FALSE; } diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 2cb91f771f..a412eabc0a 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -32,6 +32,7 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llsidepanelinventory.h" #include "llviewercontrol.h" @@ -67,7 +68,7 @@ BOOL LLPanelMarketplaceInbox::postBuild() void LLPanelMarketplaceInbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); sidepanel_inventory->updateVerbs(); } @@ -112,9 +113,11 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() void LLPanelMarketplaceInbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, false, true); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, false, true); + } gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); } @@ -185,9 +188,10 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const { std::string item_count_str(""); + LLPanel *inventory_panel = LLFloaterSidePanelContainer::getPanel("my_inventory"); + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel - if (getParent()->getVisible() && - (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) + if (getParent()->getVisible() && inventory_panel && !inventory_panel->isInVisibleChain()) { U32 item_count = getFreshItemCount(); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 839369bffe..f0a4b9898d 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -33,6 +33,7 @@ #include "llbutton.h" #include "llcoros.h" #include "lleventcoro.h" +#include "llfloatersidepanelcontainer.h" #include "llinventorypanel.h" #include "llloadingindicator.h" #include "llnotificationsutil.h" @@ -89,16 +90,20 @@ void LLPanelMarketplaceOutbox::handleLoginComplete() void LLPanelMarketplaceOutbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, true, false); + LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, true, false); + } } void LLPanelMarketplaceOutbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->updateVerbs(); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->updateVerbs(); + } } LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel() diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 9814e5b81a..e223de5469 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -34,6 +34,7 @@ #include "llbutton.h" #include "lldate.h" #include "llfirstuse.h" +#include "llfloatersidepanelcontainer.h" #include "llfoldertype.h" #include "llhttpclient.h" #include "llinventorybridge.h" @@ -172,16 +173,20 @@ LLSidepanelInventory::~LLSidepanelInventory() void handleInventoryDisplayInboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + } } void handleInventoryDisplayOutboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + } } BOOL LLSidepanelInventory::postBuild() @@ -283,6 +288,9 @@ BOOL LLSidepanelInventory::postBuild() gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); + // Update the verbs buttons state. + updateVerbs(); + return TRUE; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b30ef11978..bca166e390 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -223,6 +223,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("my_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("my_profile", "floater_my_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ad65a8846c..d798f1900f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -35,6 +35,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llviewerfoldertype.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llviewercontrol.h" #include "llconsole.h" @@ -220,7 +221,7 @@ public: // support secondlife:///app/inventory/show if (params[0].asString() == "show") { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD()); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD()); return true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 63d6e0ac30..a71900167c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2634,7 +2634,7 @@ void handle_object_inspect() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); } /* @@ -5661,18 +5661,18 @@ class LLShowSidetrayPanel : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); - LLPanel* panel = LLSideTray::getInstance()->getPanel(panel_name); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel(floater_name); if (panel) { if (panel->isInVisibleChain()) { - LLSideTray::getInstance()->hidePanel(panel_name); + LLFloaterReg::getInstance(floater_name)->closeFloater(); } else { - LLSideTray::getInstance()->showPanel(panel_name); + LLFloaterReg::getInstance(floater_name)->openFloater(); } } return true; @@ -5683,9 +5683,9 @@ class LLSidetrayPanelVisible : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); // Toggle the panel - if (LLSideTray::getInstance()->isPanelActive(panel_name)) + if (LLFloaterReg::getInstance(floater_name)->isInVisibleChain()) { return true; } diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml new file mode 100644 index 0000000000..fd03a5324e --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml @@ -0,0 +1,20 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 36ebe73753..2e9a66de5b 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -67,10 +67,10 @@ visible="true"> + parameter="my_inventory" /> + parameter="my_inventory" /> + parameter="people" /> Date: Tue, 27 Sep 2011 22:06:56 +0300 Subject: EXP-1226 FIXED (Create and register a floater for Appearance side tab) - Added xml for a new floater Appearance and registred it in the floaterreg - Removed side tray dependencies - Added static helper method: LLFloaterSidePanelContainer::getPanel --- indra/newview/llagentwearables.cpp | 3 ++- indra/newview/llappearancemgr.cpp | 9 +++++---- indra/newview/llavataractions.cpp | 3 ++- indra/newview/llcofwearables.cpp | 5 +++-- indra/newview/llfloatersidepanelcontainer.cpp | 18 ++++++++++++++++-- indra/newview/llfloatersidepanelcontainer.h | 5 +++++ indra/newview/llinventorybridge.cpp | 2 +- indra/newview/lloutfitslist.cpp | 3 ++- indra/newview/llpaneloutfitsinventory.cpp | 8 ++++---- indra/newview/llpanelwearing.cpp | 3 ++- indra/newview/llsidepanelappearance.cpp | 3 ++- indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewerinventory.cpp | 3 ++- indra/newview/llviewermenu.cpp | 10 +++++----- indra/newview/llwearable.cpp | 7 ++++--- .../skins/default/xui/en/floater_my_appearance.xml | 20 ++++++++++++++++++++ 16 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_my_appearance.xml diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index b9125ec8d3..404cd8e5b6 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -33,6 +33,7 @@ #include "llagentwearablesfetch.h" #include "llappearancemgr.h" #include "llcallbacklist.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -2015,7 +2016,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) } const BOOL disable_camera_switch = LLWearableType::getDisableCameraSwitch(wearable->getType()); - LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance"); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance"); LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3cb9b77010..c638f881a5 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -34,6 +34,7 @@ #include "llattachmentsmgr.h" #include "llcommandhandler.h" #include "lleventtimer.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -116,7 +117,7 @@ public: return true; } - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD()); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); return true; } }; @@ -1505,7 +1506,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) void LLAppearanceMgr::updatePanelOutfitName(const std::string& name) { LLSidepanelAppearance* panel_appearance = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel_appearance) { panel_appearance->refreshCurrentOutfitName(name); @@ -1943,7 +1944,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append); @@ -2468,7 +2469,7 @@ public: LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); } LLOutfitsList *outfits_list = - dynamic_cast(LLSideTray::getInstance()->getPanel("outfitslist_tab")); + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); if (outfits_list) { outfits_list->setSelectedOutfitByUUID(mFolderID); diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4cdfcea64e..db5bbf7167 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -47,6 +47,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterwebcontent.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -462,7 +463,7 @@ namespace action_give_inventory */ static LLInventoryPanel* get_outfit_editor_inventory_panel() { - LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (NULL == panel_outfit_edit) return NULL; LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild("folder_view"); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 254c0adef1..80e0cca780 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -33,6 +33,7 @@ #include "llagentdata.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventory.h" #include "llinventoryfunctions.h" #include "lllistcontextmenu.h" @@ -165,7 +166,7 @@ protected: // absent instance. Explicit relations between components avoids situations // when we tries to construct instance with unsatisfied implicit input conditions. LLPanelOutfitEdit * panel_outfit_edit = - dynamic_cast (LLSideTray::getInstance()->getPanel( + dynamic_cast (LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (panel_outfit_edit != NULL) { @@ -237,7 +238,7 @@ protected: // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel(). // LLSideTray::getInstance()->getPanel() is rather slow variant - LLPanelOutfitEdit* panel_oe = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_oe = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id)); registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id)); diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index cff46e80eb..ab874e4b9f 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -33,6 +33,9 @@ #include "llsidetraypanelcontainer.h" #include "lltransientfloatermgr.h" +//static +const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); + LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params) : LLFloater(key, params) { @@ -48,7 +51,7 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild("main_panel")->onOpen(key); + getChild(sMainPanelName)->onOpen(key); } LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) @@ -82,6 +85,17 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) { - floaterp->openChildPanel("main_panel", panel_name); + floaterp->openChildPanel(sMainPanelName, panel_name); } } + +LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); + if (floaterp) + { + return floaterp->findChild(panel_name, true); + } + + return NULL; +} diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 7b4e7643ae..5c05f26f45 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -42,6 +42,9 @@ */ class LLFloaterSidePanelContainer : public LLFloater { +private: + static const std::string sMainPanelName; + public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); @@ -51,6 +54,8 @@ public: LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& panel_name); + + static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName); }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0b3d6d8030..b6041c7f31 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4781,7 +4781,7 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category ) if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 10887aa53a..c2739867b1 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -35,6 +35,7 @@ #include "llaccordionctrltab.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" @@ -327,7 +328,7 @@ protected: static void editOutfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } static void renameOutfit(const LLUUID& outfit_cat_id) diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index a90f864ae2..3ac0d6616b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -31,6 +31,7 @@ #include "llnotificationsutil.h" #include "lltabcontainer.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llagentwearables.h" @@ -222,7 +223,7 @@ void LLPanelOutfitsInventory::onSave() //static LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance() { - return dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfits_inventory")); + return dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfits_inventory")); } ////////////////////////////////////////////////////////////////////////////////// @@ -319,8 +320,7 @@ void LLPanelOutfitsInventory::onWearablesLoading() // static LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() { - static LLSidepanelAppearance* panel_appearance = - dynamic_cast - (LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance* panel_appearance = + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); return panel_appearance; } diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index f19b54c1d4..87e9bb7b28 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -31,6 +31,7 @@ #include "lltoggleablemenu.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" @@ -44,7 +45,7 @@ // Context menu and Gear menu helper. static void edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 28ec11d1c7..a356013830 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -32,6 +32,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llinventorypanel.h" #include "llfiltereditor.h" @@ -456,7 +457,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) //static void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance"); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); LLSidepanelAppearance *panel = dynamic_cast(data); if (panel) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b28373c6d5..665e0a2bd6 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -161,6 +161,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ad65a8846c..6b5b47d0db 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -34,6 +34,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" +#include "llfloatersidepanelcontainer.h" #include "llviewerfoldertype.h" #include "llfolderview.h" #include "llviewercontrol.h" @@ -976,7 +977,7 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item) if( gAgentCamera.cameraCustomizeAvatar() ) { // If we're in appearance editing mode, the current tab may need to be refreshed - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel) { panel->showDefaultSubpart(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 63d6e0ac30..1dd5b05818 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3758,7 +3758,7 @@ void handle_reset_view() if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit selector should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); @@ -5576,22 +5576,22 @@ void handle_viewer_disable_message_log(void*) void handle_customize_avatar() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } void handle_edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } void handle_edit_shape() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_shape")); } void handle_edit_physics() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_physics")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_physics")); } void handle_report_abuse() diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index d1c0990f90..276e8f462d 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -30,6 +30,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "lldictionary.h" +#include "llfloatersidepanelcontainer.h" #include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llviewertexturelist.h" @@ -697,7 +698,7 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake if(gAgentCamera.cameraCustomizeAvatar()) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } gAgentAvatarp->updateVisualParams(); @@ -967,7 +968,7 @@ void LLWearable::revertValues() syncImages(mSavedTEMap, mTEMap); - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); @@ -1008,7 +1009,7 @@ void LLWearable::saveValues() syncImages(mTEMap, mSavedTEMap); - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml new file mode 100644 index 0000000000..8f97887b3f --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -0,0 +1,20 @@ + + + + + -- cgit v1.2.3 From d0b5a521f21ab8002fb5d9a4d11cee6c2385dbf3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 27 Sep 2011 14:26:53 -0500 Subject: SH-2244 Make emissive attribute match actual number of components coming in --- indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl | 4 ++-- .../newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl | 4 ++-- indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 50e92c191b..7b108e4562 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; ATTRIBUTE float texture_index; -ATTRIBUTE float emissive; +ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -57,7 +57,7 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = vec4(0,0,0,emissive); + vertex_color = emissive; fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index bf4c45f18f..8c38d5df2a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -28,7 +28,7 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float emissive; +ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; @@ -50,7 +50,7 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = vec4(0,0,0,emissive); + vertex_color = emissive; gl_Position = projection_matrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl index 77b0806bfc..35feacb7b1 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; ATTRIBUTE float texture_index; -ATTRIBUTE float emissive; +ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; @@ -50,7 +50,7 @@ void main() vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); calcAtmospherics(pos.xyz); - vertex_color = vec4(0,0,0,emissive); + vertex_color = emissive; fog_depth = pos.z; } -- cgit v1.2.3 From b6feeea2b550b981dbb04558902020e8cae16f7b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 27 Sep 2011 12:40:06 -0700 Subject: * Updated toybox to center bottom button and add delimeter --- indra/newview/skins/default/xui/en/floater_toybox.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 60a39b0bff..092eddaa53 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -46,6 +46,7 @@ - + top="85" /> + + -- cgit v1.2.3 From c7f5aebbb71228b705059be248e82e83ee0f9475 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 27 Sep 2011 15:41:41 -0700 Subject: Nearby chat panel --- .../skins/default/xui/en/panel_nearby_chat.xml | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/panel_nearby_chat.xml diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml new file mode 100644 index 0000000000..f766236b2e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -0,0 +1,35 @@ + + + + + -- cgit v1.2.3 From 8912a9bef62386e5eecaa61ba9079d507ae16d90 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Sep 2011 15:53:38 -0700 Subject: EXP-1258 WIP toggle buttons between icons and icons+text modes better button sizing also disabled context menu for non-toolbar region --- indra/llui/llbutton.cpp | 24 ++++++++++++++++++------ indra/llui/llbutton.h | 1 + indra/llui/lltoolbar.cpp | 4 +++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 06781f1bdf..02ac928dfb 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -554,6 +554,16 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) return TRUE; } +void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) +{ + overlay_width = mImageOverlay->getWidth(); + overlay_height = mImageOverlay->getHeight(); + + F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); + overlay_width = llround((F32)overlay_width * scale_factor); + overlay_height = llround((F32)overlay_height * scale_factor); +} + // virtual void LLButton::draw() @@ -781,12 +791,10 @@ void LLButton::draw() if (mImageOverlay.notNull()) { // get max width and height (discard level 0) - S32 overlay_width = mImageOverlay->getWidth(); - S32 overlay_height = mImageOverlay->getHeight(); + S32 overlay_width; + S32 overlay_height; - F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); - overlay_width = llround((F32)overlay_width * scale_factor); - overlay_height = llround((F32)overlay_height * scale_factor); + getOverlayImageSize(overlay_width, overlay_height); S32 center_x = getLocalRect().getCenterX(); S32 center_y = getLocalRect().getCenterY(); @@ -994,11 +1002,15 @@ void LLButton::resize(LLUIString label) S32 min_width = label_width + mLeftHPad + mRightHPad; if (mImageOverlay) { + S32 overlay_width = mImageOverlay->getWidth(); + F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight(); + overlay_width = llround((F32)overlay_width * scale_factor); + switch(mImageOverlayAlignment) { case LLFontGL::LEFT: case LLFontGL::RIGHT: - min_width += mImageOverlay->getWidth() + mImgOverlayLabelSpace; + min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: break; diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index bc5e69fad5..08b45e01b3 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -270,6 +270,7 @@ public: protected: LLPointer getImageUnselected() const { return mImageUnselected; } LLPointer getImageSelected() const { return mImageSelected; } + void getOverlayImageSize(S32& overlay_width, S32& overlay_height); LLFrameTimer mMouseDownTimer; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 0c3052b1ab..9ca5a0f480 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -247,7 +247,9 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handle_it_here = !mReadOnly; + LLRect button_panel_rect; + mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this); + BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); if (handle_it_here) { -- cgit v1.2.3 From bce16356c9e1fb76bd92a3530375e4c6c7a5430a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Sep 2011 17:47:52 -0700 Subject: fixed wobble when toggling inbox/outbox --- indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 7a176ff367..2b5e3143a4 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -67,6 +67,8 @@ top="0" orientation="vertical" name="inbox_outbox_layout_stack" + open_time_constant="0.02" + close_time_constant="0.02" height="235" width="330"> Date: Tue, 27 Sep 2011 19:06:02 -0700 Subject: EXP-1258 WIP toggle buttons between icons and icons+text modes fixed button layout for icon+text layout stack now uses floating point precision to avoid clamping panels to 0 --- indra/llui/llbutton.cpp | 2 + indra/llui/lllayoutstack.cpp | 252 +++++++-------------- indra/llui/lllayoutstack.h | 18 +- indra/llui/lltoolbar.cpp | 40 ++-- .../skins/default/xui/en/floater_test_toolbar.xml | 4 + 5 files changed, 123 insertions(+), 193 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 02ac928dfb..e1bea086b2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -819,6 +819,7 @@ void LLButton::draw() { case LLFontGL::LEFT: text_left += overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( mLeftHPad, center_y - (overlay_height / 2), @@ -836,6 +837,7 @@ void LLButton::draw() break; case LLFontGL::RIGHT: text_right -= overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( getRect().getWidth() - mRightHPad - overlay_width, center_y - (overlay_height / 2), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 0d1f608e61..89b3f671a4 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -55,11 +55,12 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), - mFitContent(p.fit_content), mCollapsed(FALSE), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible - mResizeBar(NULL) + mResizeBar(NULL), + mFractionalSize(0.f), + mOrientation(LLLayoutStack::HORIZONTAL) { // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value if (p.expanded_min_dim.isProvided()) @@ -89,9 +90,22 @@ LLLayoutPanel::~LLLayoutPanel() mResizeBar = NULL; } -F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation) +void LLLayoutPanel::reshape(S32 width, S32 height, BOOL called_from_parent) { - if (orientation == LLLayoutStack::HORIZONTAL) + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + mFractionalSize += width - llround(mFractionalSize); + } + else + { + mFractionalSize += height - llround(mFractionalSize); + } + LLPanel::reshape(width, height, called_from_parent); +} + +F32 LLLayoutPanel::getCollapseFactor() +{ + if (mOrientation == LLLayoutStack::HORIZONTAL) { F32 collapse_amt = clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getWidth())); @@ -105,14 +119,6 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati } } -void LLLayoutPanel::fitToContent() -{ - if (mFitContent) - { - setShape(calcBoundingRect()); - } -} - // // LLLayoutStack // @@ -158,11 +164,11 @@ void LLLayoutStack::draw() // scale clipping rectangle by visible amount if (mOrientation == HORIZONTAL) { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); } else { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); } LLPanel* panelp = (*panel_it); @@ -202,36 +208,15 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) LLLayoutPanel* panelp = dynamic_cast(child); if (panelp) { + panelp->mFractionalSize = (mOrientation == HORIZONTAL) + ? panelp->getRect().getWidth() + : panelp->getRect().getHeight(); + panelp->setOrientation(mOrientation); mPanels.push_back(panelp); } return LLView::addChild(child, tab_group); } - -S32 LLLayoutStack::getDefaultHeight(S32 cur_height) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == HORIZONTAL) - { - cur_height = llmax(mMinHeight, getRect().getHeight()); - } - - return cur_height; -} - -S32 LLLayoutStack::getDefaultWidth(S32 cur_width) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == VERTICAL) - { - cur_width = llmax(mMinWidth, getRect().getWidth()); - } - - return cur_width; -} - void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front) { LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); @@ -326,14 +311,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize) createResizeBars(); // calculate current extents - S32 total_width = 0; - S32 total_height = 0; + F32 total_size = 0.f; + // + // animate visibility + // e_panel_list_t::iterator panel_it; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - panelp->fitToContent(); if (panelp->getVisible()) { if (mAnimate) @@ -371,181 +357,110 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } } - if (panelp->mCollapsed) - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } - else - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } + F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - if (mOrientation == HORIZONTAL) + total_size += panelp->mFractionalSize * panelp->getCollapseFactor(); + // want n-1 panel gaps for n panels + if (panel_it != mPanels.begin()) { - // enforce minimize size constraint by default - if (panelp->getRect().getWidth() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRelevantMinDim(), panelp->getRect().getHeight()); - } - total_width += llround(panelp->getRect().getWidth() * panelp->getCollapseFactor(mOrientation)); - // want n-1 panel gaps for n panels - if (panel_it != mPanels.begin()) - { - total_width += mPanelSpacing; - } - } - else //VERTICAL - { - // enforce minimize size constraint by default - if (panelp->getRect().getHeight() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRect().getWidth(), panelp->getRelevantMinDim()); - } - total_height += llround(panelp->getRect().getHeight() * panelp->getCollapseFactor(mOrientation)); - if (panel_it != mPanels.begin()) - { - total_height += mPanelSpacing; - } + total_size += mPanelSpacing; } } S32 num_resizable_panels = 0; - S32 shrink_headroom_available = 0; - S32 shrink_headroom_total = 0; + F32 shrink_headroom_available = 0.f; + F32 shrink_headroom_total = 0.f; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { + LLLayoutPanel* panelp = (*panel_it); + // panels that are not fully visible do not count towards shrink headroom - if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f) + if (panelp->getCollapseFactor() < 1.f) { continue; } - S32 relevant_dimension = (mOrientation == HORIZONTAL) ? (*panel_it)->getRect().getWidth() : (*panel_it)->getRect().getHeight(); - S32 relevant_min = (*panel_it)->getRelevantMinDim(); + F32 cur_size = panelp->mFractionalSize; + F32 min_size = (F32)panelp->getRelevantMinDim(); // if currently resizing a panel or the panel is flagged as not automatically resizing // only track total available headroom, but don't use it for automatic resize logic - if ((*panel_it)->mResizeBar->hasMouseCapture() - || (!(*panel_it)->mAutoResize + if (panelp->mResizeBar->hasMouseCapture() + || (!panelp->mAutoResize && !force_resize)) { - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_total += cur_size - min_size; } else { num_resizable_panels++; - shrink_headroom_available += relevant_dimension - relevant_min; - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_available += cur_size - min_size; + shrink_headroom_total += cur_size - min_size; } } // calculate how many pixels need to be distributed among layout panels // positive means panels need to grow, negative means shrink - S32 pixels_to_distribute; - if (mOrientation == HORIZONTAL) - { - pixels_to_distribute = getRect().getWidth() - total_width; - } - else //VERTICAL - { - pixels_to_distribute = getRect().getHeight() - total_height; - } + F32 pixels_to_distribute = (mOrientation == HORIZONTAL) + ? getRect().getWidth() - total_size + : getRect().getHeight() - total_size; // now we distribute the pixels... - S32 cur_x = 0; - S32 cur_y = getRect().getHeight(); + F32 cur_x = 0.f; + F32 cur_y = (F32)getRect().getHeight(); for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - S32 cur_width = panelp->getRect().getWidth(); - S32 cur_height = panelp->getRect().getHeight(); - S32 new_width = cur_width; - S32 new_height = cur_height; - S32 relevant_min = panelp->getRelevantMinDim(); - - if (mOrientation == HORIZONTAL) - { - new_width = llmax(relevant_min, new_width); - } - else - { - new_height = llmax(relevant_min, new_height); - } - S32 delta_size = 0; + F32 min_size = panelp->getRelevantMinDim(); + F32 delta_size = 0.f; // if panel can automatically resize (not animating, and resize flag set)... - if (panelp->getCollapseFactor(mOrientation) == 1.f + if (panelp->getCollapseFactor() == 1.f && (force_resize || panelp->mAutoResize) && !panelp->mResizeBar->hasMouseCapture()) { - if (mOrientation == HORIZONTAL) + if (pixels_to_distribute < 0.f) { - // if we're shrinking - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) - ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) - : 0; - shrink_headroom_available -= (cur_width - relevant_min); - } - else - { - // grow all elements equally - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_width = llmax(relevant_min, cur_width + delta_size); + // shrink proportionally to amount over minimum + // so we can do this in one pass + delta_size = (shrink_headroom_available > 0.f) + ? pixels_to_distribute * ((F32)(panelp->mFractionalSize - min_size) / shrink_headroom_available) + : 0.f; + shrink_headroom_available -= (panelp->mFractionalSize - min_size); } else { - new_width = getDefaultWidth(new_width); - } - - if (mOrientation == VERTICAL) - { - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - relevant_min) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_height - relevant_min); - } - else - { - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_height = llmax(relevant_min, cur_height + delta_size); - } - else - { - new_height = getDefaultHeight(new_height); - } - } - else - { - if (mOrientation == HORIZONTAL) - { - new_height = getDefaultHeight(new_height); - } - else // VERTICAL - { - new_width = getDefaultWidth(new_width); + // grow all elements equally + delta_size = pixels_to_distribute / (F32)num_resizable_panels; + num_resizable_panels--; } + + panelp->mFractionalSize = llmax(min_size, panelp->mFractionalSize + delta_size); + pixels_to_distribute -= delta_size; } // adjust running headroom count based on new sizes shrink_headroom_total += delta_size; LLRect panel_rect; - panel_rect.setLeftTopAndSize(cur_x, cur_y, new_width, new_height); + if (mOrientation == HORIZONTAL) + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + llround(panelp->mFractionalSize), + getRect().getHeight()); + } + else + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + getRect().getWidth(), + llround(panelp->mFractionalSize)); + } panelp->setShape(panel_rect); LLRect resize_bar_rect = panel_rect; @@ -561,13 +476,14 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } (*panel_it)->mResizeBar->setRect(resize_bar_rect); + F32 size = ((*panel_it)->mFractionalSize * (*panel_it)->getCollapseFactor()) + (F32)mPanelSpacing; if (mOrientation == HORIZONTAL) { - cur_x += llround(new_width * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_x += size; } else //VERTICAL { - cur_y -= llround(new_height * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_y -= size; } } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 2ed32a2fa9..5d79505fc3 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -126,8 +126,6 @@ protected: private: void createResizeBars(); void calcMinExtents(); - S32 getDefaultHeight(S32 cur_height); - S32 getDefaultWidth(S32 cur_width); const ELayoutOrientation mOrientation; @@ -161,16 +159,14 @@ public: min_dim, max_dim; Optional user_resize, - auto_resize, - fit_content; + auto_resize; Params() : expanded_min_dim("expanded_min_dim", 0), min_dim("min_dim", 0), max_dim("max_dim", 0), user_resize("user_resize", true), - auto_resize("auto_resize", true), - fit_content("fit_content", false) + auto_resize("auto_resize", true) { addSynonym(min_dim, "min_width"); addSynonym(min_dim, "min_height"); @@ -183,6 +179,8 @@ public: void initFromParams(const Params& p); + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + S32 getMinDim() const { return mMinDim; } void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } @@ -204,11 +202,12 @@ public: return min_dim; } + void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } + protected: LLLayoutPanel(const Params& p); - F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); - void fitToContent(); + F32 getCollapseFactor(); bool mExpandedMinDimSpecified; S32 mExpandedMinDim; @@ -218,9 +217,10 @@ protected: bool mAutoResize; bool mUserResize; bool mCollapsed; - bool mFitContent; F32 mVisibleAmt; F32 mCollapseAmt; + F32 mFractionalSize; + LLLayoutStack::ELayoutOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 677d50a0c7..57a9151649 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -126,14 +126,13 @@ void LLToolBar::createContextMenu() { // Setup bindings specific to this instance for the context menu options - LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit_reg; commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); - LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_reg; enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); // Create the context menu - LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -146,10 +145,6 @@ void LLToolBar::createContextMenu() { llwarns << "Unable to load toolbars context menu." << llendl; } - - // Remove this instance's bindings - commit_reg.remove("Toolbars.EnableSetting"); - enable_reg.remove("Toolbars.CheckSetting"); } } @@ -184,7 +179,6 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) center_panel_p.rect = getLocalRect(); center_panel_p.auto_resize = false; center_panel_p.user_resize = false; - center_panel_p.fit_content = true; LLLayoutPanel* center_panel = LLUICtrlFactory::create(center_panel_p); mCenteringStack->addChild(center_panel); @@ -196,6 +190,11 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create(border_panel_p)); + BOOST_FOREACH(LLCommandId::Params params, p.commands) + { + addCommand(params); + } + mNeedsLayout = true; } @@ -207,8 +206,8 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { - mButtonCommands.push_back(commandId); - createButtons(); + mButtonCommands.push_back(commandId); + createButtons(); } return add_command; @@ -220,9 +219,9 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const if (commandId != LLCommandId::null) { - for (std::list::const_iterator cmd = mButtonCommands.begin(); cmd != mButtonCommands.end(); ++cmd) + BOOST_FOREACH(LLCommandId cmd, mButtonCommands) { - if ((*cmd) == commandId) + if (cmd == commandId) { has_command = true; break; @@ -410,11 +409,11 @@ void LLToolBar::updateLayoutAsNeeded() cur_start = row_pad_start; cur_row += max_row_girth + mPadBetween; max_row_girth = 0; - } + } - LLRect button_rect; - if (orientation == LLLayoutStack::HORIZONTAL) - { + LLRect button_rect; + if (orientation == LLLayoutStack::HORIZONTAL) + { button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight()); } else // VERTICAL @@ -460,6 +459,9 @@ void LLToolBar::updateLayoutAsNeeded() mButtonPanel->reshape(total_girth, max_row_length); } + // make parent fit button panel + mButtonPanel->getParent()->setShape(mButtonPanel->getLocalRect()); + // re-center toolbar buttons mCenteringStack->updateLayout(); @@ -470,7 +472,13 @@ void LLToolBar::updateLayoutAsNeeded() void LLToolBar::draw() { + if (mButtons.empty()) return; updateLayoutAsNeeded(); + // rect may have shifted during layout + LLUI::popMatrix(); + LLUI::pushMatrix(); + LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f); + LLUICtrl::draw(); } diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml index fbfbe51a69..067c1fed82 100644 --- a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -8,6 +8,7 @@ translate="false" width="500"> Date: Tue, 27 Sep 2011 19:22:09 -0700 Subject: EXP-1258 FIX toggle buttons between icons and icons+text modes fixed button layout for icon only buttons --- indra/llui/llbutton.cpp | 1 + indra/llui/lltoolbar.cpp | 30 ++++++++++++++++++------------ indra/llui/lltoolbar.h | 1 + 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e1bea086b2..f259e8027e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1015,6 +1015,7 @@ void LLButton::resize(LLUIString label) min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: + min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 57a9151649..c5219b11e8 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -207,7 +207,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { mButtonCommands.push_back(commandId); - createButtons(); + createButton(commandId); } return add_command; @@ -498,19 +498,25 @@ void LLToolBar::createButtons() BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { - LLCommand* commandp = LLCommandManager::instance().getCommand(command_id); - if (!commandp) continue; + createButton(command_id); + } - LLToolBarButton::Params button_p; - button_p.label = LLTrans::getString(commandp->labelRef()); - button_p.image_overlay = LLUI::getUIImage(commandp->icon()); - button_p.overwriteFrom(mButtonParams[mButtonType]); - LLToolBarButton* button = LLUICtrlFactory::create(button_p); +} - mButtons.push_back(button); - mButtonPanel->addChild(button); - } +void LLToolBar::createButton(const LLCommandId& id) +{ + LLCommand* commandp = LLCommandManager::instance().getCommand(id); + if (!commandp) return; + + LLToolBarButton::Params button_p; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.tool_tip = button_p.label(); + button_p.image_overlay = LLUI::getUIImage(commandp->icon()); + button_p.overwriteFrom(mButtonParams[mButtonType]); + LLToolBarButton* button = LLUICtrlFactory::create(button_p); + + mButtons.push_back(button); + mButtonPanel->addChild(button); mNeedsLayout = true; } - diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 75ae499a3d..02db58128c 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -135,6 +135,7 @@ private: void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); + void createButton(const LLCommandId& id); void resizeButtonsInRow(std::vector& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); -- cgit v1.2.3 From 04a5c45020e72e7e24eed1cc1f53014da92594e5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 20:24:00 -0700 Subject: EXP-1207 : Commented out the red and yellow debug draw on the toolbars --- indra/llui/lltoolbarview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 7047cca948..641c3eb0ab 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -193,7 +193,6 @@ void LLToolBarView::draw() if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); - if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) debug_print = true; if (debug_print) @@ -215,9 +214,9 @@ void LLToolBarView::draw() back_color_hori[VALPHA] = 0.5f; back_color_vert[VALPHA] = 0.5f; //gl_rect_2d(getLocalRect(), back_color, TRUE); - gl_rect_2d(bottom_rect, back_color_hori, TRUE); - gl_rect_2d(left_rect, back_color_vert, TRUE); - gl_rect_2d(right_rect, back_color_vert, TRUE); + //gl_rect_2d(bottom_rect, back_color_hori, TRUE); + //gl_rect_2d(left_rect, back_color_vert, TRUE); + //gl_rect_2d(right_rect, back_color_vert, TRUE); LLUICtrl::draw(); } -- cgit v1.2.3 From b234c23aa3c70ccac6d4332532a0da6184ec03db Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 20:51:26 -0700 Subject: EXP-1211 : Factorize code a bit --- indra/llui/lltoolbarview.cpp | 48 +++++++++++++++++--------------------------- indra/llui/lltoolbarview.h | 1 + 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 641c3eb0ab..73c8c99418 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -80,52 +80,25 @@ bool LLToolBarView::load() } // Add commands to each toolbar - // *TODO: factorize that code : tricky with Blocks though, simple lexical approach fails - LLCommandManager& mgr = LLCommandManager::instance(); - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarLeft->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarLeft); } } if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarRight->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarRight); } } if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarBottom->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarBottom); } } return true; @@ -179,6 +152,21 @@ bool LLToolBarView::hasCommand(const LLCommandId& commandId) const return has_command; } +bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) +{ + LLCommandManager& mgr = LLCommandManager::instance(); + if (mgr.getCommand(command)) + { + toolbar->addCommand(command); + } + else + { + llwarns << "Toolbars creation : the command " << command.name() << " cannot be found in the command manager" << llendl; + return false; + } + return true; +} + void LLToolBarView::draw() { static bool debug_print = true; diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 0f16b89ecc..208660da8e 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -78,6 +78,7 @@ protected: private: // Loads the toolbars from the existing user or default settings bool load(); // return false if load fails + bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; -- cgit v1.2.3 From 348a70181211b8fe37c569f8b3fb8324cc8c59ea Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 00:41:10 -0500 Subject: SH-2507 Shave some unused/redundant varying state and make the max texture index debug setting rebuild shaders to use no flow control when set to 1 or lower --- indra/llrender/llglslshader.cpp | 8 +-- indra/llrender/llglslshader.h | 2 +- indra/llrender/llshadermgr.cpp | 56 ++++++++++++--- indra/newview/app_settings/settings.xml | 2 +- .../shaders/class1/avatar/avatarV.glsl | 4 +- .../shaders/class1/deferred/alphaSkinnedV.glsl | 4 +- .../shaders/class1/deferred/alphaV.glsl | 10 +-- .../shaders/class1/deferred/avatarAlphaV.glsl | 4 +- .../shaders/class1/deferred/diffuseNoColorV.glsl | 2 +- .../shaders/class1/deferred/diffuseV.glsl | 7 +- .../shaders/class1/deferred/emissiveV.glsl | 10 +-- .../shaders/class1/deferred/fullbrightV.glsl | 10 +-- .../shaders/class1/environment/waterFogF.glsl | 2 +- .../shaders/class1/objects/emissiveSkinnedV.glsl | 4 +- .../shaders/class1/objects/emissiveV.glsl | 10 +-- .../shaders/class1/objects/fullbrightNoColorV.glsl | 4 +- .../class1/objects/fullbrightShinySkinnedV.glsl | 4 +- .../shaders/class1/objects/fullbrightShinyV.glsl | 4 +- .../shaders/class1/objects/fullbrightSkinnedV.glsl | 4 +- .../shaders/class1/objects/fullbrightV.glsl | 4 +- .../shaders/class1/objects/indexedTextureV.glsl | 34 +++++++++ .../shaders/class1/objects/nonindexedTextureV.glsl | 30 ++++++++ .../shaders/class1/objects/previewV.glsl | 4 +- .../shaders/class1/objects/shinyV.glsl | 4 +- .../shaders/class1/objects/simpleNoColorV.glsl | 4 +- .../shaders/class1/objects/simpleSkinnedV.glsl | 4 +- .../shaders/class1/objects/simpleV.glsl | 4 +- .../app_settings/shaders/class1/objects/treeV.glsl | 4 +- .../class1/windlight/atmosphericsVarsF.glsl | 5 +- .../class1/windlight/atmosphericsVarsV.glsl | 7 +- .../class1/windlight/atmosphericsVarsWaterF.glsl | 33 +++++++++ .../class1/windlight/atmosphericsVarsWaterV.glsl | 39 +++++++++++ .../shaders/class2/avatar/eyeballV.glsl | 4 +- .../shaders/class2/deferred/alphaSkinnedV.glsl | 4 +- .../shaders/class2/deferred/alphaV.glsl | 10 +-- .../shaders/class2/deferred/avatarAlphaV.glsl | 4 +- .../shaders/class2/objects/fullbrightShinyV.glsl | 10 ++- .../shaders/class2/objects/fullbrightV.glsl | 10 +-- .../shaders/class2/objects/shinyV.glsl | 11 +-- .../shaders/class2/objects/simpleNonIndexedV.glsl | 4 +- .../shaders/class2/objects/simpleV.glsl | 10 +-- .../class2/windlight/atmosphericsVarsF.glsl | 16 ++--- .../class2/windlight/atmosphericsVarsV.glsl | 36 +++++----- .../class2/windlight/atmosphericsVarsWaterF.glsl | 51 ++++++++++++++ .../class2/windlight/atmosphericsVarsWaterV.glsl | 81 ++++++++++++++++++++++ indra/newview/featuretable.txt | 1 + indra/newview/featuretable_xp.txt | 1 + indra/newview/llviewercontrol.cpp | 2 +- indra/newview/llviewershadermgr.cpp | 23 +++--- 49 files changed, 443 insertions(+), 162 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl create mode 100644 indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl create mode 100644 indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 674d6dcf7e..3b6cc084b1 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -51,6 +51,7 @@ using std::string; GLhandleARB LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; +S32 LLGLSLShader::sIndexedTextureChannels = NULL; bool LLGLSLShader::sNoFixedFunction = false; //UI shader -- declared here so llui_libtest will link properly @@ -125,13 +126,6 @@ BOOL LLGLSLShader::createShader(vector * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); -#if !LL_DARWIN - if (gGLManager.mGLVersion < 3.1f) - { //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support) - mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); - } -#endif // !LL_DARWIN - //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 04dc594d87..beef57796d 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -69,7 +69,7 @@ public: static GLhandleARB sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; - + static S32 sIndexedTextureChannels; static bool sNoFixedFunction; void unload(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 7dde24a437..16180c6831 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -81,7 +81,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) // NOTE order of shader object attaching is VERY IMPORTANT!!! if (features->calculatesAtmospherics) { - if (!shader->attachObject("windlight/atmosphericsVarsV.glsl")) + if (features->hasWaterFog) + { + if (!shader->attachObject("windlight/atmosphericsVarsWaterV.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("windlight/atmosphericsVarsV.glsl")) { return FALSE; } @@ -161,7 +168,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if(features->calculatesAtmospherics) { - if (!shader->attachObject("windlight/atmosphericsVarsF.glsl")) + if (features->hasWaterFog) + { + if (!shader->attachObject("windlight/atmosphericsVarsWaterF.glsl")) + { + return FALSE; + } + } + else if (!shader->attachObject("windlight/atmosphericsVarsF.glsl")) { return FALSE; } @@ -241,7 +255,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -280,7 +294,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } @@ -304,7 +318,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } else if (features->hasWaterFog) @@ -336,7 +350,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -355,7 +369,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -395,7 +409,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } @@ -419,7 +433,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } @@ -438,10 +452,26 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1; + shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } } } + + if (features->mIndexedTextureChannels <= 1) + { + if (!shader->attachObject("objects/nonindexedTextureV.glsl")) + { + return FALSE; + } + } + else + { + if (!shader->attachObject("objects/indexedTextureV.glsl")) + { + return FALSE; + } + } + return TRUE; } @@ -631,7 +661,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup(decl.c_str()); } - text[count++] = strdup("VARYING float vary_texture_index;\n"); + if (texture_index_channels > 1) + { + text[count++] = strdup("VARYING float vary_texture_index;\n"); + } + text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); text[count++] = strdup("{\n"); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ddc4f4ddd2..727851b4da 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7796,7 +7796,7 @@ Type U32 Value - 6 + 32
RenderDebugTextureBind diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index cf939e2df8..2901e18db8 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -31,7 +31,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -59,8 +59,6 @@ void main() gl_Position = projection_matrix * pos; - fog_depth = length(pos.xyz); - calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 15781bc92d..b09441f7eb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -49,7 +49,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; @@ -135,7 +135,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 74ee082bed..93b1a114db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -50,10 +50,10 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_light; VARYING vec3 vary_pointlight_col; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -98,7 +98,7 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -138,7 +138,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 12e88ca5dd..acbc3f7e15 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -48,7 +48,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; @@ -137,7 +137,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl index 7ed41cbcb9..9461e3e32e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -32,7 +32,7 @@ ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; VARYING vec3 vary_normal; -VARYING float vary_texture_index; + VARYING vec2 vary_texcoord0; void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 908f3abcd0..76d29b1df7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -28,23 +28,24 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; VARYING vec3 vary_normal; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +void passTextureIndex(); + void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vary_texture_index = texture_index; + passTextureIndex(); vary_normal = normalize(normal_matrix * normal); vertex_color = diffuse_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 7b108e4562..115b04797f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; @@ -39,17 +39,17 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); vec4 pos = (modelview_matrix * vert); - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -59,5 +59,5 @@ void main() vertex_color = emissive; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index ab638991f7..2e6982d101 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -40,17 +40,17 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); vec4 pos = (modelview_matrix * vert); - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -60,5 +60,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index 57b3a6d001..45bd5c8b42 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -24,7 +24,7 @@ */ -VARYING float fog_depth; + uniform vec4 waterFogColor; uniform float waterFogEnd; diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index 8c38d5df2a..8494ffba52 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -54,5 +54,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl index 35feacb7b1..e984deb0c8 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec4 emissive; ATTRIBUTE vec2 texcoord0; @@ -37,13 +37,13 @@ VARYING vec2 vary_texcoord0; void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; -VARYING float fog_depth; + + void main() { //transform vertex - vary_texture_index = texture_index; + passTextureIndex(); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; @@ -52,5 +52,5 @@ void main() vertex_color = emissive; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl index f73760bfd4..5d6f14230c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec3 normal; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -49,5 +49,5 @@ void main() vertex_color = vec4(1,1,1,1); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index 69cd858b4d..79b552ee1a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -63,5 +63,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index a8e640018d..8d1bbf350d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -37,7 +37,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -59,5 +59,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index 4de24fd46b..eff75435a9 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -35,7 +35,7 @@ mat4 getObjectSkinnedTransform(); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { @@ -53,5 +53,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index 7286e5e2f4..8b20c2a860 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -50,5 +50,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl new file mode 100644 index 0000000000..a95c9e0ab9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl @@ -0,0 +1,34 @@ +/** + * @file indexedTextureV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +ATTRIBUTE float texture_index; + +VARYING float vary_texture_index; + +void passTextureIndex() +{ + vary_texture_index = texture_index; +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl new file mode 100644 index 0000000000..2839171044 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl @@ -0,0 +1,30 @@ +/** + * @file nonindexedTextureV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +void passTextureIndex() +{ + +} + diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 282686a9b0..5dcfa87066 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,5 +53,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index 86a78b190c..4ca53a8f30 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec3 vary_texcoord0; -VARYING float fog_depth; + void calcAtmospherics(vec3 inPositionEye); @@ -57,6 +57,6 @@ void main() vary_texcoord0 = (texture_matrix0*vec4(ref,1.0)).xyz; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl index 45a493e4f2..706627e175 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,5 +53,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index aea0e25e60..1c6e53b187 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -61,5 +61,5 @@ void main() gl_Position = projection_matrix*vec4(pos, 1.0); - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 4b6b219751..df9111f941 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -53,6 +53,4 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - - fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl index 250d99a9c7..fa01a27ec0 100644 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -37,7 +37,7 @@ void calcAtmospherics(vec3 inPositionEye); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { @@ -56,5 +56,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index 2e41360150..8bdae328bd 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -24,10 +24,7 @@ */ - -VARYING vec3 vary_PositionEye; - vec3 getPositionEye() { - return vary_PositionEye; + return vec3(0,0,0); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index 42f8646f2d..8ec9ae617c 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -25,15 +25,12 @@ -VARYING vec3 vary_PositionEye; - - vec3 getPositionEye() { - return vary_PositionEye; + return vec3(0,0,0); } void setPositionEye(vec3 v) { - vary_PositionEye = v; + } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..636d4af006 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,33 @@ +/** + * @file atmosphericVarsWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +VARYING vec3 vary_PositionEye; + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..ef34c5c853 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,39 @@ +/** + * @file atmosphericVarsWaterV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +VARYING vec3 vary_PositionEye; +VARYING float fog_depth; + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; + fog_depth = v.z; +} diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 04d3e2aa1f..5af9f5c902 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -56,7 +56,7 @@ void main() vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index ad353eb624..5a3955ef00 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -50,7 +50,7 @@ VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -140,7 +140,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 6a3777c7c8..9540ddd2e8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -49,10 +49,10 @@ VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -97,7 +97,7 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -136,7 +136,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 091a865160..63c7a6b13d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -48,7 +48,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -139,7 +139,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index 580ef2694f..34bd8d445a 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -34,10 +34,10 @@ void calcAtmospherics(vec3 inPositionEye); uniform vec4 origin; -VARYING float vary_texture_index; + ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -45,13 +45,13 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,6 +64,4 @@ void main() calcAtmospherics(pos.xyz); vertex_color = diffuse_color; - - fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index 09dbd0b6cd..fc20d3270e 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -36,16 +36,16 @@ ATTRIBUTE vec4 diffuse_color; void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; @@ -54,5 +54,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 86c592ea57..fdb3453cc5 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -30,7 +30,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -43,16 +43,13 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; -VARYING float fog_depth; - uniform vec4 origin; void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,7 +61,5 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); - - fog_depth = pos.z; + vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl index 6799e43b9a..cb80697d15 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec4 diffuse_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -57,5 +57,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 8e8f0664b0..37a20383e2 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -37,16 +37,16 @@ ATTRIBUTE vec4 diffuse_color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; @@ -60,5 +60,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 08814b49d8..e8e56e12c1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -24,25 +24,17 @@ */ - -VARYING vec3 vary_PositionEye; - VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return vec3(0,0,0); } vec3 getAmblitColor() { - return vary_AmblitColor; + return vec3(0,0,0); } vec3 getAdditiveColor() { @@ -50,5 +42,5 @@ vec3 getAdditiveColor() } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return vec3(vary_AtmosAttenuation); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 514f009add..01605e5b25 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -24,49 +24,50 @@ */ - -VARYING vec3 vary_PositionEye; - -VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return sunlit_color; } vec3 getAmblitColor() { - return vary_AmblitColor; + return amblit_color; } + vec3 getAdditiveColor() { return vary_AdditiveColor; } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return atmos_attenuation; } +vec3 getPositionEye() +{ + return position_eye; +} void setPositionEye(vec3 v) { - vary_PositionEye = v; + position_eye = v; } void setSunlitColor(vec3 v) { - vary_SunlitColor = v; + sunlit_color = v; } void setAmblitColor(vec3 v) { - vary_AmblitColor = v; + amblit_color = v; } void setAdditiveColor(vec3 v) @@ -76,5 +77,6 @@ void setAdditiveColor(vec3 v) void setAtmosAttenuation(vec3 v) { - vary_AtmosAttenuation = v; + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..23046f990d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,51 @@ +/** + * @file atmosphericVarsWaterF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_SunlitColor; +VARYING vec3 vary_AdditiveColor; +VARYING float vary_AtmosAttenuation; + +vec3 getSunlitColor() +{ + return vec3(0,0,0); +} +vec3 getAmblitColor() +{ + return vec3(0,0,0); +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vec3(vary_AtmosAttenuation); +} +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..279c4dd981 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,81 @@ +/** + * @file atmosphericVarsWaterV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() +{ + return sunlit_color; +} +vec3 getAmblitColor() +{ + return amblit_color; +} + +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return atmos_attenuation; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + sunlit_color = v; +} + +void setAmblitColor(vec3 v) +{ + amblit_color = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; +} diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index e12c2f7853..ca66ae989c 100755 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -292,6 +292,7 @@ RenderVBOEnable 1 0 list OpenGLPre30 RenderDeferred 0 0 +RenderMaxTextureIndex 1 1 list Intel RenderAnisotropic 1 0 diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index a0245f5369..e855b2c569 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -290,6 +290,7 @@ RenderVBOEnable 1 0 list OpenGLPre30 RenderDeferred 0 0 +RenderMaxTextureIndex 1 1 list Intel RenderAnisotropic 1 0 diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index f521d93e03..563a63287e 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -594,7 +594,7 @@ void settings_setup_listeners() gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); - gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 17cce3069e..94b7451f0e 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -444,6 +444,9 @@ void LLViewerShaderMgr::setShaders() return; } + LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) gSavedSettings.getU32("RenderMaxTextureIndex")), 1); + + if (LLRender::sGLCoreProfile) { if (!gSavedSettings.getBOOL("VertexShaderEnable")) @@ -826,8 +829,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders() // (in order of shader function call depth for reference purposes, deepest level first) vector< pair > shaders; - shaders.reserve(10); shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) ); @@ -838,6 +841,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.push_back( make_pair( "windlight/atmosphericsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); shaders.push_back( make_pair( "avatar/avatarSkinV.glsl", 1 ) ); shaders.push_back( make_pair( "avatar/objectSkinV.glsl", 1 ) ); + shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) ); + shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) ); // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now. for (U32 i = 0; i < shaders.size(); i++) @@ -853,8 +858,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() // (in order of shader function call depth for reference purposes, deepest level first) shaders.clear(); - shaders.reserve(13); - S32 ch = gGLManager.mNumTextureImageUnits-1; + S32 ch = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); if (gGLManager.mGLVersion < 3.1f) { //force to 1 texture index channel for old drivers @@ -863,6 +867,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() std::vector index_channels; index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); @@ -1186,7 +1191,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mShaderFiles.clear(); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseProgram.createShader(NULL, NULL); } @@ -1197,7 +1202,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear(); gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL); } @@ -1394,11 +1399,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels if (mVertexShaderLevel[SHADER_DEFERRED] < 1) { - gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; } else { //shave off some texture units for shadow maps - gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits - 6; + gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels - 6, 1); } gDeferredAlphaProgram.mShaderFiles.clear(); @@ -1428,7 +1433,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true; gDeferredFullbrightProgram.mFeatures.hasGamma = true; gDeferredFullbrightProgram.mFeatures.hasTransport = true; - gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredFullbrightProgram.mShaderFiles.clear(); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); @@ -1442,7 +1447,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true; gDeferredEmissiveProgram.mFeatures.hasGamma = true; gDeferredEmissiveProgram.mFeatures.hasTransport = true; - gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits; + gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredEmissiveProgram.mShaderFiles.clear(); gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB)); -- cgit v1.2.3 From 15f3ea39d7deb0c956b56703a94f6d072b7f2d21 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 22:45:09 -0700 Subject: EXP-1257 : Save toolbar settings in a per user toolbars.xml file --- indra/llui/llcommandmanager.h | 2 + indra/llui/lltoolbar.h | 3 +- indra/llui/lltoolbarview.cpp | 172 +++++++++++++++++++++++++++++------------- indra/llui/lltoolbarview.h | 3 +- 4 files changed, 124 insertions(+), 56 deletions(-) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 8435d915f3..4781f77177 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -81,6 +81,8 @@ private: std::string mName; }; +typedef std::list command_id_list_t; + class LLCommand { public: diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 02db58128c..8e484c7e13 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -123,6 +123,7 @@ public: bool addCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); + command_id_list_t& getCommandsList() { return mButtonCommands; } protected: friend class LLUICtrlFactory; @@ -143,7 +144,7 @@ private: const bool mReadOnly; std::list mButtons; - std::list mButtonCommands; + command_id_list_t mButtonCommands; LLToolBarEnums::ButtonType mButtonType; LLLayoutStack* mCenteringStack; LLLayoutStack* mWrapStack; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 73c8c99418..aee7ffa517 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -50,59 +50,6 @@ LLToolBarView::ToolbarSet::ToolbarSet() bottom_toolbar("bottom_toolbar") {} -bool LLToolBarView::load() -{ - LLToolBarView::ToolbarSet toolbar_set; - - // Load the default toolbars.xml file - // *TODO : pick up the user's toolbar setting if existing - std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); - - LLXMLNodePtr root; - if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) - { - llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; - return false; - } - if(!root->hasName("toolbars")) - { - llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; - return false; - } - - // Parse the toolbar settings - LLXUIParser parser; - parser.readXUI(root, toolbar_set, toolbar_file); - if (!toolbar_set.validateBlock()) - { - llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; - return false; - } - - // Add commands to each toolbar - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarLeft); - } - } - if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarRight); - } - } - if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarBottom); - } - } - return true; -} LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) : LLUICtrl(p), @@ -120,6 +67,7 @@ void LLToolBarView::initFromParams(const LLToolBarView::Params& p) LLToolBarView::~LLToolBarView() { + saveToolbars(); } BOOL LLToolBarView::postBuild() @@ -129,7 +77,7 @@ BOOL LLToolBarView::postBuild() mToolbarBottom = getChild("toolbar_bottom"); // Load the toolbars from the settings - load(); + loadToolbars(); return TRUE; } @@ -167,6 +115,122 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) return true; } +bool LLToolBarView::loadToolbars() +{ + LLToolBarView::ToolbarSet toolbar_set; + + // Load the default toolbars.xml file + // *TODO : pick up the user's toolbar setting if existing + std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + + LLXMLNodePtr root; + if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) + { + llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + return false; + } + if(!root->hasName("toolbars")) + { + llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; + return false; + } + + // Parse the toolbar settings + LLXUIParser parser; + parser.readXUI(root, toolbar_set, toolbar_file); + if (!toolbar_set.validateBlock()) + { + llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; + return false; + } + + // Add commands to each toolbar + if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarLeft); + } + } + if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarRight); + } + } + if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarBottom); + } + } + return true; +} + +void LLToolBarView::saveToolbars() const +{ + // Build the parameter tree from the toolbar data + LLToolBarView::ToolbarSet toolbar_set; + + // *TODO : factorize that code a bit... + if (mToolbarLeft) + { + command_id_list_t& command_list = mToolbarLeft->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.left_toolbar.commands.add(command); + } + } + if (mToolbarRight) + { + command_id_list_t& command_list = mToolbarRight->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.right_toolbar.commands.add(command); + } + } + if (mToolbarBottom) + { + command_id_list_t& command_list = mToolbarBottom->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.bottom_toolbar.commands.add(command); + } + } + + // Serialize the parameter tree + LLXMLNodePtr output_node = new LLXMLNode("toolbars", false); + LLXUIParser parser; + parser.writeXUI(output_node, toolbar_set); + + // Write the resulting XML to file + if(!output_node->isNull()) + { + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + LLFILE *fp = LLFile::fopen(filename, "w"); + if (fp != NULL) + { + LLXMLNode::writeHeaderToFile(fp); + output_node->writeToFile(fp); + fclose(fp); + } + } +} + void LLToolBarView::draw() { static bool debug_print = true; diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 208660da8e..646a1fd636 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -77,7 +77,8 @@ protected: private: // Loads the toolbars from the existing user or default settings - bool load(); // return false if load fails + bool loadToolbars(); // return false if load fails + void saveToolbars() const; bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); // Pointers to the toolbars handled by the toolbar view -- cgit v1.2.3 From 6dfcb11000f349e24dbd1a9b78efa2ca4f799379 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 01:37:54 -0500 Subject: SH-2453 Fix for horizontal line when max altitude set to 0 --- indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 4 ---- .../app_settings/shaders/class1/objects/nonindexedTextureV.glsl | 1 + indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 255796aa27..60952ea38e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -148,10 +148,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { vec3 P = inPositionEye; setPositionEye(P); - //(TERRAIN) limit altitude - if (P.y > max_y.x) P *= (max_y.x / P.y); - if (P.y < -max_y.x) P *= (-max_y.x / P.y); - vec3 tmpLightnorm = lightnorm.xyz; vec3 Pn = normalize(P); diff --git a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl index 2839171044..80ea286ac0 100644 --- a/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/nonindexedTextureV.glsl @@ -28,3 +28,4 @@ void passTextureIndex() } + diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 4543e83d0a..eb367d4ad6 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -148,10 +148,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { vec3 P = inPositionEye; setPositionEye(P); - //(TERRAIN) limit altitude - if (P.y > max_y.x) P *= (max_y.x / P.y); - if (P.y < -max_y.x) P *= (-max_y.x / P.y); - vec3 tmpLightnorm = lightnorm.xyz; vec3 Pn = normalize(P); -- cgit v1.2.3 From 4328b30180bd057412de2085c1d758f5e6906d70 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 01:50:28 -0500 Subject: SH-2450 Potential fix for crash on login with 460M et al --- indra/newview/llviewershadermgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 94b7451f0e..6af9e464df 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -32,6 +32,7 @@ #include "llfile.h" #include "llviewerwindow.h" +#include "llwindow.h" #include "llviewercontrol.h" #include "pipeline.h" #include "llworld.h" @@ -491,6 +492,9 @@ void LLViewerShaderMgr::setShaders() if (gViewerWindow) { gViewerWindow->setCursor(UI_CURSOR_WAIT); + //VICIOUS HACK -- some drivers will time out if we don't redraw the window within 2 seconds, and this operation can take awhile + //minimizing tells the driver we won't be updating the window for a bit + gViewerWindow->getWindow()->minimize(); } // Lighting @@ -684,6 +688,7 @@ void LLViewerShaderMgr::setShaders() if (gViewerWindow) { gViewerWindow->setCursor(UI_CURSOR_ARROW); + gViewerWindow->getWindow()->restore(); } gPipeline.createGLBuffers(); -- cgit v1.2.3 From e4e499e326812e66de9b9c0392ea9899a6e71e63 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 10:27:03 -0700 Subject: EXP-1261 FIX Left hand toolbar does not show labels when icons and labels option selected --- indra/llui/lltoolbarview.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index aee7ffa517..b374a0bfc4 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -241,9 +241,21 @@ void LLToolBarView::draw() LLRect bottom_rect, left_rect, right_rect; - if (mToolbarBottom) mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); - if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); - if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + if (mToolbarBottom) + { + mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight()); + mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); + } + if (mToolbarLeft) + { + mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight()); + mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); + } + if (mToolbarRight) + { + mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight()); + mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + } if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) debug_print = true; -- cgit v1.2.3 From 5ca512fa1f36998440bad5256730c9d22f195037 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 12:38:31 -0500 Subject: SH-2450 Potential fix for crash on GeForce 4xx when allocating LLVertexBuffer data --- indra/llrender/llvertexbuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 199699449a..5756ccdcd5 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -560,8 +560,8 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping) sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ; if(!sPrivatePoolp) - { - sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ; + { //disable private pool for now -- lots of memory allocations failing for vertex buffers erroneously + //sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ; } } -- cgit v1.2.3 From fc0f5173eb20fad8934420e6eec8873d71490894 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 10:40:28 -0700 Subject: fix linux build --- indra/llui/lllayoutstack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 89b3f671a4..4991c4afa6 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -498,13 +498,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } else //VERTICAL { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } // toggle resize bars based on panel visibility, resizability, etc -- cgit v1.2.3 From 69ac0d0aee6e0dc1075a7d18e17e8335cd29e05f Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 28 Sep 2011 14:52:27 -0400 Subject: Fix for sh-2500 --- indra/newview/llfloatermodelpreview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 77e9b4eeb8..527a868db2 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3309,7 +3309,7 @@ void LLModelPreview::rebuildUploadData() F32 max_scale = 0.f; //reorder materials to match mBaseModel - for (U32 i = 0; i < LLModel::NUM_LODS; i++) + for (U32 i = 0; i < LLModel::NUM_LODS-1; i++) { if (mBaseModel.size() == mModel[i].size()) { @@ -5085,7 +5085,7 @@ BOOL LLModelPreview::render() } //make sure material lists all match - for (U32 i = 0; i < LLModel::NUM_LODS; i++) + for (U32 i = 0; i < LLModel::NUM_LODS-1; i++) { if (mBaseModel.size() == mModel[i].size()) { -- cgit v1.2.3 From f657f5a428e47fc9963cc4eb943062216443673f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 15:54:02 -0500 Subject: SH-2276 Remove some log spam to alleviate stalls on login. --- indra/llmessage/llassetstorage.cpp | 30 +++++++++++++++--------------- indra/llui/llnotifications.cpp | 2 +- indra/newview/llviewerassetstorage.cpp | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 31cdb1219b..9b86daebe5 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -149,8 +149,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) setName( buf ); buf.assign( str, pos2, std::string::npos ); setDescription( buf ); - llinfos << "uuid: " << mUuid << llendl; - llinfos << "creator: " << mCreatorID << llendl; + LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl; + LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl; } ///---------------------------------------------------------------------------- @@ -434,9 +434,9 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse // IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { - lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; + LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; - llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; if (user_data) { @@ -446,7 +446,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL if (mShutDown) { - llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl; if (callback) { @@ -468,7 +468,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL // Try static VFS first. if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) { - llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl; return; } @@ -486,7 +486,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); } - llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; } else { @@ -520,7 +520,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL } if (duplicate) { - llinfos << "Adding additional non-duplicate request for asset " << uuid + LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid << "." << LLAssetType::lookup(type) << llendl; } @@ -584,9 +584,9 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetType::EType file_type, void* user_data, LLExtStat ext_status) { - llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl; - lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id + LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id << "," << LLAssetType::lookup(file_type) << llendl; LLAssetRequest* req = (LLAssetRequest*)user_data; if(!req) @@ -731,7 +731,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen tpvf.setAsset(asset_id, atype); tpvf.setCallback(downloadEstateAssetCompleteCallback, req); - llinfos << "Starting transfer for " << asset_id << llendl; + LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET); ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f)); } @@ -871,7 +871,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age tpvf.setAsset(asset_id, atype); tpvf.setCallback(downloadInvItemCompleteCallback, req); - llinfos << "Starting transfer for inventory asset " + LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset " << item_id << " owned by " << owner_id << "," << task_id << llendl; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET); @@ -1211,7 +1211,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, request_list_t* requests = getRequestList(rt); if (deletePendingRequestImpl(requests, asset_type, asset_id)) { - llinfos << "Asset " << getRequestName(rt) << " request for " + LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from pending queue." << llendl; return true; @@ -1307,7 +1307,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData) { // this is a duplicate from the same subsystem - throw it away - llinfos << "Discarding duplicate request for UUID " << uuid << llendl; + LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl; return; } } @@ -1490,7 +1490,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET { if( !metric_recipient ) { - llinfos << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl; + LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl; return; } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ffe5908a9d..3fa13d7bb0 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1640,7 +1640,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) LLNotificationSet::iterator it=mItems.find(target); if (it == mItems.end()) { - llwarns << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; + LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; return LLNotificationPtr((LLNotification*)NULL); } else diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 36c8b42a52..d042f62830 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -116,7 +116,7 @@ void LLViewerAssetStorage::storeAssetData( F64 timeout) { LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - llinfos << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) + LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) << " ASSET_ID: " << asset_id << llendl; if (mUpstreamHost.isOk()) @@ -248,9 +248,9 @@ void LLViewerAssetStorage::storeAssetData( } LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - llinfos << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; + LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; - llinfos << "ASSET_ID: " << asset_id << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << llendl; S32 size = 0; LLFILE* fp = LLFile::fopen(filename, "rb"); @@ -369,7 +369,7 @@ void LLViewerAssetStorage::_queueDataRequest( tpvf.setAsset(uuid, atype); tpvf.setCallback(downloadCompleteCallback, req); - llinfos << "Starting transfer for " << uuid << llendl; + LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << llendl; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); -- cgit v1.2.3 From 4dd533a5871fd5bbb0ea084679da9f0a856d41c5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 16:22:20 -0500 Subject: SH-2276 Update window often during login to avoid windows TDR events --- indra/newview/llstartup.cpp | 132 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 116 insertions(+), 16 deletions(-) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 11a4c96f14..8876d6fa16 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -733,8 +733,11 @@ bool idle_startup() // this startup phase more than once. if (gLoginMenuBarView == NULL) { - initialize_edit_menu(); + display_startup(); + initialize_edit_menu(); + display_startup(); init_menus(); + display_startup(); } if (show_connect_box) @@ -743,23 +746,28 @@ bool idle_startup() // NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't // show the login view until login_show() is called below. if (gUserCredential.isNull()) - { + { + display_startup(); gUserCredential = gLoginHandler.initializeLoginInfo(); + display_startup(); } if (gHeadlessClient) { LL_WARNS("AppInit") << "Waiting at connection box in headless client. Did you mean to add autologin params?" << LL_ENDL; } // Make sure the process dialog doesn't hide things + display_startup(); gViewerWindow->setShowProgress(FALSE); - + display_startup(); // Show the login dialog login_show(); + display_startup(); // connect dialog is already shown, so fill in the names if (gUserCredential.notNull()) { LLPanelLogin::setFields( gUserCredential, gRememberPassword); } + display_startup(); LLPanelLogin::giveFocus(); LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input @@ -770,14 +778,19 @@ bool idle_startup() LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } + display_startup(); gViewerWindow->setNormalControlsVisible( FALSE ); + display_startup(); gLoginMenuBarView->setVisible( TRUE ); + display_startup(); gLoginMenuBarView->setEnabled( TRUE ); + display_startup(); show_debug_menus(); + display_startup(); // Hide the splash screen LLSplashScreen::hide(); - + display_startup(); // Push our window frontmost gViewerWindow->getWindow()->show(); display_startup(); @@ -786,7 +799,10 @@ bool idle_startup() // first made visible. #ifdef _WIN32 MSG msg; - while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) ); + while( PeekMessage( &msg, /*All hWnds owned by this thread */ NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) ) + { + display_startup(); + } #endif timeout.reset(); return FALSE; @@ -801,7 +817,7 @@ bool idle_startup() // Don't do anything. Wait for the login view to call the login_callback, // which will push us to the next state. - + display_startup(); // Sleep so we don't spin the CPU ms_sleep(1); return FALSE; @@ -1169,37 +1185,51 @@ bool idle_startup() // Finish agent initialization. (Requires gSavedSettings, builds camera) gAgent.init(); + display_startup(); gAgentCamera.init(); + display_startup(); set_underclothes_menu_options(); + display_startup(); // Since we connected, save off the settings so the user doesn't have to // type the name/password again if we crash. gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); LLUIColorTable::instance().saveUserSettings(); + display_startup(); + // // Initialize classes w/graphics stuff. // gTextureList.doPrefetchImages(); + display_startup(); + LLSurface::initClasses(); + display_startup(); + LLFace::initClass(); + display_startup(); LLDrawable::initClass(); + display_startup(); // init the shader managers LLPostProcess::initClass(); + display_startup(); LLViewerObject::initVOClasses(); + display_startup(); // Initialize all our tools. Must be done after saved settings loaded. // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton. LLToolMgr::getInstance()->initTools(); + display_startup(); // Pre-load floaters, like the world map, that are slow to spawn // due to XML complexity. gViewerWindow->initWorldUI(); - + display_startup(); // This is where we used to initialize gWorldp. Original comment said: @@ -1207,24 +1237,26 @@ bool idle_startup() // User might have overridden far clip LLWorld::getInstance()->setLandFarClip(gAgentCamera.mDrawDistance); - + display_startup(); // Before we create the first region, we need to set the agent's mOriginGlobal // This is necessary because creating objects before this is set will result in a // bad mPositionAgent cache. gAgent.initOriginGlobal(from_region_handle(gFirstSimHandle)); + display_startup(); LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim); + display_startup(); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle); LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL; regionp->setSeedCapability(gFirstSimSeedCap); LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL; - + display_startup(); // Set agent's initial region to be the one we just created. gAgent.setRegion(regionp); - + display_startup(); // Set agent's initial position, which will be read by LLVOAvatar when the avatar // object is created. I think this must be done after setting the region. JC gAgent.setPositionAgent(agent_start_position_region); @@ -1244,6 +1276,7 @@ bool idle_startup() { LLStartUp::multimediaInit(); LLStartUp::setStartupState( STATE_FONT_INIT ); + display_startup(); return FALSE; } @@ -1252,6 +1285,7 @@ bool idle_startup() { LLStartUp::fontInit(); LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); + display_startup(); return FALSE; } @@ -1279,6 +1313,7 @@ bool idle_startup() set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD); } } + display_startup(); return FALSE; } @@ -1289,7 +1324,9 @@ bool idle_startup() //--------------------------------------------------------------------- if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState()) { + display_startup(); update_texture_fetch(); + display_startup(); if ( gViewerWindow != NULL) { // This isn't the first logon attempt, so show the UI @@ -1297,12 +1334,15 @@ bool idle_startup() } gLoginMenuBarView->setVisible( FALSE ); gLoginMenuBarView->setEnabled( FALSE ); + display_startup(); // direct logging to the debug console's line buffer LLError::logToFixedBuffer(gDebugView->mDebugConsolep); + display_startup(); // set initial visibility of debug console gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole")); + display_startup(); // // Set message handlers @@ -1311,22 +1351,28 @@ bool idle_startup() // register callbacks for messages. . . do this after initial handshake to make sure that we don't catch any unwanted register_viewer_callbacks(gMessageSystem); + display_startup(); // Debugging info parameters gMessageSystem->setMaxMessageTime( 0.5f ); // Spam if decoding all msgs takes more than 500 ms + display_startup(); #ifndef LL_RELEASE_FOR_DOWNLOAD gMessageSystem->setTimeDecodes( TRUE ); // Time the decode of each msg gMessageSystem->setTimeDecodesSpamThreshold( 0.05f ); // Spam if a single msg takes over 50ms to decode #endif + display_startup(); gXferManager->registerCallbacks(gMessageSystem); + display_startup(); LLStartUp::initNameCache(); + display_startup(); // update the voice settings *after* gCacheName initialization // so that we can construct voice UI that relies on the name cache LLVoiceClient::getInstance()->updateSettings(); + display_startup(); //gCacheName is required for nearby chat history loading //so I just moved nearby history loading a few states further @@ -1335,12 +1381,14 @@ bool idle_startup() LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if (nearby_chat) nearby_chat->loadHistory(); } + display_startup(); // *Note: this is where gWorldMap used to be initialized. // register null callbacks for audio until the audio system is initialized gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL); gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL); + display_startup(); //reset statistics LLViewerStats::getInstance()->resetStats(); @@ -1370,6 +1418,7 @@ bool idle_startup() LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio()); // Initialize FOV LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); + display_startup(); // Move agent to starting location. The position handed to us by // the space server is in global coordinates, but the agent frame @@ -1380,6 +1429,7 @@ bool idle_startup() gAgent.resetAxes(gAgentStartLookAt); gAgentCamera.stopCameraAnimation(); gAgentCamera.resetCamera(); + display_startup(); // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; @@ -1392,6 +1442,8 @@ bool idle_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); + display_startup(); + LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL; // For all images pre-loaded into viewer cache, decode them. // Need to do this AFTER we init the sky @@ -1405,6 +1457,8 @@ bool idle_startup() } LLStartUp::setStartupState( STATE_WORLD_WAIT ); + display_startup(); + // JC - Do this as late as possible to increase likelihood Purify // will run. LLMessageSystem* msg = gMessageSystem; @@ -1432,6 +1486,7 @@ bool idle_startup() NULL); timeout.reset(); + display_startup(); return FALSE; } @@ -1450,8 +1505,10 @@ bool idle_startup() LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) { + display_startup(); } msg->processAcks(); + display_startup(); return FALSE; } @@ -1462,6 +1519,7 @@ bool idle_startup() { LL_DEBUGS("AppInit") << "Connecting to region..." << LL_ENDL; set_startup_status(0.60f, LLTrans::getString("LoginConnectingToRegion"), gAgent.mMOTD); + display_startup(); // register with the message system so it knows we're // expecting this message LLMessageSystem* msg = gMessageSystem; @@ -1477,6 +1535,7 @@ bool idle_startup() msg->newMessageFast(_PREHASH_EconomyDataRequest); gAgent.sendReliableMessage(); } + display_startup(); // Create login effect // But not on first login, because you can't see your avatar then @@ -1491,6 +1550,7 @@ bool idle_startup() LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT timeout.reset(); + display_startup(); return FALSE; } @@ -1515,14 +1575,17 @@ bool idle_startup() LL_DEBUGS("AppInit") << "Awaiting AvatarInitComplete, got " << msg->getMessageName() << LL_ENDL; } + display_startup(); } msg->processAcks(); + display_startup(); + if (gAgentMovementCompleted) { LLStartUp::setStartupState( STATE_INVENTORY_SEND ); } - + display_startup(); return FALSE; } @@ -1531,9 +1594,10 @@ bool idle_startup() //--------------------------------------------------------------------- if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) { + display_startup(); // Inform simulator of our language preference LLAgentLanguage::update(); - + display_startup(); // unpack thin inventory LLSD response = LLLoginInstance::getInstance()->getResponse(); //bool dump_buffer = false; @@ -1548,6 +1612,7 @@ bool idle_startup() gInventory.setLibraryRootFolderID(id.asUUID()); } } + display_startup(); LLSD inv_lib_owner = response["inventory-lib-owner"]; if(inv_lib_owner.isDefined()) @@ -1559,6 +1624,7 @@ bool idle_startup() gInventory.setLibraryOwnerID( LLUUID(id.asUUID())); } } + display_startup(); LLSD inv_skel_lib = response["inventory-skel-lib"]; if(inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull()) @@ -1568,6 +1634,7 @@ bool idle_startup() LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL; } } + display_startup(); LLSD inv_skeleton = response["inventory-skeleton"]; if(inv_skeleton.isDefined()) @@ -1577,6 +1644,7 @@ bool idle_startup() LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL; } } + display_startup(); LLSD inv_basic = response["inventory-basic"]; if(inv_basic.isDefined()) @@ -1614,6 +1682,7 @@ bool idle_startup() list[agent_id] = new LLRelationship(given_rights, has_rights, false); } LLAvatarTracker::instance().addBuddyList(list); + display_startup(); } bool show_hud = false; @@ -1641,6 +1710,8 @@ bool idle_startup() //} } } + display_startup(); + // Either we want to show tutorial because this is the first login // to a Linden Help Island or the user quit with the tutorial // visible. JC @@ -1648,22 +1719,26 @@ bool idle_startup() { LLFloaterReg::showInstance("hud", LLSD(), FALSE); } + display_startup(); LLSD event_notifications = response["event_notifications"]; if(event_notifications.isDefined()) { gEventNotifier.load(event_notifications); } + display_startup(); LLSD classified_categories = response["classified_categories"]; if(classified_categories.isDefined()) { LLClassifiedInfo::loadCategories(classified_categories); } + display_startup(); // This method MUST be called before gInventory.findCategoryUUIDForType because of // gInventory.mIsAgentInvUsable is set to true in the gInventory.buildParentChildMap. gInventory.buildParentChildMap(); + display_startup(); //all categories loaded. lets create "My Favorites" category gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true); @@ -1677,24 +1752,26 @@ bool idle_startup() LLAvatarTracker::instance().registerCallbacks(msg); llinfos << " Landmark" << llendl; LLLandmark::registerCallbacks(msg); + display_startup(); // request mute list llinfos << "Requesting Mute List" << llendl; LLMuteList::getInstance()->requestFromServer(gAgent.getID()); - + display_startup(); // Get L$ and ownership credit information llinfos << "Requesting Money Balance" << llendl; LLStatusBar::sendMoneyBalanceRequest(); - + display_startup(); // request all group information llinfos << "Requesting Agent Data" << llendl; gAgent.sendAgentDataUpdateRequest(); - + display_startup(); // Create the inventory views llinfos << "Creating Inventory Views" << llendl; LLFloaterReg::getInstance("inventory"); - + display_startup(); LLStartUp::setStartupState( STATE_MISC ); + display_startup(); return FALSE; } @@ -1743,17 +1820,23 @@ bool idle_startup() gSavedSettings.setBOOL("ShowStartLocation", TRUE); } + display_startup(); + if (gSavedSettings.getBOOL("HelpFloaterOpen")) { // show default topic LLViewerHelp::instance().showTopic(""); } + display_startup(); + // We're successfully logged in. gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE); LLFloaterReg::showInitialVisibleInstances(); + display_startup(); + // based on the comments, we've successfully logged in so we can delete the 'forced' // URL that the updater set in settings.ini (in a mostly paranoid fashion) std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" ); @@ -1767,8 +1850,10 @@ bool idle_startup() LLUIColorTable::instance().saveUserSettings(); }; + display_startup(); // JC: Initializing audio requests many sounds for download. init_audio(); + display_startup(); // JC: Initialize "active" gestures. This may also trigger // many gesture downloads, if this is the user's first @@ -1806,6 +1891,7 @@ bool idle_startup() LLGestureMgr::instance().startFetch(); } gDisplaySwapBuffers = TRUE; + display_startup(); LLMessageSystem* msg = gMessageSystem; msg->setHandlerFuncFast(_PREHASH_SoundTrigger, process_sound_trigger); @@ -1880,8 +1966,10 @@ bool idle_startup() } } + display_startup(); //DEV-17797. get null folder. Any items found here moved to Lost and Found LLInventoryModelBackgroundFetch::instance().findLostItems(); + display_startup(); LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); @@ -1890,6 +1978,7 @@ bool idle_startup() if (STATE_PRECACHE == LLStartUp::getStartupState()) { + display_startup(); F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY; // We now have an inventory skeleton, so if this is a user's first @@ -1906,6 +1995,8 @@ bool idle_startup() LLStartUp::loadInitialOutfit( sInitialOutfit, sInitialOutfitGender ); } + display_startup(); + // wait precache-delay and for agent's avatar or a lot longer. if(((timeout_frac > 1.f) && isAgentAvatarValid()) || (timeout_frac > 3.f)) @@ -1947,6 +2038,8 @@ bool idle_startup() return TRUE; } + display_startup(); + if (wearables_time > MAX_WEARABLES_TIME) { LLNotificationsUtil::add("ClothingLoading"); @@ -1978,16 +2071,20 @@ bool idle_startup() } } + display_startup(); update_texture_fetch(); + display_startup(); set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME, LLTrans::getString("LoginDownloadingClothing").c_str(), gAgent.mMOTD.c_str()); + display_startup(); return TRUE; } if (STATE_CLEANUP == LLStartUp::getStartupState()) { set_startup_status(1.0, "", ""); + display_startup(); // Let the map know about the inventory. LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); @@ -2003,6 +2100,7 @@ bool idle_startup() //gViewerWindow->revealIntroPanel(); gViewerWindow->setStartupComplete(); gViewerWindow->setProgressCancelButtonVisible(FALSE); + display_startup(); // We're not away from keyboard, even though login might have taken // a while. JC @@ -2038,6 +2136,7 @@ bool idle_startup() // LLUserAuth::getInstance()->reset(); LLStartUp::setStartupState( STATE_STARTED ); + display_startup(); // Unmute audio if desired and setup volumes. // Unmute audio if desired and setup volumes. @@ -2062,6 +2161,7 @@ bool idle_startup() LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); LLIMFloater::initIMFloater(); + display_startup(); return TRUE; } -- cgit v1.2.3 From e43f4dc31b40e588805e06f4c503e0387687a08e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 16:51:12 -0500 Subject: SH-2276 Add some info around a possible deadlock culprit. --- indra/newview/llvowlsky.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index c26aefb28f..14fd0a1eb1 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -349,6 +349,9 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) mStripsVerts.resize(strips_segments, NULL); + LLTimer timer; + timer.start(); + for (U32 i = 0; i < strips_segments ;++i) { LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB); @@ -390,6 +393,8 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) // and unlock the buffer segment->flush(); } + + llinfos << "completed in " << llformat("%.2f", timer.getElapsedTimeF32()) << "seconds" << llendl; } #else mStripsVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB); -- cgit v1.2.3 From 872567c0c1a58272b276303c881585acf9ba9ac0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 16:51:23 -0500 Subject: SH-2244 Fix for mac build? --- indra/llrender/llimagegl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index cbdb8f83f6..3d3c94ef3e 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -727,7 +727,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { if (mAutoGenMips) { - if (!glGenerateMipmap) + if (!gGLManager.mHasFramebufferObject) { glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE); } @@ -760,7 +760,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } } - if (glGenerateMipmap) + if (gGLManager.mHasFramebufferObject) { glGenerateMipmap(LLTexUnit::getInternalType(mBindTarget)); } -- cgit v1.2.3 From b8b0886f3e7a421ad5f90cd5454a39f4d2dac959 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 16:55:41 -0500 Subject: SH-2507 Fix for linux build --- indra/llrender/llglslshader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 3b6cc084b1..ddadf07d73 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -51,7 +51,7 @@ using std::string; GLhandleARB LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; -S32 LLGLSLShader::sIndexedTextureChannels = NULL; +S32 LLGLSLShader::sIndexedTextureChannels = 0; bool LLGLSLShader::sNoFixedFunction = false; //UI shader -- declared here so llui_libtest will link properly -- cgit v1.2.3 From d447f1908bc2da9067d1f4d34825618a4d176602 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 28 Sep 2011 15:27:34 -0700 Subject: EXP-1262 Hitting single letters reserved for shortcuts inworld opens chat but not associated shortcuts (like Mouselook and Fly) EXP-1266 Communicate > Nearby Chat menu item does not bring up chat floater --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9a06423422..148b80e817 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1493,7 +1493,7 @@ Type S32 Value - 1 + 0 ChatBubbleOpacity diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2e93243b0f..923430d6fd 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -227,10 +227,10 @@ use_mac_ctrl="true"> + parameter="chat_bar" /> + parameter="chat_bar" /> Date: Wed, 28 Sep 2011 15:27:53 -0700 Subject: removing old xml nearby chat --- .../skins/default/xui/en/floater_nearby_chat.xml | 50 ---------------------- 1 file changed, 50 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en/floater_nearby_chat.xml diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml deleted file mode 100644 index ab966dbb0e..0000000000 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - -- cgit v1.2.3 From 503c8ab78980515e02e8e7cb411061cc0429062e Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 28 Sep 2011 15:51:08 -0700 Subject: VWR-27039 FIX FR linguistic --- .../newview/skins/default/xui/fr/panel_preferences_chat.xml | 2 +- .../skins/default/xui/fr/panel_preferences_graphics1.xml | 6 +++--- .../skins/default/xui/fr/panel_preferences_privacy.xml | 4 ++-- indra/newview/skins/default/xui/fr/strings.xml | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml index e9e6e6350f..1644eefbee 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml @@ -8,7 +8,7 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/fr/panel_preferences_graphics1.xml index 5bf2ef72f5..a738b2d43f 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_graphics1.xml @@ -51,7 +51,7 @@ - + Faible @@ -102,8 +102,8 @@ Rendu du terrain : - - + + --> diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml index 202ec779f5..3123a4c6fe 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml @@ -3,9 +3,9 @@ se connecter pour changer - diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 0c7e7cff56..1585166114 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -21,7 +21,8 @@ chrome="true" image_overlay_alignment="left" use_ellipses="true" - auto_resize="true"/> + auto_resize="true" + flash_color="EmphasisColor"/> + auto_resize="true" + flash_color="EmphasisColor"/> -- cgit v1.2.3 From 17c699e4281ffff58e24c5db960a5c33018f1747 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 5 Oct 2011 16:29:12 -0700 Subject: * Updated flash_color to use old LLButton highlight_color default. --- indra/llui/lltooltip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index bc6461a0c2..23cdd9ad9a 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -200,7 +200,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) icon_params.image_selected(imagep); icon_params.scale_image(true); - icon_params.flash_color(icon_params.highlight_color()); + icon_params.flash_color.control = "ButtonUnselectedFgColor"; mInfoButton = LLUICtrlFactory::create(icon_params); if (p.click_callback.isProvided()) { -- cgit v1.2.3 From 352ae994480a960541050c82f83a25262f8b44e0 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 5 Oct 2011 16:39:00 -0700 Subject: adding floater_destinations.xml --- .../skins/default/xui/en/floater_destinations.xml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/floater_destinations.xml diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml new file mode 100644 index 0000000000..50a279c046 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_destinations.xml @@ -0,0 +1,25 @@ + + + + -- cgit v1.2.3 From 70495f6f2f61687717135f027c224003f5c5360a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 5 Oct 2011 16:56:49 -0700 Subject: Fixing merge mistakes! --- indra/llui/lltoolbar.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 62217a664a..392e26f496 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -712,8 +712,6 @@ LLToolBarButton::LLToolBarButton(const Params& p) mIsRunningSignal(NULL), mIsStartingSignal(NULL) { - mUUID = LLUUID::generateNewID(p.name); - mButtonFlashRate = 0.0; mButtonFlashCount = 0; } -- cgit v1.2.3 From 64d005bfed6c5adcd29df3ae0774747480a0d839 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Oct 2011 17:04:07 -0700 Subject: EXP-1286 : Add DaD to toybox --- indra/llui/lltoolbar.cpp | 11 ++++++++--- indra/llui/lltoolbar.h | 1 + indra/newview/llfloatertoybox.cpp | 5 ++++- indra/newview/lltoolbarview.cpp | 16 +++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 9ffb859053..ef36f426fa 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -103,7 +103,11 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadTop(p.pad_top), mPadBottom(p.pad_bottom), mPadBetween(p.pad_between), - mPopupMenuHandle() + mPopupMenuHandle(), + mStartDragItemCallback(NULL), + mHandleDragItemCallback(NULL), + mHandleDropCallback(NULL), + mDragAndDropTarget(false) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; @@ -608,9 +612,10 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) cbParam.function_name = commandp->executeFunctionName(); cbParam.parameter = commandp->executeParameters(); button->setCommitCallback(cbParam); - button->setStartDragCallback(mStartDragItemCallback); - button->setHandleDragCallback(mHandleDragItemCallback); } + // Drag and drop behavior must work also if provided in the Toybox and, potentially, any read-only toolbar + button->setStartDragCallback(mStartDragItemCallback); + button->setHandleDragCallback(mHandleDragItemCallback); button->setCommandId(id); return button; diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index a35f6d9db1..b630b82d0f 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -159,6 +159,7 @@ public: void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } + bool isReadOnly() const { return mReadOnly; } LLToolBarButton* createButton(const LLCommandId& id); diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index cf22e071aa..58bb417b71 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -62,7 +62,10 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); - + mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + LLCommandManager& cmdMgr = LLCommandManager::instance(); // diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 5f3e386035..c0408e4850 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -377,24 +377,26 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb if (command) { // Convert the (x,y) position in rank in toolbar - int rank = toolbar->getRankFromPosition(x,y); + int rank = 0; + if (!toolbar->isReadOnly()) + { + rank = toolbar->getRankFromPosition(x,y); + } // Suppress the command from the toolbars (including the one it's dropped in, // this will handle move position). gToolBarView->mToolbarLeft->removeCommand(command->id()); gToolBarView->mToolbarRight->removeCommand(command->id()); gToolBarView->mToolbarBottom->removeCommand(command->id()); // Now insert it in the toolbar at the detected rank - toolbar->addCommand(command->id(),rank); + if (!toolbar->isReadOnly()) + { + toolbar->addCommand(command->id(),rank); + } } else { llwarns << "Command couldn't be found in command manager" << llendl; } - - } - else - { - llinfos << "Merov debug : handleDrop. Drop source is not a widget -> nothing to do" << llendl; } return TRUE; -- cgit v1.2.3 From fc5030fcfe9d3ffcbb2ad1ae0b1dacd1699a54ce Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Oct 2011 22:46:30 -0700 Subject: EXP-1286 : Clean-up the mess I added to llcommandmanager. All CommandId now have a trusted UUID which is the base for indexing and comparison. --- indra/llui/llcommandmanager.cpp | 19 ++----------------- indra/llui/llcommandmanager.h | 16 ++++++++++------ indra/newview/lltoolbarview.cpp | 3 ++- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 2bd50af7af..9ce7533e1b 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -114,7 +114,7 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) { LLCommand * command_match = NULL; - CommandIndexMap::const_iterator found = mCommandIndices.find(commandId); + CommandIndexMap::const_iterator found = mCommandIndices.find(commandId.uuid()); if (found != mCommandIndices.end()) { @@ -124,25 +124,10 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) return command_match; } -LLCommand * LLCommandManager::getCommand(const LLUUID& commandUUID) -{ - LLCommand * command_match = NULL; - - CommandUUIDMap::const_iterator found = mCommandUUIDs.find(commandUUID); - - if (found != mCommandUUIDs.end()) - { - command_match = mCommands[found->second]; - } - - return command_match; -} - void LLCommandManager::addCommand(LLCommand * command) { LLCommandId command_id = command->id(); - mCommandIndices[command_id] = mCommands.size(); - mCommandUUIDs[command_id.uuid()] = mCommands.size(); + mCommandIndices[command_id.uuid()] = mCommands.size(); mCommands.push_back(command); lldebugs << "Successfully added command: " << command->id().name() << llendl; diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 8e5abd6461..8f9f956ec7 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -62,17 +62,24 @@ public: mUUID = LLUUID::generateNewID(p.name); } + LLCommandId(const LLUUID& uuid) + : mName(""), + mUUID(uuid) + + { + } + const std::string& name() const { return mName; } const LLUUID& uuid() const { return mUUID; } bool operator!=(const LLCommandId& command) const { - return (mName != command.mName); + return (mUUID != command.mUUID); } bool operator==(const LLCommandId& command) const { - return (mName == command.mName); + return (mUUID == command.mUUID); } bool operator<(const LLCommandId& command) const @@ -178,7 +185,6 @@ public: U32 commandCount() const; LLCommand * getCommand(U32 commandIndex); LLCommand * getCommand(const LLCommandId& commandId); - LLCommand * getCommand(const LLUUID& commandUUID); static bool load(); @@ -186,13 +192,11 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map CommandUUIDMap; - typedef std::map CommandIndexMap; + typedef std::map CommandIndexMap; typedef std::vector CommandVector; CommandVector mCommands; CommandIndexMap mCommandIndices; - CommandUUIDMap mCommandUUIDs; }; diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index c0408e4850..95ed603bbf 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -373,7 +373,8 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb //llinfos << "Merov debug : handleDrop. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); - LLCommand* command = mgr.getCommand(inv_item->getUUID()); + LLCommandId command_id(inv_item->getUUID()); + LLCommand* command = mgr.getCommand(command_id); if (command) { // Convert the (x,y) position in rank in toolbar -- cgit v1.2.3 From 5d414d6decbf05feae154c992291deab34ed8b92 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 6 Oct 2011 09:40:05 +0300 Subject: Linux build fix. --- indra/integration_tests/llui_libtest/CMakeLists.txt | 1 + indra/newview/llfloaterdestinations.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt index df47167154..1180460f4b 100644 --- a/indra/integration_tests/llui_libtest/CMakeLists.txt +++ b/indra/integration_tests/llui_libtest/CMakeLists.txt @@ -71,6 +71,7 @@ endif (DARWIN) # Sort by high-level to low-level target_link_libraries(llui_libtest llui + llinventory llmessage ${LLRENDER_LIBRARIES} ${LLIMAGE_LIBRARIES} diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index fa7e2a742c..647b3b5046 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -48,4 +48,4 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { return TRUE; -} \ No newline at end of file +} -- cgit v1.2.3 From fc489b12c99abab8a61fb3c7546fe802065fe2b0 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 6 Oct 2011 10:37:22 -0700 Subject: Updated to pass coding policy checks --- indra/newview/llfloaterdestinations.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index fa7e2a742c..ce36f7759c 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -48,4 +48,5 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { return TRUE; -} \ No newline at end of file +} + -- cgit v1.2.3 From 6095127468f91770abe276b7d55754bbec228df3 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 6 Oct 2011 13:55:47 -0400 Subject: Added tag DRTVWR-93_3.1.0-beta1, 3.1.0-beta1 for changeset 2657fa785bbf --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index e3edb9f17e..ce40e797f8 100644 --- a/.hgtags +++ b/.hgtags @@ -196,3 +196,5 @@ b95ddac176ac944efdc85cbee94ac2e1eab44c79 3.0.3-start 0496d2f74043cf4e6058e76ac3db03d44cff42ce 3.0.3-release 92a3aa04775438226399b19deee12ac3b5a62838 3.0.5-start c7282e59f374ee904bd793c3c444455e3399b0c5 3.1.0-start +2657fa785bbfac115852c41bd0adaff74c2ad5da DRTVWR-93_3.1.0-beta1 +2657fa785bbfac115852c41bd0adaff74c2ad5da 3.1.0-beta1 -- cgit v1.2.3 From e76eaa8b2a1f49e45d009379aaf36f8e62b6273a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 13:48:10 -0500 Subject: Fix for busted settings.xml (thanks TankMaster Finesmith) --- indra/newview/app_settings/settings.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 110e3e3d04..e7ff584b38 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9075,9 +9075,7 @@ 1 Type Boolean - Va - - lue + Value 1 RenderPreferStreamDraw -- cgit v1.2.3 From 40fe25632c62ab6a8bbb817149c159295b365d59 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 15:00:14 -0500 Subject: SH-2553 Fix for glitches when rendering HUD attachments. --- indra/llrender/llrender.cpp | 3 +++ indra/llrender/llrendersphere.cpp | 1 + indra/newview/llviewerdisplay.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index bbdd0a7a60..942ad87566 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1347,6 +1347,7 @@ void LLRender::popMatrix() void LLRender::loadMatrix(const GLfloat* m) { + flush(); mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].set_value((GLfloat*) m); mMatHash[mMatrixMode]++; } @@ -1396,6 +1397,8 @@ void LLRender::multMatrix(const GLdouble* dm) void LLRender::loadIdentity() { + flush(); + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity(); mMatHash[mMatrixMode]++; } diff --git a/indra/llrender/llrendersphere.cpp b/indra/llrender/llrendersphere.cpp index e7e07a1ab2..26bfe036e8 100644 --- a/indra/llrender/llrendersphere.cpp +++ b/indra/llrender/llrendersphere.cpp @@ -40,6 +40,7 @@ LLRenderSphere gSphere; void LLRenderSphere::render() { renderGGL(); + gGL.flush(); } inline LLVector3 polar_to_cart(F32 latitude, F32 longitude) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 835f16d086..7220f2a20f 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1359,7 +1359,12 @@ void render_ui_3d() } stop_glerror(); - + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gViewerWindow->renderSelections(FALSE, FALSE, TRUE); // Non HUD call in render_hud_elements stop_glerror(); } -- cgit v1.2.3 From 066d63022bbd073dd990ede491f111370fcaa879 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 6 Oct 2011 16:30:32 -0400 Subject: fix typo in flag for -u option --- scripts/gpu_table_tester | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gpu_table_tester b/scripts/gpu_table_tester index e1e840e2d4..9bc958636d 100755 --- a/scripts/gpu_table_tester +++ b/scripts/gpu_table_tester @@ -51,7 +51,7 @@ my $mini_HELP = " "; &GetOptions("help" => \$Help - ,"unmatched" => \$UnMatchedOnlly + ,"unmatched" => \$UnMatchedOnly ,"table-only" => \$TableOnly ,"gpu-table=s" => \$GpuTable ,"diff=s" => \$Diff -- cgit v1.2.3 From a90ea46804d1fdb60d44178140b12e341c715178 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 15:34:28 -0500 Subject: SH-2240 Fix for beacons not rendering (or crashing when rendered) --- indra/newview/llglsandbox.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 8c872283bd..844d7ba41c 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -777,6 +777,11 @@ void LLViewerObjectList::renderObjectBeacons() LLGLSUIDefault gls_ui; + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -- cgit v1.2.3 From fd91f09e19f937cb7e2f779c4e146064415ad427 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 6 Oct 2011 16:37:11 -0400 Subject: STORM-1602 improvements from leliel Mirihi, and more optimizations --- doc/contributions.txt | 1 + indra/newview/gpu_table.txt | 410 +++++++++++++++++++++++--------------------- 2 files changed, 215 insertions(+), 196 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 54392cf724..99472f6380 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -619,6 +619,7 @@ Latif Khalifa VWR-5370 leliel Mirihi STORM-1100 + STORM-1602 len Starship Lisa Lowe CT-218 diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt index e95d4d9401..c5e66d2682 100644 --- a/indra/newview/gpu_table.txt +++ b/indra/newview/gpu_table.txt @@ -44,6 +44,7 @@ ATI All-in-Wonder X1800 .*ATI.*All-in-Wonder X18.* 3 1 ATI All-in-Wonder X1900 .*ATI.*All-in-Wonder X19.* 3 1 ATI All-in-Wonder PCI-E .*ATI.*All-in-Wonder.*PCI-E.* 1 1 ATI All-in-Wonder Radeon .*ATI.*All-in-Wonder Radeon.* 0 1 +ATI ASUS ARES .*ATI.*ASUS.*ARES.* 3 1 ATI ASUS A9xxx .*ATI.*ASUS.*A9.* 1 1 ATI ASUS AH24xx .*ATI.*ASUS.*AH24.* 1 1 ATI ASUS AH26xx .*ATI.*ASUS.*AH26.* 3 1 @@ -55,6 +56,7 @@ ATI ASUS AX5xx .*ATI.*ASUS.*AX5.* 1 1 ATI ASUS AX8xx .*ATI.*ASUS.*AX8.* 2 1 ATI ASUS EAH24xx .*ATI.*ASUS.*EAH24.* 2 1 ATI ASUS EAH26xx .*ATI.*ASUS.*EAH26.* 3 1 +ATI ASUS EAH29xx .*ATI.*ASUS.*EAH29.* 3 1 ATI ASUS EAH34xx .*ATI.*ASUS.*EAH34.* 1 1 ATI ASUS EAH36xx .*ATI.*ASUS.*EAH36.* 3 1 ATI ASUS EAH38xx .*ATI.*ASUS.*EAH38.* 3 1 @@ -73,6 +75,7 @@ ATI Radeon X16xx .*ATI.*(Radeon|Diamond) X16.* ?.* 2 1 ATI Radeon X15xx .*ATI.*(Radeon|Diamond) X15.* ?.* 2 1 ATI Radeon X13xx .*ATI.*(Radeon|Diamond) X13.* ?.* 1 1 ATI Radeon X1xxx .*ATI.*(Radeon|Diamond) X1.. ?.* 1 1 +ATI Radeon X2xxx .*ATI.*(Radeon|Diamond) X2.. ?.* 1 1 ATI Display Adapter .*ATI.*display adapter.* 0 1 ATI FireGL 5200 .*ATI.*FireGL V52.* 0 1 ATI FireGL 5xxx .*ATI.*FireGL V5.* 1 1 @@ -97,7 +100,7 @@ ATI M76 .*ATI.*M76.* 3 1 ATI Radeon HD 64xx .*ATI.*AMD Radeon.* HD [67]4..[MG] 3 1 ATI Radeon HD 65xx .*ATI.*AMD Radeon.* HD [67]5..[MG] 3 1 ATI Radeon HD 66xx .*ATI.*AMD Radeon.* HD [67]6..[MG] 3 1 -ATI Mobility Radeon 4100 .*ATI.*Mobility.*41.* 1 1 +ATI Mobility Radeon 4100 .*ATI.*Mobility.*41.. 1 1 ATI Mobility Radeon 7xxx .*ATI.*Mobility.*Radeon 7.* 0 1 ATI Mobility Radeon 8xxx .*ATI.*Mobility.*Radeon 8.* 0 1 ATI Mobility Radeon 9800 .*ATI.*Mobility.*98.* 1 1 @@ -194,12 +197,12 @@ ATI RS880M .*ATI.*RS880M 1 1 ATI Radeon RX9550 .*ATI.*RX9550.* 1 1 ATI Radeon VE .*ATI.*Radeon.*VE.* 0 0 ATI Radeon X300 .*ATI.*Radeon *X3.* 0 1 -ATI Radeon X400 .*ATI.*Radeon X4.* 0 1 -ATI Radeon X500 .*ATI.*Radeon X5.* 0 1 -ATI Radeon X600 .*ATI.*Radeon X6.* 1 1 -ATI Radeon X700 .*ATI.*Radeon X7.* 1 1 -ATI Radeon X800 .*ATI.*Radeon X8.* 2 1 -ATI Radeon X900 .*ATI.*Radeon X9.* 2 1 +ATI Radeon X400 .*ATI.*Radeon ?X4.* 0 1 +ATI Radeon X500 .*ATI.*Radeon ?X5.* 0 1 +ATI Radeon X600 .*ATI.*Radeon ?X6.* 1 1 +ATI Radeon X700 .*ATI.*Radeon ?X7.* 1 1 +ATI Radeon X800 .*ATI.*Radeon ?X8.* 2 1 +ATI Radeon X900 .*ATI.*Radeon ?X9.* 2 1 ATI Radeon Xpress .*ATI.*Radeon Xpress.* 0 1 ATI Rage 128 .*ATI.*Rage 128.* 0 1 ATI R350 (9800) .*R350.* 1 1 @@ -285,196 +288,210 @@ Intel HD Graphics 2000 .*Intel.*HD2000.* 1 1 Intel HD Graphics 3000 .*Intel.*HD3000.* 2 1 Matrox .*Matrox.* 0 0 Mesa .*Mesa.* 0 0 -NVIDIA 205 .*NVIDIA.*GeForce 205.* 2 1 -NVIDIA 210 .*NVIDIA.*GeForce 210.* 2 1 -NVIDIA 310M .*NVIDIA.*GeForce 310M.* 1 1 -NVIDIA 310 .*NVIDIA.*GeForce 310.* 3 1 -NVIDIA 315M .*NVIDIA.*GeForce 315M.* 2 1 -NVIDIA 315 .*NVIDIA.*GeForce 315.* 3 1 -NVIDIA 320M .*NVIDIA.*GeForce 320M.* 2 1 -NVIDIA G100M .*NVIDIA *(GeForce)? *(G)? ?100M.* 0 1 -NVIDIA G100 .*NVIDIA *(GeForce)? *(G)? ?100.* 0 1 -NVIDIA G102M .*NVIDIA *(GeForce)? *(G)? ?102M.* 0 1 -NVIDIA G103M .*NVIDIA *(GeForce)? *(G)? ?103M.* 0 1 -NVIDIA G105M .*NVIDIA *(GeForce)? *(G)? ?105M.* 0 1 -NVIDIA G 110M .*NVIDIA *(GeForce)? *(G)? ?110M.* 0 1 -NVIDIA G 120M .*NVIDIA *(GeForce)? *(G)? ?120M.* 1 1 -NVIDIA G 200 .*NVIDIA *(GeForce)? *(G)? ?200(M)?.* 0 1 -NVIDIA G 205M .*NVIDIA *(GeForce)? *(G)? ?205(M)?.* 0 1 -NVIDIA G 210 .*NVIDIA *(GeForce)? *(G)? ?210(M)?.* 1 1 -NVIDIA 305M .*NVIDIA *(GeForce)? *(G)? ?305(M)?.* 1 1 -NVIDIA G 310M .*NVIDIA *(GeForce)? *(G)? ?310(M)?.* 2 1 -NVIDIA G 315 .*NVIDIA *(GeForce)? *(G)? ?315(M)?.* 2 1 -NVIDIA G 320M .*NVIDIA *(GeForce)? *(G)? ?320(M)?.* 2 1 -NVIDIA G 405 .*NVIDIA *(GeForce)? *(G)? ?405(M)?.* 1 1 -NVIDIA G 410M .*NVIDIA *(GeForce)? *(G)? ?410(M)?.* 1 1 -NVIDIA GT 120M .*NVIDIA *(GeForce)? *GT *120(M)?.* 2 1 -NVIDIA GT 120 .*NVIDIA.*GT.*120 2 1 -NVIDIA GT 130M .*NVIDIA *(GeForce)? *GT *130(M)?.* 2 1 -NVIDIA GT 140M .*NVIDIA *(GeForce)? *GT *140(M)?.* 2 1 -NVIDIA GT 150M .*NVIDIA *(GeForce)? *GT(S)? *150(M)?.* 2 1 -NVIDIA GT 160M .*NVIDIA *(GeForce)? *GT *160(M)?.* 2 1 -NVIDIA GT 220M .*NVIDIA *(GeForce)? *GT *220(M)?.* 2 1 -NVIDIA GT 230M .*NVIDIA *(GeForce)? *GT *230(M)?.* 2 1 -NVIDIA GT 240M .*NVIDIA *(GeForce)? *GT *240(M)?.* 2 1 -NVIDIA GT 250M .*NVIDIA *(GeForce)? *GT *250(M)?.* 2 1 -NVIDIA GT 260M .*NVIDIA *(GeForce)? *GT *260(M)?.* 2 1 -NVIDIA GT 320M .*NVIDIA *(GeForce)? *GT *320(M)?.* 2 1 -NVIDIA GT 325M .*NVIDIA *(GeForce)? *GT *325(M)?.* 0 1 -NVIDIA GT 330M .*NVIDIA *(GeForce)? *GT *330(M)?.* 3 1 -NVIDIA GT 335M .*NVIDIA *(GeForce)? *GT *335(M)?.* 1 1 -NVIDIA GT 340M .*NVIDIA *(GeForce)? *GT *340(M)?.* 2 1 -NVIDIA GT 415M .*NVIDIA *(GeForce)? *GT *415(M)?.* 2 1 -NVIDIA GT 420M .*NVIDIA *(GeForce)? *GT *420(M)?.* 2 1 -NVIDIA GT 425M .*NVIDIA *(GeForce)? *GT *425(M)?.* 3 1 -NVIDIA GT 430M .*NVIDIA *(GeForce)? *GT *430(M)?.* 3 1 -NVIDIA GT 435M .*NVIDIA *(GeForce)? *GT *435(M)?.* 3 1 -NVIDIA GT 440M .*NVIDIA *(GeForce)? *GT *440(M)?.* 3 1 -NVIDIA GT 445M .*NVIDIA *(GeForce)? *GT *445(M)?.* 3 1 -NVIDIA GT 450M .*NVIDIA *(GeForce)? *GT *450(M)?.* 3 1 -NVIDIA GT 520M .*NVIDIA *(GeForce)? *GT *520(M)?.* 3 1 -NVIDIA GT 525M .*NVIDIA *(GeForce)? *GT *525(M)?.* 3 1 -NVIDIA GT 540M .*NVIDIA *(GeForce)? *GT *540(M)?.* 3 1 -NVIDIA GT 550M .*NVIDIA *(GeForce)? *GT *550(M)?.* 3 1 -NVIDIA GT 555M .*NVIDIA *(GeForce)? *GT *555(M)?.* 3 1 -NVIDIA GTS 160M .*NVIDIA *(GeForce)? *GT(S)? *160(M)?.* 2 1 -NVIDIA GTS 240 .*NVIDIA *(GeForce)? *GTS *24.* 3 1 -NVIDIA GTS 250 .*NVIDIA *(GeForce)? *GTS *25.* 3 1 -NVIDIA GTS 350M .*NVIDIA *(GeForce)? *GTS *350M.* 3 1 -NVIDIA GTS 360M .*NVIDIA *(GeForce)? *GTS *360M.* 3 1 -NVIDIA GTS 360 .*NVIDIA *(GeForce)? *GTS *360.* 3 1 -NVIDIA GTS 450 .*NVIDIA *(GeForce)? *GTS *45.* 3 1 -NVIDIA GTX 260 .*NVIDIA *(GeForce)? *GTX *26.* 3 1 -NVIDIA GTX 275 .*NVIDIA *(GeForce)? *GTX *275.* 3 1 -NVIDIA GTX 270 .*NVIDIA *(GeForce)? *GTX *27.* 3 1 -NVIDIA GTX 285 .*NVIDIA *(GeForce)? *GTX *285.* 3 1 -NVIDIA GTX 280 .*NVIDIA *(GeForce)? *GTX *280.* 3 1 -NVIDIA GTX 290 .*NVIDIA *(GeForce)? *GTX *290.* 3 1 -NVIDIA GTX 295 .*NVIDIA *(GeForce)? *GTX *295.* 3 1 -NVIDIA GTX 460M .*NVIDIA *(GeForce)? *GTX *460M.* 3 1 -NVIDIA GTX 465 .*NVIDIA *(GeForce)? *GTX *465.* 3 1 -NVIDIA GTX 460 .*NVIDIA *(GeForce)? *GTX *46.* 3 1 -NVIDIA GTX 470M .*NVIDIA *(GeForce)? *GTX *470M.* 3 1 -NVIDIA GTX 470 .*NVIDIA *(GeForce)? *GTX *47.* 3 1 -NVIDIA GTX 480M .*NVIDIA *(GeForce)? *GTX *480M.* 3 1 -NVIDIA GTX 485M .*NVIDIA *(GeForce)? *GTX *485M.* 3 1 -NVIDIA GTX 480 .*NVIDIA *(GeForce)? *GTX *48.* 3 1 -NVIDIA GTX 530 .*NVIDIA *(GeForce)? *GTX *53.* 3 1 -NVIDIA GTX 550 .*NVIDIA *(GeForce)? *GTX *55.* 3 1 -NVIDIA GTX 560 .*NVIDIA *(GeForce)? *GTX *56.* 3 1 -NVIDIA GTX 570 .*NVIDIA *(GeForce)? *GTX *57.* 3 1 -NVIDIA GTX 580M .*NVIDIA *(GeForce)? *GTX *580M.* 3 1 -NVIDIA GTX 580 .*NVIDIA *(GeForce)? *GTX *58.* 3 1 -NVIDIA GTX 590 .*NVIDIA *(GeForce)? *GTX *59.* 3 1 -NVIDIA C51 .*NVIDIA *(GeForce)? *C51.* 0 1 -NVIDIA G72 .*NVIDIA *(GeForce)? *G72.* 1 1 -NVIDIA G73 .*NVIDIA *(GeForce)? *G73.* 1 1 -NVIDIA G84 .*NVIDIA *(GeForce)? *G84.* 2 1 -NVIDIA G86 .*NVIDIA *(GeForce)? *G86.* 3 1 -NVIDIA G92 .*NVIDIA *(GeForce)? *G92.* 3 1 +NVIDIA 205 .*NVIDIA .*GeForce 205.* 2 1 +NVIDIA 210 .*NVIDIA .*GeForce 210.* 2 1 +NVIDIA 310M .*NVIDIA .*GeForce 310M.* 1 1 +NVIDIA 310 .*NVIDIA .*GeForce 310.* 3 1 +NVIDIA 315M .*NVIDIA .*GeForce 315M.* 2 1 +NVIDIA 315 .*NVIDIA .*GeForce 315.* 3 1 +NVIDIA 320M .*NVIDIA .*GeForce 320M.* 2 1 +NVIDIA G100M .*NVIDIA .*100M.* 0 1 +NVIDIA G100 .*NVIDIA .*100.* 0 1 +NVIDIA G102M .*NVIDIA .*102M.* 0 1 +NVIDIA G103M .*NVIDIA .*103M.* 0 1 +NVIDIA G105M .*NVIDIA .*105M.* 0 1 +NVIDIA G 110M .*NVIDIA .*110M.* 0 1 +NVIDIA G 120M .*NVIDIA .*120M.* 1 1 +NVIDIA G 200 .*NVIDIA .*200(M)?.* 0 1 +NVIDIA G 205M .*NVIDIA .*205(M)?.* 0 1 +NVIDIA G 210 .*NVIDIA .*210(M)?.* 1 1 +NVIDIA 305M .*NVIDIA .*305(M)?.* 1 1 +NVIDIA G 310M .*NVIDIA .*310(M)?.* 2 1 +NVIDIA G 315 .*NVIDIA .*315(M)?.* 2 1 +NVIDIA G 320M .*NVIDIA .*320(M)?.* 2 1 +NVIDIA G 405 .*NVIDIA .*405(M)?.* 1 1 +NVIDIA G 410M .*NVIDIA .*410(M)?.* 1 1 +NVIDIA GT 120M .*NVIDIA .*GT *120(M)?.* 2 1 +NVIDIA GT 120 .*NVIDIA .*GT.*120 2 1 +NVIDIA GT 130M .*NVIDIA .*GT *130(M)?.* 2 1 +NVIDIA GT 140M .*NVIDIA .*GT *140(M)?.* 2 1 +NVIDIA GT 150M .*NVIDIA .*GT(S)? *150(M)?.* 2 1 +NVIDIA GT 160M .*NVIDIA .*GT *160(M)?.* 2 1 +NVIDIA GT 220M .*NVIDIA .*GT *220(M)?.* 2 1 +NVIDIA GT 230M .*NVIDIA .*GT *230(M)?.* 2 1 +NVIDIA GT 240M .*NVIDIA .*GT *240(M)?.* 2 1 +NVIDIA GT 250M .*NVIDIA .*GT *250(M)?.* 2 1 +NVIDIA GT 260M .*NVIDIA .*GT *260(M)?.* 2 1 +NVIDIA GT 320M .*NVIDIA .*GT *320(M)?.* 2 1 +NVIDIA GT 325M .*NVIDIA .*GT *325(M)?.* 0 1 +NVIDIA GT 330M .*NVIDIA .*GT *330(M)?.* 3 1 +NVIDIA GT 335M .*NVIDIA .*GT *335(M)?.* 1 1 +NVIDIA GT 340M .*NVIDIA .*GT *340(M)?.* 2 1 +NVIDIA GT 415M .*NVIDIA .*GT *415(M)?.* 2 1 +NVIDIA GT 420M .*NVIDIA .*GT *420(M)?.* 2 1 +NVIDIA GT 425M .*NVIDIA .*GT *425(M)?.* 3 1 +NVIDIA GT 430M .*NVIDIA .*GT *430(M)?.* 3 1 +NVIDIA GT 435M .*NVIDIA .*GT *435(M)?.* 3 1 +NVIDIA GT 440M .*NVIDIA .*GT *440(M)?.* 3 1 +NVIDIA GT 445M .*NVIDIA .*GT *445(M)?.* 3 1 +NVIDIA GT 450M .*NVIDIA .*GT *450(M)?.* 3 1 +NVIDIA GT 520M .*NVIDIA .*GT *52.(M)?.* 3 1 +NVIDIA GT 530M .*NVIDIA .*GT *530(M)?.* 3 1 +NVIDIA GT 540M .*NVIDIA .*GT *54.(M)?.* 3 1 +NVIDIA GT 550M .*NVIDIA .*GT *550(M)?.* 3 1 +NVIDIA GT 555M .*NVIDIA .*GT *555(M)?.* 3 1 +NVIDIA GTS 160M .*NVIDIA .*GT(S)? *160(M)?.* 2 1 +NVIDIA GTS 240 .*NVIDIA .*GTS *24.* 3 1 +NVIDIA GTS 250 .*NVIDIA .*GTS *25.* 3 1 +NVIDIA GTS 350M .*NVIDIA .*GTS *350M.* 3 1 +NVIDIA GTS 360M .*NVIDIA .*GTS *360M.* 3 1 +NVIDIA GTS 360 .*NVIDIA .*GTS *360.* 3 1 +NVIDIA GTS 450 .*NVIDIA .*GTS *45.* 3 1 +NVIDIA GTX 260 .*NVIDIA .*GTX *26.* 3 1 +NVIDIA GTX 275 .*NVIDIA .*GTX *275.* 3 1 +NVIDIA GTX 270 .*NVIDIA .*GTX *27.* 3 1 +NVIDIA GTX 285 .*NVIDIA .*GTX *285.* 3 1 +NVIDIA GTX 280 .*NVIDIA .*GTX *280.* 3 1 +NVIDIA GTX 290 .*NVIDIA .*GTX *290.* 3 1 +NVIDIA GTX 295 .*NVIDIA .*GTX *295.* 3 1 +NVIDIA GTX 460M .*NVIDIA .*GTX *460M.* 3 1 +NVIDIA GTX 465 .*NVIDIA .*GTX *465.* 3 1 +NVIDIA GTX 460 .*NVIDIA .*GTX *46.* 3 1 +NVIDIA GTX 470M .*NVIDIA .*GTX *470M.* 3 1 +NVIDIA GTX 470 .*NVIDIA .*GTX *47.* 3 1 +NVIDIA GTX 480M .*NVIDIA .*GTX *480M.* 3 1 +NVIDIA GTX 485M .*NVIDIA .*GTX *485M.* 3 1 +NVIDIA GTX 480 .*NVIDIA .*GTX *48.* 3 1 +NVIDIA GTX 530 .*NVIDIA .*GTX *53.* 3 1 +NVIDIA GTX 550 .*NVIDIA .*GTX *55.* 3 1 +NVIDIA GTX 560 .*NVIDIA .*GTX *56.* 3 1 +NVIDIA GTX 570 .*NVIDIA .*GTX *57.* 3 1 +NVIDIA GTX 580M .*NVIDIA .*GTX *580M.* 3 1 +NVIDIA GTX 580 .*NVIDIA .*GTX *58.* 3 1 +NVIDIA GTX 590 .*NVIDIA .*GTX *59.* 3 1 +NVIDIA C51 .*NVIDIA .*C51.* 0 1 +NVIDIA G72 .*NVIDIA .*G72.* 1 1 +NVIDIA G73 .*NVIDIA .*G73.* 1 1 +NVIDIA G84 .*NVIDIA .*G84.* 2 1 +NVIDIA G86 .*NVIDIA .*G86.* 3 1 +NVIDIA G92 .*NVIDIA .*G92.* 3 1 NVIDIA GeForce .*GeForce 256.* 0 0 NVIDIA GeForce 2 .*GeForce ?2 ?.* 0 1 NVIDIA GeForce 3 .*GeForce ?3 ?.* 0 1 NVIDIA GeForce 3 Ti .*GeForce ?3 Ti.* 0 1 -NVIDIA GeForce 4 .*NVIDIA.*GeForce ?4.* 0 1 -NVIDIA GeForce 4 Go .*NVIDIA.*GeForce ?4.*Go.* 0 1 -NVIDIA GeForce 4 MX .*NVIDIA.*GeForce ?4 MX.* 0 1 -NVIDIA GeForce 4 PCX .*NVIDIA.*GeForce ?4 PCX.* 0 1 -NVIDIA GeForce 4 Ti .*NVIDIA.*GeForce ?4 Ti.* 0 1 -NVIDIA GeForce 6100 .*NVIDIA.*GeForce 61.* 0 1 -NVIDIA GeForce 6200 .*NVIDIA.*GeForce 62.* 0 1 -NVIDIA GeForce 6500 .*NVIDIA.*GeForce 65.* 0 1 -NVIDIA GeForce 6600 .*NVIDIA.*GeForce 66.* 1 1 -NVIDIA GeForce 6700 .*NVIDIA.*GeForce 67.* 2 1 -NVIDIA GeForce 6800 .*NVIDIA.*GeForce 68.* 2 1 -NVIDIA GeForce 7000 .*NVIDIA.*GeForce 70.* 0 1 -NVIDIA GeForce 7100 .*NVIDIA.*GeForce 71.* 0 1 -NVIDIA GeForce 7200 .*NVIDIA.*GeForce 72.* 1 1 -NVIDIA GeForce 7300 .*NVIDIA.*GeForce 73.* 1 1 -NVIDIA GeForce 7500 .*NVIDIA.*GeForce 75.* 1 1 -NVIDIA GeForce 7600 .*NVIDIA.*GeForce 76.* 2 1 -NVIDIA GeForce 7800 .*NVIDIA.*GeForce 78.* 2 1 -NVIDIA GeForce 7900 .*NVIDIA.*GeForce 79.* 2 1 -NVIDIA GeForce 8100 .*NVIDIA.*GeForce 81.* 1 1 -NVIDIA GeForce 8200M .*NVIDIA.*GeForce 8200M.* 1 1 -NVIDIA GeForce 8200 .*NVIDIA.*GeForce 82.* 1 1 -NVIDIA GeForce 8300 .*NVIDIA.*GeForce 83.* 1 1 -NVIDIA GeForce 8400M .*NVIDIA.*GeForce 8400M.* 1 1 -NVIDIA GeForce 8400 .*NVIDIA.*GeForce 84.* 1 1 -NVIDIA GeForce 8500 .*NVIDIA.*GeForce 85.* 3 1 -NVIDIA GeForce 8600M .*NVIDIA.*GeForce 8600M.* 1 1 -NVIDIA GeForce 8600 .*NVIDIA.*GeForce 86.* 3 1 -NVIDIA GeForce 8700M .*NVIDIA.*GeForce 8700M.* 3 1 -NVIDIA GeForce 8700 .*NVIDIA.*GeForce 87.* 3 1 -NVIDIA GeForce 8800M .*NVIDIA.*GeForce 8800M.* 3 1 -NVIDIA GeForce 8800 .*NVIDIA.*GeForce 88.* 3 1 -NVIDIA GeForce 9100M .*NVIDIA.*GeForce 9100M.* 0 1 -NVIDIA GeForce 9100 .*NVIDIA.*GeForce 91.* 0 1 -NVIDIA GeForce 9200M .*NVIDIA.*GeForce 9200M.* 1 1 -NVIDIA GeForce 9200 .*NVIDIA.*GeForce 92.* 1 1 -NVIDIA GeForce 9300M .*NVIDIA.*GeForce 9300M.* 1 1 -NVIDIA GeForce 9300 .*NVIDIA.*GeForce 93.* 1 1 -NVIDIA GeForce 9400M .*NVIDIA.*GeForce 9400M.* 1 1 -NVIDIA GeForce 9400 .*NVIDIA.*GeForce 94.* 1 1 -NVIDIA GeForce 9500M .*NVIDIA.*GeForce 9500M.* 2 1 -NVIDIA GeForce 9500 .*NVIDIA.*GeForce 95.* 2 1 -NVIDIA GeForce 9600M .*NVIDIA.*GeForce 9600M.* 3 1 -NVIDIA GeForce 9600 .*NVIDIA.*GeForce 96.* 2 1 -NVIDIA GeForce 9700M .*NVIDIA.*GeForce 9700M.* 2 1 -NVIDIA GeForce 9800M .*NVIDIA.*GeForce 9800M.* 3 1 -NVIDIA GeForce 9800 .*NVIDIA.*GeForce 98.* 3 1 -NVIDIA GeForce FX 5100 .*NVIDIA.*GeForce FX 51.* 0 1 -NVIDIA GeForce FX 5200 .*NVIDIA.*GeForce FX 52.* 0 1 -NVIDIA GeForce FX 5300 .*NVIDIA.*GeForce FX 53.* 0 1 -NVIDIA GeForce FX 5500 .*NVIDIA.*GeForce FX 55.* 0 1 -NVIDIA GeForce FX 5600 .*NVIDIA.*GeForce FX 56.* 0 1 -NVIDIA GeForce FX 5700 .*NVIDIA.*GeForce FX 57.* 1 1 -NVIDIA GeForce FX 5800 .*NVIDIA.*GeForce FX 58.* 1 1 -NVIDIA GeForce FX 5900 .*NVIDIA.*GeForce FX 59.* 1 1 -NVIDIA GeForce FX Go5100 .*NVIDIA.*GeForce FX Go51.* 0 1 -NVIDIA GeForce FX Go5200 .*NVIDIA.*GeForce FX Go52.* 0 1 -NVIDIA GeForce FX Go5300 .*NVIDIA.*GeForce FX Go53.* 0 1 -NVIDIA GeForce FX Go5500 .*NVIDIA.*GeForce FX Go55.* 0 1 -NVIDIA GeForce FX Go5600 .*NVIDIA.*GeForce FX Go56.* 0 1 -NVIDIA GeForce FX Go5700 .*NVIDIA.*GeForce FX Go57.* 1 1 -NVIDIA GeForce FX Go5800 .*NVIDIA.*GeForce FX Go58.* 1 1 -NVIDIA GeForce FX Go5900 .*NVIDIA.*GeForce FX Go59.* 1 1 -NVIDIA GeForce FX Go5xxx .*NVIDIA.*GeForce FX Go.* 0 1 -NVIDIA GeForce Go 6100 .*NVIDIA.*GeForce Go 61.* 0 1 -NVIDIA GeForce Go 6200 .*NVIDIA.*GeForce Go 62.* 0 1 -NVIDIA GeForce Go 6400 .*NVIDIA.*GeForce Go 64.* 1 1 -NVIDIA GeForce Go 6500 .*NVIDIA.*GeForce Go 65.* 1 1 -NVIDIA GeForce Go 6600 .*NVIDIA.*GeForce Go 66.* 1 1 -NVIDIA GeForce Go 6700 .*NVIDIA.*GeForce Go 67.* 1 1 -NVIDIA GeForce Go 6800 .*NVIDIA.*GeForce Go 68.* 1 1 -NVIDIA GeForce Go 7200 .*NVIDIA.*GeForce Go 72.* 1 1 -NVIDIA GeForce Go 7300 LE .*NVIDIA.*GeForce Go 73.*LE.* 0 1 -NVIDIA GeForce Go 7300 .*NVIDIA.*GeForce Go 73.* 1 1 -NVIDIA GeForce Go 7400 .*NVIDIA.*GeForce Go 74.* 1 1 -NVIDIA GeForce Go 7600 .*NVIDIA.*GeForce Go 76.* 2 1 -NVIDIA GeForce Go 7700 .*NVIDIA.*GeForce Go 77.* 2 1 -NVIDIA GeForce Go 7800 .*NVIDIA.*GeForce Go 78.* 2 1 -NVIDIA GeForce Go 7900 .*NVIDIA.*GeForce Go 79.* 2 1 -NVIDIA D9M .*NVIDIA.*D9M.* 1 1 -NVIDIA G94 .*NVIDIA.*G94.* 3 1 +NVIDIA GeForce 4 .*NVIDIA .*GeForce ?4.* 0 1 +NVIDIA GeForce 4 Go .*NVIDIA .*GeForce ?4.*Go.* 0 1 +NVIDIA GeForce 4 MX .*NVIDIA .*GeForce ?4 MX.* 0 1 +NVIDIA GeForce 4 PCX .*NVIDIA .*GeForce ?4 PCX.* 0 1 +NVIDIA GeForce 4 Ti .*NVIDIA .*GeForce ?4 Ti.* 0 1 +NVIDIA GeForce 6100 .*NVIDIA .*GeForce 61.* 0 1 +NVIDIA GeForce 6200 .*NVIDIA .*GeForce 62.* 0 1 +NVIDIA GeForce 6500 .*NVIDIA .*GeForce 65.* 0 1 +NVIDIA GeForce 6600 .*NVIDIA .*GeForce 66.* 1 1 +NVIDIA GeForce 6700 .*NVIDIA .*GeForce 67.* 2 1 +NVIDIA GeForce 6800 .*NVIDIA .*GeForce 68.* 2 1 +NVIDIA GeForce 7000 .*NVIDIA .*GeForce 70.* 0 1 +NVIDIA GeForce 7100 .*NVIDIA .*GeForce 71.* 0 1 +NVIDIA GeForce 7200 .*NVIDIA .*GeForce 72.* 1 1 +NVIDIA GeForce 7300 .*NVIDIA .*GeForce 73.* 1 1 +NVIDIA GeForce 7500 .*NVIDIA .*GeForce 75.* 1 1 +NVIDIA GeForce 7600 .*NVIDIA .*GeForce 76.* 2 1 +NVIDIA GeForce 7800 .*NVIDIA .*GeForce 78.* 2 1 +NVIDIA GeForce 7900 .*NVIDIA .*GeForce 79.* 2 1 +NVIDIA GeForce 8100 .*NVIDIA .*GeForce 81.* 1 1 +NVIDIA GeForce 8200M .*NVIDIA .*GeForce 8200M.* 1 1 +NVIDIA GeForce 8200 .*NVIDIA .*GeForce 82.* 1 1 +NVIDIA GeForce 8300 .*NVIDIA .*GeForce 83.* 1 1 +NVIDIA GeForce 8400M .*NVIDIA .*GeForce 8400M.* 1 1 +NVIDIA GeForce 8400 .*NVIDIA .*GeForce 84.* 1 1 +NVIDIA GeForce 8500 .*NVIDIA .*GeForce 85.* 3 1 +NVIDIA GeForce 8600M .*NVIDIA .*GeForce 8600M.* 1 1 +NVIDIA GeForce 8600 .*NVIDIA .*GeForce 86.* 3 1 +NVIDIA GeForce 8700M .*NVIDIA .*GeForce 8700M.* 3 1 +NVIDIA GeForce 8700 .*NVIDIA .*GeForce 87.* 3 1 +NVIDIA GeForce 8800M .*NVIDIA .*GeForce 8800M.* 3 1 +NVIDIA GeForce 8800 .*NVIDIA .*GeForce 88.* 3 1 +NVIDIA GeForce 9100M .*NVIDIA .*GeForce 9100M.* 0 1 +NVIDIA GeForce 9100 .*NVIDIA .*GeForce 91.* 0 1 +NVIDIA GeForce 9200M .*NVIDIA .*GeForce 9200M.* 1 1 +NVIDIA GeForce 9200 .*NVIDIA .*GeForce 92.* 1 1 +NVIDIA GeForce 9300M .*NVIDIA .*GeForce 9300M.* 1 1 +NVIDIA GeForce 9300 .*NVIDIA .*GeForce 93.* 1 1 +NVIDIA GeForce 9400M .*NVIDIA .*GeForce 9400M.* 1 1 +NVIDIA GeForce 9400 .*NVIDIA .*GeForce 94.* 1 1 +NVIDIA GeForce 9500M .*NVIDIA .*GeForce 9500M.* 2 1 +NVIDIA GeForce 9500 .*NVIDIA .*GeForce 95.* 2 1 +NVIDIA GeForce 9600M .*NVIDIA .*GeForce 9600M.* 3 1 +NVIDIA GeForce 9600 .*NVIDIA .*GeForce 96.* 2 1 +NVIDIA GeForce 9700M .*NVIDIA .*GeForce 9700M.* 2 1 +NVIDIA GeForce 9800M .*NVIDIA .*GeForce 9800M.* 3 1 +NVIDIA GeForce 9800 .*NVIDIA .*GeForce 98.* 3 1 +NVIDIA GeForce FX 5100 .*NVIDIA .*GeForce FX 51.* 0 1 +NVIDIA GeForce FX 5200 .*NVIDIA .*GeForce FX 52.* 0 1 +NVIDIA GeForce FX 5300 .*NVIDIA .*GeForce FX 53.* 0 1 +NVIDIA GeForce FX 5500 .*NVIDIA .*GeForce FX 55.* 0 1 +NVIDIA GeForce FX 5600 .*NVIDIA .*GeForce FX 56.* 0 1 +NVIDIA GeForce FX 5700 .*NVIDIA .*GeForce FX 57.* 1 1 +NVIDIA GeForce FX 5800 .*NVIDIA .*GeForce FX 58.* 1 1 +NVIDIA GeForce FX 5900 .*NVIDIA .*GeForce FX 59.* 1 1 +NVIDIA GeForce FX Go5100 .*NVIDIA .*GeForce FX Go51.* 0 1 +NVIDIA GeForce FX Go5200 .*NVIDIA .*GeForce FX Go52.* 0 1 +NVIDIA GeForce FX Go5300 .*NVIDIA .*GeForce FX Go53.* 0 1 +NVIDIA GeForce FX Go5500 .*NVIDIA .*GeForce FX Go55.* 0 1 +NVIDIA GeForce FX Go5600 .*NVIDIA .*GeForce FX Go56.* 0 1 +NVIDIA GeForce FX Go5700 .*NVIDIA .*GeForce FX Go57.* 1 1 +NVIDIA GeForce FX Go5800 .*NVIDIA .*GeForce FX Go58.* 1 1 +NVIDIA GeForce FX Go5900 .*NVIDIA .*GeForce FX Go59.* 1 1 +NVIDIA GeForce FX Go5xxx .*NVIDIA .*GeForce FX Go.* 0 1 +NVIDIA GeForce Go 6100 .*NVIDIA .*GeForce Go 61.* 0 1 +NVIDIA GeForce Go 6200 .*NVIDIA .*GeForce Go 62.* 0 1 +NVIDIA GeForce Go 6400 .*NVIDIA .*GeForce Go 64.* 1 1 +NVIDIA GeForce Go 6500 .*NVIDIA .*GeForce Go 65.* 1 1 +NVIDIA GeForce Go 6600 .*NVIDIA .*GeForce Go 66.* 1 1 +NVIDIA GeForce Go 6700 .*NVIDIA .*GeForce Go 67.* 1 1 +NVIDIA GeForce Go 6800 .*NVIDIA .*GeForce Go 68.* 1 1 +NVIDIA GeForce Go 7200 .*NVIDIA .*GeForce Go 72.* 1 1 +NVIDIA GeForce Go 7300 LE .*NVIDIA .*GeForce Go 73.*LE.* 0 1 +NVIDIA GeForce Go 7300 .*NVIDIA .*GeForce Go 73.* 1 1 +NVIDIA GeForce Go 7400 .*NVIDIA .*GeForce Go 74.* 1 1 +NVIDIA GeForce Go 7600 .*NVIDIA .*GeForce Go 76.* 2 1 +NVIDIA GeForce Go 7700 .*NVIDIA .*GeForce Go 77.* 2 1 +NVIDIA GeForce Go 7800 .*NVIDIA .*GeForce Go 78.* 2 1 +NVIDIA GeForce Go 7900 .*NVIDIA .*GeForce Go 79.* 2 1 +NVIDIA D9M .*NVIDIA .*D9M.* 1 1 +NVIDIA G94 .*NVIDIA .*G94.* 3 1 NVIDIA GeForce Go 6 .*GeForce Go 6.* 1 1 -NVIDIA ION 2 .*NVIDIA ION 2.* 2 1 -NVIDIA ION .*NVIDIA ION.* 2 1 -NVIDIA NB9M .*GeForce NB9M.* 1 1 -NVIDIA NB9P .*GeForce NB9P.* 1 1 +NVIDIA ION 2 .*NVIDIA .* ION 2.* 2 1 +NVIDIA ION .*NVIDIA .* ION.* 2 1 +NVIDIA NB8M .*NVIDIA .*NB8M.* 1 1 +NVIDIA NB8P .*NVIDIA .*NB8P.* 2 1 +NVIDIA NB9E .*NVIDIA .*NB9E.* 3 1 +NVIDIA NB9M .*NVIDIA .*NB9M.* 1 1 +NVIDIA NB9P .*NVIDIA .*NB9P.* 2 1 +NVIDIA N10 .*NVIDIA .*N10.* 1 1 NVIDIA GeForce PCX .*GeForce PCX.* 0 1 -NVIDIA Generic .*NVIDIA.*Unknown.* 0 0 -NVIDIA NV17 .*GeForce NV17.* 0 1 -NVIDIA NV34 .*NVIDIA.*NV34.* 0 1 -NVIDIA NV35 .*NVIDIA.*NV35.* 0 1 -NVIDIA NV36 .*GeForce NV36.* 1 1 -NVIDIA NV43 .*NVIDIA *NV43.* 1 1 -NVIDIA NV44 .*NVIDIA *NV44.* 1 1 -NVIDIA nForce .*NVIDIA *nForce.* 0 0 -NVIDIA MCP78 .*NVIDIA *MCP78.* 1 1 +NVIDIA Generic .*NVIDIA .*Unknown.* 0 0 +NVIDIA NV17 .*NVIDIA .*NV17.* 0 1 +NVIDIA NV34 .*NVIDIA .*NV34.* 0 1 +NVIDIA NV35 .*NVIDIA .*NV35.* 0 1 +NVIDIA NV36 .*NVIDIA .*NV36.* 1 1 +NVIDIA NV41 .*NVIDIA .*NV41.* 1 1 +NVIDIA NV43 .*NVIDIA .*NV43.* 1 1 +NVIDIA NV44 .*NVIDIA .*NV44.* 1 1 +NVIDIA nForce .*NVIDIA .*nForce.* 0 0 +NVIDIA MCP51 .*NVIDIA .*MCP51.* 1 1 +NVIDIA MCP61 .*NVIDIA .*MCP61.* 1 1 +NVIDIA MCP67 .*NVIDIA .*MCP67.* 1 1 +NVIDIA MCP68 .*NVIDIA .*MCP68.* 1 1 +NVIDIA MCP73 .*NVIDIA .*MCP73.* 1 1 +NVIDIA MCP77 .*NVIDIA .*MCP77.* 1 1 +NVIDIA MCP78 .*NVIDIA .*MCP78.* 1 1 +NVIDIA MCP79 .*NVIDIA .*MCP79.* 1 1 +NVIDIA MCP7A .*NVIDIA .*MCP7A.* 1 1 NVIDIA Quadro2 .*Quadro2.* 0 1 NVIDIA Quadro 1000M .*Quadro.*1000M.* 2 1 NVIDIA Quadro 2000 M/D .*Quadro.*2000.* 3 1 +NVIDIA Quadro 3000M .*Quadro.*3000M.* 3 1 NVIDIA Quadro 4000M .*Quadro.*4000M.* 3 1 NVIDIA Quadro 4000 .*Quadro *4000.* 3 1 NVIDIA Quadro 50x0 M .*Quadro.*50.0.* 3 1 @@ -483,6 +500,7 @@ NVIDIA Quadro 400 .*Quadro.*400.* 2 1 NVIDIA Quadro 600 .*Quadro.*600.* 2 1 NVIDIA Quadro4 .*Quadro4.* 0 1 NVIDIA Quadro DCC .*Quadro DCC.* 0 1 +NVIDIA Quadro CX .*Quadro.*CX.* 3 1 NVIDIA Quadro FX 770M .*Quadro.*FX *770M.* 2 1 NVIDIA Quadro FX 1500M .*Quadro.*FX *1500M.* 1 1 NVIDIA Quadro FX 1600M .*Quadro.*FX *1600M.* 2 1 @@ -495,16 +513,16 @@ NVIDIA Quadro FX 3700 .*Quadro.*FX *3700.* 3 1 NVIDIA Quadro FX 3800 .*Quadro.*FX *3800.* 3 1 NVIDIA Quadro FX 4500 .*Quadro.*FX *45.* 3 1 NVIDIA Quadro FX 880M .*Quadro.*FX *880M.* 3 1 -NVIDIA Quadro FX 4800 .*NVIDIA.*Quadro *FX *4800.* 3 1 +NVIDIA Quadro FX 4800 .*NVIDIA .*Quadro *FX *4800.* 3 1 NVIDIA Quadro FX .*Quadro FX.* 1 1 NVIDIA Quadro NVS 1xxM .*Quadro NVS *1.[05]M.* 0 1 -NVIDIA Quadro NVS 300M .*NVIDIA.*NVS *300M.* 2 1 -NVIDIA Quadro NVS 320M .*NVIDIA.*NVS *320M.* 2 1 -NVIDIA Quadro NVS 2100M .*NVIDIA.*NVS *2100M.* 2 1 -NVIDIA Quadro NVS 3100M .*NVIDIA.*NVS *3100M.* 2 1 -NVIDIA Quadro NVS 4200M .*NVIDIA.*NVS *4200M.* 2 1 -NVIDIA Quadro NVS 5100M .*NVIDIA.*NVS *5100M.* 2 1 -NVIDIA Quadro NVS .*NVIDIA.*NVS 0 1 +NVIDIA Quadro NVS 300M .*NVIDIA .*NVS *300M.* 2 1 +NVIDIA Quadro NVS 320M .*NVIDIA .*NVS *320M.* 2 1 +NVIDIA Quadro NVS 2100M .*NVIDIA .*NVS *2100M.* 2 1 +NVIDIA Quadro NVS 3100M .*NVIDIA .*NVS *3100M.* 2 1 +NVIDIA Quadro NVS 4200M .*NVIDIA .*NVS *4200M.* 2 1 +NVIDIA Quadro NVS 5100M .*NVIDIA .*NVS *5100M.* 2 1 +NVIDIA Quadro NVS .*NVIDIA .*NVS 0 1 NVIDIA RIVA TNT .*RIVA TNT.* 0 0 S3 .*S3 Graphics.* 0 0 SiS SiS.* 0 0 -- cgit v1.2.3 From f8fc12860843ba0799c8faf7f9b00bd6e63c3ecc Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 6 Oct 2011 16:41:36 -0400 Subject: update recognition results for storm-1602 --- indra/newview/tests/gpus_results.txt | 330 +++++++++++++++++------------------ 1 file changed, 165 insertions(+), 165 deletions(-) diff --git a/indra/newview/tests/gpus_results.txt b/indra/newview/tests/gpus_results.txt index 0b349b481d..f13b832ffd 100644 --- a/indra/newview/tests/gpus_results.txt +++ b/indra/newview/tests/gpus_results.txt @@ -60,7 +60,7 @@ ATI Mobility Radeon HD 4800 ATI Mobility Radeon HD 5400 supported 3 ATI Mobility Radeon HD 5400 ATI Mobility Radeon HD 5600 supported 3 ATI Mobility Radeon HD 5600 ATI Mobility Radeon X1xxx supported 1 ATI Radeon X1xxx -ATI Mobility Radeon X2xxx supported 0 ATI Radeon +ATI Mobility Radeon X2xxx supported 1 ATI Radeon X2xxx ATI Mobility Radeon X3xx supported 0 ATI Radeon X300 ATI Mobility Radeon X6xx supported 1 ATI Radeon X600 ATI Mobility Radeon X7xx supported 1 ATI Radeon X700 @@ -149,7 +149,7 @@ ATI Technologies Inc. AMD M880G with ATI Mobility Radeon HD 4200 ATI Technologies Inc. AMD M880G with ATI Mobility Radeon HD 4250 supported 2 ATI Mobility Radeon HD 4200 ATI Technologies Inc. AMD RADEON HD 6350 supported 3 ATI Radeon HD 6300 ATI Technologies Inc. AMD RADEON HD 6450 supported 3 ATI Radeon HD 6400 -ATI Technologies Inc. AMD RADEON HD 6670 supported 3 ATI Radeon HD 66xx +ATI Technologies Inc. AMD RADEON HD 6670 supported 3 ATI Radeon HD 6600 ATI Technologies Inc. AMD Radeon 6600M and 6700M Series supported 0 ATI Technologies ATI Technologies Inc. AMD Radeon HD 6200 series Graphics supported 3 ATI Radeon HD 6200 ATI Technologies Inc. AMD Radeon HD 6250 Graphics supported 3 ATI Radeon HD 6200 @@ -161,23 +161,23 @@ ATI Technologies Inc. AMD Radeon HD 6310M ATI Technologies Inc. AMD Radeon HD 6330M supported 3 ATI Radeon HD 6300 ATI Technologies Inc. AMD Radeon HD 6350 supported 3 ATI Radeon HD 6300 ATI Technologies Inc. AMD Radeon HD 6370M supported 3 ATI Radeon HD 6300 -ATI Technologies Inc. AMD Radeon HD 6400M Series supported 3 ATI Radeon HD 64xxM +ATI Technologies Inc. AMD Radeon HD 6400M Series supported 3 ATI Radeon HD 64xx ATI Technologies Inc. AMD Radeon HD 6450 supported 3 ATI Radeon HD 6400 -ATI Technologies Inc. AMD Radeon HD 6470M supported 3 ATI Radeon HD 64xxM -ATI Technologies Inc. AMD Radeon HD 6490M supported 3 ATI Radeon HD 64xxM +ATI Technologies Inc. AMD Radeon HD 6470M supported 3 ATI Radeon HD 64xx +ATI Technologies Inc. AMD Radeon HD 6490M supported 3 ATI Radeon HD 64xx ATI Technologies Inc. AMD Radeon HD 6500 Series supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6500M Series supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6500M/5600/5700 Series supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6530M supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6550M supported 3 ATI Radeon HD 6500 +ATI Technologies Inc. AMD Radeon HD 6500M Series supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon HD 6500M/5600/5700 Series supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon HD 6530M supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon HD 6550M supported 3 ATI Radeon HD 65xx ATI Technologies Inc. AMD Radeon HD 6570 supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6570M supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6570M/5700 Series supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. AMD Radeon HD 6600 Series supported 3 ATI Radeon HD 66xx +ATI Technologies Inc. AMD Radeon HD 6570M supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon HD 6570M/5700 Series supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon HD 6600 Series supported 3 ATI Radeon HD 6600 ATI Technologies Inc. AMD Radeon HD 6600M Series supported 3 ATI Radeon HD 66xx ATI Technologies Inc. AMD Radeon HD 6630M supported 3 ATI Radeon HD 66xx ATI Technologies Inc. AMD Radeon HD 6650M supported 3 ATI Radeon HD 66xx -ATI Technologies Inc. AMD Radeon HD 6670 supported 3 ATI Radeon HD 66xx +ATI Technologies Inc. AMD Radeon HD 6670 supported 3 ATI Radeon HD 6600 ATI Technologies Inc. AMD Radeon HD 6700 Series supported 3 ATI Radeon HD 6700 ATI Technologies Inc. AMD Radeon HD 6750 supported 3 ATI Radeon HD 6700 ATI Technologies Inc. AMD Radeon HD 6750M supported 3 ATI Radeon HD 6700 @@ -193,19 +193,19 @@ ATI Technologies Inc. AMD Radeon HD 6900 Series ATI Technologies Inc. AMD Radeon HD 6900M Series supported 3 ATI Radeon HD 6900 ATI Technologies Inc. AMD Radeon HD 6970M supported 3 ATI Radeon HD 6900 ATI Technologies Inc. AMD Radeon HD 6990 supported 3 ATI Radeon HD 6900 -ATI Technologies Inc. AMD Radeon(TM) HD 6470M supported 3 ATI Radeon HD 64xxM -ATI Technologies Inc. AMD Radeon(TM) HD 6480G supported 0 ATI Technologies -ATI Technologies Inc. AMD Radeon(TM) HD 6520G supported 0 ATI Technologies -ATI Technologies Inc. AMD Radeon(TM) HD 6620G supported 0 ATI Technologies -ATI Technologies Inc. AMD Radeon(TM) HD 6630M supported 0 ATI Technologies +ATI Technologies Inc. AMD Radeon(TM) HD 6470M supported 3 ATI Radeon HD 64xx +ATI Technologies Inc. AMD Radeon(TM) HD 6480G supported 3 ATI Radeon HD 64xx +ATI Technologies Inc. AMD Radeon(TM) HD 6520G supported 3 ATI Radeon HD 65xx +ATI Technologies Inc. AMD Radeon(TM) HD 6620G supported 3 ATI Radeon HD 66xx +ATI Technologies Inc. AMD Radeon(TM) HD 6630M supported 3 ATI Radeon HD 66xx ATI Technologies Inc. ASUS 5870 Eyefinity 6 supported 0 ATI Technologies ATI Technologies Inc. ASUS A9550 Series supported 1 ATI ASUS A9xxx ATI Technologies Inc. ASUS AH2600 Series supported 3 ATI ASUS AH26xx ATI Technologies Inc. ASUS AH3450 Series supported 1 ATI ASUS AH34xx ATI Technologies Inc. ASUS AH3650 Series supported 3 ATI ASUS AH36xx ATI Technologies Inc. ASUS AH4650 Series supported 3 ATI ASUS AH46xx -ATI Technologies Inc. ASUS ARES supported 0 ATI Technologies -ATI Technologies Inc. ASUS EAH2900 Series supported 0 ATI Technologies +ATI Technologies Inc. ASUS ARES supported 3 ATI ASUS ARES +ATI Technologies Inc. ASUS EAH2900 Series supported 3 ATI ASUS EAH29xx ATI Technologies Inc. ASUS EAH3450 Series supported 1 ATI ASUS AH34xx ATI Technologies Inc. ASUS EAH3650 Series supported 3 ATI ASUS AH36xx ATI Technologies Inc. ASUS EAH4350 series supported 1 ATI ASUS EAH43xx @@ -259,10 +259,10 @@ ATI Technologies Inc. ATI MOBILITY RADEON HD 2300 ATI Technologies Inc. ATI MOBILITY RADEON HD 3450 supported 2 ATI Mobility Radeon HD 3400 ATI Technologies Inc. ATI MOBILITY RADEON HD 3650 supported 3 ATI Mobility Radeon HD 3600 ATI Technologies Inc. ATI MOBILITY RADEON X1600 supported 2 ATI Radeon X16xx -ATI Technologies Inc. ATI MOBILITY RADEON X2300 supported 0 ATI Technologies -ATI Technologies Inc. ATI MOBILITY RADEON X2300 HD x86/SSE2 supported 0 ATI Technologies -ATI Technologies Inc. ATI MOBILITY RADEON X2300 x86/MMX/3DNow!/SSE2 supported 0 ATI Technologies -ATI Technologies Inc. ATI MOBILITY RADEON X2300 x86/SSE2 supported 0 ATI Technologies +ATI Technologies Inc. ATI MOBILITY RADEON X2300 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI MOBILITY RADEON X2300 HD x86/SSE2 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI MOBILITY RADEON X2300 x86/MMX/3DNow!/SSE2 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI MOBILITY RADEON X2300 x86/SSE2 supported 1 ATI Radeon X2xxx ATI Technologies Inc. ATI MOBILITY RADEON X300 supported 0 ATI Radeon X300 ATI Technologies Inc. ATI MOBILITY RADEON X600 supported 1 ATI Radeon X600 ATI Technologies Inc. ATI MOBILITY RADEON X700 supported 1 ATI Radeon X700 @@ -277,7 +277,7 @@ ATI Technologies Inc. ATI Mobility Radeon HD 2600 ATI Technologies Inc. ATI Mobility Radeon HD 2600 XT supported 3 ATI Mobility Radeon HD 2600 ATI Technologies Inc. ATI Mobility Radeon HD 2700 supported 3 ATI Mobility Radeon HD 2700 ATI Technologies Inc. ATI Mobility Radeon HD 3400 Series supported 2 ATI Mobility Radeon HD 3400 -ATI Technologies Inc. ATI Mobility Radeon HD 3410 supported 1 ATI Mobility Radeon 4100 +ATI Technologies Inc. ATI Mobility Radeon HD 3410 supported 2 ATI Mobility Radeon HD 3400 ATI Technologies Inc. ATI Mobility Radeon HD 3430 supported 2 ATI Mobility Radeon HD 3400 ATI Technologies Inc. ATI Mobility Radeon HD 3450 supported 2 ATI Mobility Radeon HD 3400 ATI Technologies Inc. ATI Mobility Radeon HD 3470 supported 2 ATI Mobility Radeon HD 3400 @@ -348,13 +348,13 @@ ATI Technologies Inc. ATI Mobility Radeon X1400 x86/SSE2 ATI Technologies Inc. ATI Mobility Radeon X1600 supported 2 ATI Radeon X16xx ATI Technologies Inc. ATI Mobility Radeon X1600 x86/SSE2 supported 2 ATI Radeon X16xx ATI Technologies Inc. ATI Mobility Radeon X1700 x86/SSE2 supported 2 ATI Radeon X17xx -ATI Technologies Inc. ATI Mobility Radeon X2300 supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2300 (Omega 3.8.442) supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2300 x86 supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2300 x86/MMX/3DNow!/SSE2 supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2300 x86/SSE2 supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2500 supported 0 ATI Technologies -ATI Technologies Inc. ATI Mobility Radeon X2500 x86/SSE2 supported 0 ATI Technologies +ATI Technologies Inc. ATI Mobility Radeon X2300 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2300 (Omega 3.8.442) supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2300 x86 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2300 x86/MMX/3DNow!/SSE2 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2300 x86/SSE2 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2500 supported 1 ATI Radeon X2xxx +ATI Technologies Inc. ATI Mobility Radeon X2500 x86/SSE2 supported 1 ATI Radeon X2xxx ATI Technologies Inc. ATI Mobility Radeon. HD 530v supported 1 ATI Mobility Radeon HD 530v ATI Technologies Inc. ATI Mobility Radeon. HD 5470 supported 3 ATI Mobility Radeon HD 5400 ATI Technologies Inc. ATI RADEON HD 3200 T25XX by CAMILO supported 1 ATI Radeon HD 3200 @@ -476,7 +476,7 @@ ATI Technologies Inc. ATI Radeon HD 6390 ATI Technologies Inc. ATI Radeon HD 6490M OpenGL Engine supported 3 ATI Radeon HD 6400 ATI Technologies Inc. ATI Radeon HD 6510 supported 3 ATI Radeon HD 6500 ATI Technologies Inc. ATI Radeon HD 6570M supported 3 ATI Radeon HD 6500 -ATI Technologies Inc. ATI Radeon HD 6630M OpenGL Engine supported 3 ATI Radeon HD 66xx +ATI Technologies Inc. ATI Radeon HD 6630M OpenGL Engine supported 3 ATI Radeon HD 6600 ATI Technologies Inc. ATI Radeon HD 6750 supported 3 ATI Radeon HD 6700 ATI Technologies Inc. ATI Radeon HD 6750M OpenGL Engine supported 3 ATI Radeon HD 6700 ATI Technologies Inc. ATI Radeon HD 6770 supported 3 ATI Radeon HD 6700 @@ -554,8 +554,8 @@ ATI Technologies Inc. MOBILITY RADEON Xpress 200 Series SW TCL x86/MMX/3DNow!/SS ATI Technologies Inc. MSI RX9550SE supported 1 ATI Radeon RX9550 ATI Technologies Inc. MSI Radeon X1550 Series supported 2 ATI Radeon X15xx ATI Technologies Inc. Mobility Radeon HD 6000 series supported 0 ATI Technologies -ATI Technologies Inc. Mobility Radeon X2300 HD supported 0 ATI Technologies -ATI Technologies Inc. Mobility Radeon X2300 HD x86/SSE2 supported 0 ATI Technologies +ATI Technologies Inc. Mobility Radeon X2300 HD supported 1 ATI Radeon X2xxx +ATI Technologies Inc. Mobility Radeon X2300 HD x86/SSE2 supported 1 ATI Radeon X2xxx ATI Technologies Inc. RADEON 7000 DDR x86/MMX/3DNow!/SSE supported 0 ATI Radeon 7xxx ATI Technologies Inc. RADEON 7000 DDR x86/SSE2 supported 0 ATI Radeon 7xxx ATI Technologies Inc. RADEON 7500 DDR x86/MMX/3DNow!/SSE2 supported 0 ATI Radeon 7xxx @@ -714,8 +714,8 @@ DRI R300 Project Mesa DRI R300 (RV515 714A) 20090101 x86/MMX/SSE2 TCL DRI R300 Project Mesa DRI R300 (RV515 714A) 20090101 x86/MMX/SSE2 TCL DRI2 supported 1 ATI RV515 DRI R300 Project Mesa DRI R300 (RV530 71C4) 20090101 x86/MMX/SSE2 TCL DRI2 supported 1 ATI RV530 GPU_CLASS_UNKNOWN NO MATCH -Humper 3D-Analyze v2.3 - http://www.tommti-systems.com NO MATCH -Humper Chromium NO MATCH +Humper 3D-Analyze v2.3 - http://www.tommti-systems.com supported 0 Humper +Humper Chromium supported 0 Humper Imagination Technologies PowerVR SGX545 NO MATCH Intel NO MATCH Intel HD Graphics Family supported 2 Intel HD Graphics @@ -829,8 +829,8 @@ NVIDIA 315 NVIDIA 315M supported 2 NVIDIA G 315 NVIDIA 320M supported 2 NVIDIA G 320M NVIDIA C51 supported 0 NVIDIA C51 -NVIDIA Corporation GeForce GT 230/PCI/SSE2 NO MATCH -NVIDIA Corporation GeForce GTX 285/PCI/SSE2 NO MATCH +NVIDIA Corporation GeForce GT 230/PCI/SSE2 supported 2 NVIDIA GT 230M +NVIDIA Corporation GeForce GTX 285/PCI/SSE2 supported 3 NVIDIA GTX 285 NVIDIA D10M2-20/PCI/SSE2 NO MATCH NVIDIA D10P1-25/PCI/SSE2 NO MATCH NVIDIA D10P1-25/PCI/SSE2/3DNOW! NO MATCH @@ -864,7 +864,7 @@ NVIDIA G73 NVIDIA G84 supported 2 NVIDIA G84 NVIDIA G86 supported 3 NVIDIA G86 NVIDIA G92 supported 3 NVIDIA G92 -NVIDIA G92-200/PCI/SSE2 supported 3 NVIDIA G92 +NVIDIA G92-200/PCI/SSE2 supported 0 NVIDIA G 200 NVIDIA G94 supported 3 NVIDIA G94 NVIDIA G96/PCI/SSE2 NO MATCH NVIDIA G98/PCI/SSE2 NO MATCH @@ -884,8 +884,8 @@ NVIDIA GT 240 NVIDIA GT 240M supported 2 NVIDIA GT 240M NVIDIA GT 250M supported 2 NVIDIA GT 250M NVIDIA GT 260M supported 2 NVIDIA GT 260M -NVIDIA GT 320 supported 2 NVIDIA GT 320M -NVIDIA GT 320M supported 2 NVIDIA GT 320M +NVIDIA GT 320 supported 2 NVIDIA G 320M +NVIDIA GT 320M supported 2 NVIDIA G 320M NVIDIA GT 330 supported 3 NVIDIA GT 330M NVIDIA GT 330M supported 3 NVIDIA GT 330M NVIDIA GT 340 supported 2 NVIDIA GT 340M @@ -897,7 +897,7 @@ NVIDIA GT 520 NVIDIA GT 540 supported 3 NVIDIA GT 540M NVIDIA GT 540M supported 3 NVIDIA GT 540M NVIDIA GT-120 supported 2 NVIDIA GT 120 -NVIDIA GT200/PCI/SSE2 NO MATCH +NVIDIA GT200/PCI/SSE2 supported 0 NVIDIA G 200 NVIDIA GTS 150 supported 2 NVIDIA GT 150M NVIDIA GTS 240 supported 3 NVIDIA GTS 240 NVIDIA GTS 250 supported 3 NVIDIA GTS 250 @@ -944,34 +944,34 @@ NVIDIA GeForce 4 MX NVIDIA GeForce 4 Ti supported 0 NVIDIA GeForce 4 NVIDIA GeForce 405/PCI/SSE2 supported 1 NVIDIA G 405 NVIDIA GeForce 410M/PCI/SSE2 supported 1 NVIDIA G 410M -NVIDIA GeForce 6100 supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100 nForce 400/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100 nForce 405/PCI/SSE2 supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100 nForce 405/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100 nForce 420/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100 nForce 430/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6100/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 +NVIDIA GeForce 6100 supported 0 NVIDIA G100 +NVIDIA GeForce 6100 nForce 400/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 6100 nForce 405/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 6100 nForce 405/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 6100 nForce 420/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 6100 nForce 430/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 6100/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 NVIDIA GeForce 6150 LE/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 NVIDIA GeForce 6150/PCI/SSE2 supported 0 NVIDIA GeForce 6100 NVIDIA GeForce 6150/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 NVIDIA GeForce 6150SE nForce 430/PCI/SSE2 supported 0 NVIDIA GeForce 6100 NVIDIA GeForce 6150SE nForce 430/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 NVIDIA GeForce 6150SE/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6100 -NVIDIA GeForce 6200 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 A-LE/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 A-LE/AGP/SSE2 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 A-LE/AGP/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 LE/PCI/SSE2 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 LE/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 TurboCache(TM)/PCI/SSE2 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200 TurboCache(TM)/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/AGP/SSE2 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/AGP/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/PCI/SSE/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/PCI/SSE2 supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 -NVIDIA GeForce 6200SE TurboCache(TM)/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 6200 +NVIDIA GeForce 6200 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 A-LE/AGP/SSE/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 A-LE/AGP/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 A-LE/AGP/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 LE/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 LE/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 TurboCache(TM)/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200 TurboCache(TM)/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/AGP/SSE/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/AGP/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/AGP/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/PCI/SSE/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 6200/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 6200SE TurboCache(TM)/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 NVIDIA GeForce 6500 supported 0 NVIDIA GeForce 6500 NVIDIA GeForce 6500/PCI/SSE2 supported 0 NVIDIA GeForce 6500 NVIDIA GeForce 6600 supported 1 NVIDIA GeForce 6600 @@ -1012,12 +1012,12 @@ NVIDIA GeForce 7050 PV / NVIDIA nForce 630a/PCI/SSE2/3DNOW! NVIDIA GeForce 7050 PV / nForce 630a/PCI/SSE2 supported 0 NVIDIA GeForce 7000 NVIDIA GeForce 7050 PV / nForce 630a/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 7000 NVIDIA GeForce 7050 SE / NVIDIA nForce 630a/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 7000 -NVIDIA GeForce 7100 supported 0 NVIDIA GeForce 7100 -NVIDIA GeForce 7100 / NVIDIA nForce 620i/PCI/SSE2 supported 0 NVIDIA GeForce 7100 -NVIDIA GeForce 7100 / NVIDIA nForce 630i/PCI/SSE2 supported 0 NVIDIA GeForce 7100 -NVIDIA GeForce 7100 / nForce 630i/PCI/SSE2 supported 0 NVIDIA GeForce 7100 -NVIDIA GeForce 7100 GS/PCI/SSE2 supported 0 NVIDIA GeForce 7100 -NVIDIA GeForce 7100 GS/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 7100 +NVIDIA GeForce 7100 supported 0 NVIDIA G100 +NVIDIA GeForce 7100 / NVIDIA nForce 620i/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 7100 / NVIDIA nForce 630i/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 7100 / nForce 630i/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 7100 GS/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 7100 GS/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 NVIDIA GeForce 7150M / nForce 630M/PCI/SSE2 supported 0 NVIDIA GeForce 7100 NVIDIA GeForce 7150M / nForce 630M/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 7100 NVIDIA GeForce 7300 supported 1 NVIDIA GeForce 7300 @@ -1029,8 +1029,8 @@ NVIDIA GeForce 7300 GT/PCI/SSE2 NVIDIA GeForce 7300 GT/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 7300 NVIDIA GeForce 7300 LE/PCI/SSE2 supported 1 NVIDIA GeForce 7300 NVIDIA GeForce 7300 LE/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 7300 -NVIDIA GeForce 7300 SE/7200 GS/PCI/SSE2 supported 1 NVIDIA GeForce 7300 -NVIDIA GeForce 7300 SE/7200 GS/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 7300 +NVIDIA GeForce 7300 SE/7200 GS/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 7300 SE/7200 GS/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 NVIDIA GeForce 7300 SE/PCI/SSE2 supported 1 NVIDIA GeForce 7300 NVIDIA GeForce 7300 SE/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 7300 NVIDIA GeForce 7350 LE/PCI/SSE2 supported 1 NVIDIA GeForce 7300 @@ -1063,14 +1063,14 @@ NVIDIA GeForce 7900 GT/PCI/SSE2/3DNOW! NVIDIA GeForce 7900 GTX/PCI/SSE2 supported 2 NVIDIA GeForce 7900 NVIDIA GeForce 7950 GT/PCI/SSE2 supported 2 NVIDIA GeForce 7900 NVIDIA GeForce 7950 GT/PCI/SSE2/3DNOW! supported 2 NVIDIA GeForce 7900 -NVIDIA GeForce 8100 supported 1 NVIDIA GeForce 8100 -NVIDIA GeForce 8100 / nForce 720a/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 8100 -NVIDIA GeForce 8200 supported 1 NVIDIA GeForce 8200 -NVIDIA GeForce 8200/PCI/SSE2 supported 1 NVIDIA GeForce 8200 -NVIDIA GeForce 8200/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 8200 -NVIDIA GeForce 8200M supported 1 NVIDIA GeForce 8200M -NVIDIA GeForce 8200M G/PCI/SSE2 supported 1 NVIDIA GeForce 8200M -NVIDIA GeForce 8200M G/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 8200M +NVIDIA GeForce 8100 supported 0 NVIDIA G100 +NVIDIA GeForce 8100 / nForce 720a/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 8200 supported 0 NVIDIA G 200 +NVIDIA GeForce 8200/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 8200/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 8200M supported 0 NVIDIA G 200 +NVIDIA GeForce 8200M G/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 8200M G/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 NVIDIA GeForce 8300 supported 1 NVIDIA GeForce 8300 NVIDIA GeForce 8300 GS/PCI/SSE2 supported 1 NVIDIA GeForce 8300 NVIDIA GeForce 8400 supported 1 NVIDIA GeForce 8400 @@ -1116,17 +1116,17 @@ NVIDIA GeForce 8800 GTX/PCI/SSE2 NVIDIA GeForce 8800 Ultra/PCI/SSE2 supported 3 NVIDIA GeForce 8800 NVIDIA GeForce 8800M GTS/PCI/SSE2 supported 3 NVIDIA GeForce 8800M NVIDIA GeForce 8800M GTX/PCI/SSE2 supported 3 NVIDIA GeForce 8800M -NVIDIA GeForce 9100 supported 0 NVIDIA GeForce 9100 -NVIDIA GeForce 9100/PCI/SSE2 supported 0 NVIDIA GeForce 9100 -NVIDIA GeForce 9100/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 9100 -NVIDIA GeForce 9100M supported 0 NVIDIA GeForce 9100M -NVIDIA GeForce 9100M G/PCI/SSE2 supported 0 NVIDIA GeForce 9100M -NVIDIA GeForce 9100M G/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce 9100M -NVIDIA GeForce 9200 supported 1 NVIDIA GeForce 9200 -NVIDIA GeForce 9200/PCI/SSE2 supported 1 NVIDIA GeForce 9200 -NVIDIA GeForce 9200/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce 9200 -NVIDIA GeForce 9200M GE/PCI/SSE2 supported 1 NVIDIA GeForce 9200M -NVIDIA GeForce 9200M GS/PCI/SSE2 supported 1 NVIDIA GeForce 9200M +NVIDIA GeForce 9100 supported 0 NVIDIA G100 +NVIDIA GeForce 9100/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce 9100/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce 9100M supported 0 NVIDIA G100M +NVIDIA GeForce 9100M G/PCI/SSE2 supported 0 NVIDIA G100M +NVIDIA GeForce 9100M G/PCI/SSE2/3DNOW! supported 0 NVIDIA G100M +NVIDIA GeForce 9200 supported 0 NVIDIA G 200 +NVIDIA GeForce 9200/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 9200/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce 9200M GE/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce 9200M GS/PCI/SSE2 supported 0 NVIDIA G 200 NVIDIA GeForce 9300 supported 1 NVIDIA GeForce 9300 NVIDIA GeForce 9300 / nForce 730i/PCI/SSE2 supported 1 NVIDIA GeForce 9300 NVIDIA GeForce 9300 GE/PCI/SSE2 supported 1 NVIDIA GeForce 9300 @@ -1179,16 +1179,16 @@ NVIDIA GeForce 9800M NVIDIA GeForce 9800M GS/PCI/SSE2 supported 3 NVIDIA GeForce 9800M NVIDIA GeForce 9800M GT/PCI/SSE2 supported 3 NVIDIA GeForce 9800M NVIDIA GeForce 9800M GTS/PCI/SSE2 supported 3 NVIDIA GeForce 9800M -NVIDIA GeForce FX 5100 supported 0 NVIDIA GeForce FX 5100 -NVIDIA GeForce FX 5100/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce FX 5100 -NVIDIA GeForce FX 5200 supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/AGP/SSE supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/AGP/SSE2 supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/AGP/SSE2/3DNOW! supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/PCI/SSE2 supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce FX 5200 -NVIDIA GeForce FX 5200LE/AGP/SSE2 supported 0 NVIDIA GeForce FX 5200 +NVIDIA GeForce FX 5100 supported 0 NVIDIA G100 +NVIDIA GeForce FX 5100/AGP/SSE/3DNOW! supported 0 NVIDIA G100 +NVIDIA GeForce FX 5200 supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/AGP/SSE supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/AGP/SSE/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/AGP/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/AGP/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 +NVIDIA GeForce FX 5200LE/AGP/SSE2 supported 0 NVIDIA G 200 NVIDIA GeForce FX 5500 supported 0 NVIDIA GeForce FX 5500 NVIDIA GeForce FX 5500/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce FX 5500 NVIDIA GeForce FX 5500/AGP/SSE2 supported 0 NVIDIA GeForce FX 5500 @@ -1207,10 +1207,10 @@ NVIDIA GeForce FX 5800 NVIDIA GeForce FX 5900 supported 1 NVIDIA GeForce FX 5900 NVIDIA GeForce FX 5900/AGP/SSE2 supported 1 NVIDIA GeForce FX 5900 NVIDIA GeForce FX 5900XT/AGP/SSE2 supported 1 NVIDIA GeForce FX 5900 -NVIDIA GeForce FX Go5100 supported 0 NVIDIA GeForce FX Go5100 -NVIDIA GeForce FX Go5100/AGP/SSE2 supported 0 NVIDIA GeForce FX Go5100 -NVIDIA GeForce FX Go5200 supported 0 NVIDIA GeForce FX Go5200 -NVIDIA GeForce FX Go5200/AGP/SSE2 supported 0 NVIDIA GeForce FX Go5200 +NVIDIA GeForce FX Go5100 supported 0 NVIDIA G100 +NVIDIA GeForce FX Go5100/AGP/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce FX Go5200 supported 0 NVIDIA G 200 +NVIDIA GeForce FX Go5200/AGP/SSE2 supported 0 NVIDIA G 200 NVIDIA GeForce FX Go5300 supported 0 NVIDIA GeForce FX Go5300 NVIDIA GeForce FX Go5600 supported 0 NVIDIA GeForce FX Go5600 NVIDIA GeForce FX Go5600/AGP/SSE2 supported 0 NVIDIA GeForce FX Go5600 @@ -1234,7 +1234,7 @@ NVIDIA GeForce G210M/PCI/SSE2 NVIDIA GeForce G310M/PCI/SSE2 supported 2 NVIDIA G 310M NVIDIA GeForce GT 120/PCI/SSE2 supported 2 NVIDIA GT 120M NVIDIA GeForce GT 120/PCI/SSE2/3DNOW! supported 2 NVIDIA GT 120M -NVIDIA GeForce GT 120M/PCI/SSE2 supported 2 NVIDIA GT 120M +NVIDIA GeForce GT 120M/PCI/SSE2 supported 1 NVIDIA G 120M NVIDIA GeForce GT 130M/PCI/SSE2 supported 2 NVIDIA GT 130M NVIDIA GeForce GT 140/PCI/SSE2 supported 2 NVIDIA GT 140M NVIDIA GeForce GT 220/PCI/SSE2 supported 2 NVIDIA GT 220M @@ -1246,8 +1246,8 @@ NVIDIA GeForce GT 240 NVIDIA GeForce GT 240/PCI/SSE2 supported 2 NVIDIA GT 240M NVIDIA GeForce GT 240/PCI/SSE2/3DNOW! supported 2 NVIDIA GT 240M NVIDIA GeForce GT 240M/PCI/SSE2 supported 2 NVIDIA GT 240M -NVIDIA GeForce GT 320/PCI/SSE2 supported 2 NVIDIA GT 320M -NVIDIA GeForce GT 320M/PCI/SSE2 supported 2 NVIDIA GT 320M +NVIDIA GeForce GT 320/PCI/SSE2 supported 2 NVIDIA G 320M +NVIDIA GeForce GT 320M/PCI/SSE2 supported 2 NVIDIA G 320M NVIDIA GeForce GT 325M/PCI/SSE2 supported 0 NVIDIA GT 325M NVIDIA GeForce GT 330/PCI/SSE2 supported 3 NVIDIA GT 330M NVIDIA GeForce GT 330/PCI/SSE2/3DNOW! supported 3 NVIDIA GT 330M @@ -1268,11 +1268,11 @@ NVIDIA GeForce GT 445M/PCI/SSE2 NVIDIA GeForce GT 520/PCI/SSE2 supported 3 NVIDIA GT 520M NVIDIA GeForce GT 520/PCI/SSE2/3DNOW! supported 3 NVIDIA GT 520M NVIDIA GeForce GT 520M/PCI/SSE2 supported 3 NVIDIA GT 520M -NVIDIA GeForce GT 525M/PCI/SSE2 supported 3 NVIDIA GT 525M -NVIDIA GeForce GT 530/PCI/SSE2 NO MATCH -NVIDIA GeForce GT 530/PCI/SSE2/3DNOW! NO MATCH +NVIDIA GeForce GT 525M/PCI/SSE2 supported 3 NVIDIA GT 520M +NVIDIA GeForce GT 530/PCI/SSE2 supported 3 NVIDIA GT 530M +NVIDIA GeForce GT 530/PCI/SSE2/3DNOW! supported 3 NVIDIA GT 530M NVIDIA GeForce GT 540M/PCI/SSE2 supported 3 NVIDIA GT 540M -NVIDIA GeForce GT 545/PCI/SSE2 NO MATCH +NVIDIA GeForce GT 545/PCI/SSE2 supported 3 NVIDIA GT 540M NVIDIA GeForce GT 550M/PCI/SSE2 supported 3 NVIDIA GT 550M NVIDIA GeForce GT 555M/PCI/SSE2 supported 3 NVIDIA GT 555M NVIDIA GeForce GTS 150/PCI/SSE2 supported 2 NVIDIA GT 150M @@ -1321,13 +1321,13 @@ NVIDIA GeForce GTX 580/PCI/SSE2/3DNOW! NVIDIA GeForce GTX 580M/PCI/SSE2 supported 3 NVIDIA GTX 580M NVIDIA GeForce GTX 590/PCI/SSE2 supported 3 NVIDIA GTX 590 NVIDIA GeForce Go 6 supported 1 NVIDIA GeForce Go 6 -NVIDIA GeForce Go 6100 supported 0 NVIDIA GeForce Go 6100 -NVIDIA GeForce Go 6100/PCI/SSE2 supported 0 NVIDIA GeForce Go 6100 -NVIDIA GeForce Go 6100/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce Go 6100 +NVIDIA GeForce Go 6100 supported 0 NVIDIA G100 +NVIDIA GeForce Go 6100/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA GeForce Go 6100/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 NVIDIA GeForce Go 6150/PCI/SSE2 supported 0 NVIDIA GeForce Go 6100 NVIDIA GeForce Go 6150/PCI/SSE2/3DNOW! supported 0 NVIDIA GeForce Go 6100 -NVIDIA GeForce Go 6200 supported 0 NVIDIA GeForce Go 6200 -NVIDIA GeForce Go 6200/PCI/SSE2 supported 0 NVIDIA GeForce Go 6200 +NVIDIA GeForce Go 6200 supported 0 NVIDIA G 200 +NVIDIA GeForce Go 6200/PCI/SSE2 supported 0 NVIDIA G 200 NVIDIA GeForce Go 6400 supported 1 NVIDIA GeForce Go 6400 NVIDIA GeForce Go 6400/PCI/SSE2 supported 1 NVIDIA GeForce Go 6400 NVIDIA GeForce Go 6600 supported 1 NVIDIA GeForce Go 6600 @@ -1335,9 +1335,9 @@ NVIDIA GeForce Go 6600/PCI/SSE2 NVIDIA GeForce Go 6800 supported 1 NVIDIA GeForce Go 6800 NVIDIA GeForce Go 6800 Ultra/PCI/SSE2 supported 1 NVIDIA GeForce Go 6800 NVIDIA GeForce Go 6800/PCI/SSE2 supported 1 NVIDIA GeForce Go 6800 -NVIDIA GeForce Go 7200 supported 1 NVIDIA GeForce Go 7200 -NVIDIA GeForce Go 7200/PCI/SSE2 supported 1 NVIDIA GeForce Go 7200 -NVIDIA GeForce Go 7200/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce Go 7200 +NVIDIA GeForce Go 7200 supported 0 NVIDIA G 200 +NVIDIA GeForce Go 7200/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA GeForce Go 7200/PCI/SSE2/3DNOW! supported 0 NVIDIA G 200 NVIDIA GeForce Go 7300 supported 1 NVIDIA GeForce Go 7300 NVIDIA GeForce Go 7300/PCI/SSE2 supported 1 NVIDIA GeForce Go 7300 NVIDIA GeForce Go 7300/PCI/SSE2/3DNOW! supported 1 NVIDIA GeForce Go 7300 @@ -1382,43 +1382,43 @@ NVIDIA GeForce4 MX 440/AGP/SSE2 NVIDIA GeForce4 MX 440/AGP/SSE2/3DNOW! supported 0 NVIDIA GeForce 4 NVIDIA GeForce4 MX 440SE with AGP8X/AGP/SSE2 supported 0 NVIDIA GeForce 4 NVIDIA GeForce4 MX Integrated GPU/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce 4 -NVIDIA GeForce4 Ti 4200 with AGP8X/AGP/SSE supported 0 NVIDIA GeForce 4 -NVIDIA GeForce4 Ti 4200/AGP/SSE/3DNOW! supported 0 NVIDIA GeForce 4 +NVIDIA GeForce4 Ti 4200 with AGP8X/AGP/SSE supported 0 NVIDIA G 200 +NVIDIA GeForce4 Ti 4200/AGP/SSE/3DNOW! supported 0 NVIDIA G 200 NVIDIA GeForce4 Ti 4400/AGP/SSE2 supported 0 NVIDIA GeForce 4 NVIDIA Generic NO MATCH -NVIDIA ION LE/PCI/SSE2 supported 2 NVIDIA ION -NVIDIA ION/PCI/SSE2 supported 2 NVIDIA ION -NVIDIA ION/PCI/SSE2/3DNOW! supported 2 NVIDIA ION -NVIDIA MCP61/PCI/SSE2 NO MATCH -NVIDIA MCP61/PCI/SSE2/3DNOW! NO MATCH -NVIDIA MCP73/PCI/SSE2 NO MATCH -NVIDIA MCP79MH/PCI/SSE2 NO MATCH -NVIDIA MCP79MX/PCI/SSE2 NO MATCH -NVIDIA MCP7A-O/PCI/SSE2 NO MATCH -NVIDIA MCP7A-S/PCI/SSE2 NO MATCH +NVIDIA ION LE/PCI/SSE2 NO MATCH +NVIDIA ION/PCI/SSE2 NO MATCH +NVIDIA ION/PCI/SSE2/3DNOW! NO MATCH +NVIDIA MCP61/PCI/SSE2 supported 1 NVIDIA MCP61 +NVIDIA MCP61/PCI/SSE2/3DNOW! supported 1 NVIDIA MCP61 +NVIDIA MCP73/PCI/SSE2 supported 1 NVIDIA MCP73 +NVIDIA MCP79MH/PCI/SSE2 supported 1 NVIDIA MCP79 +NVIDIA MCP79MX/PCI/SSE2 supported 1 NVIDIA MCP79 +NVIDIA MCP7A-O/PCI/SSE2 supported 1 NVIDIA MCP7A +NVIDIA MCP7A-S/PCI/SSE2 supported 1 NVIDIA MCP7A NVIDIA MCP89-EPT/PCI/SSE2 NO MATCH -NVIDIA N10M-GE1/PCI/SSE2 NO MATCH -NVIDIA N10P-GE1/PCI/SSE2 NO MATCH -NVIDIA N10P-GV2/PCI/SSE2 NO MATCH +NVIDIA N10M-GE1/PCI/SSE2 supported 1 NVIDIA N10 +NVIDIA N10P-GE1/PCI/SSE2 supported 1 NVIDIA N10 +NVIDIA N10P-GV2/PCI/SSE2 supported 1 NVIDIA N10 NVIDIA N11M-GE1/PCI/SSE2 NO MATCH NVIDIA N11M-GE2/PCI/SSE2 NO MATCH NVIDIA N12E-GS-A1/PCI/SSE2 NO MATCH NVIDIA N12P-GVR-B-A1/PCI/SSE2 NO MATCH NVIDIA N13M-GE1-B-A1/PCI/SSE2 NO MATCH NVIDIA N13P-GL-A1/PCI/SSE2 NO MATCH -NVIDIA NB9M-GE/PCI/SSE2 NO MATCH -NVIDIA NB9M-GE1/PCI/SSE2 NO MATCH -NVIDIA NB9M-GS/PCI/SSE2 NO MATCH -NVIDIA NB9M-NS/PCI/SSE2 NO MATCH -NVIDIA NB9P-GE1/PCI/SSE2 NO MATCH -NVIDIA NB9P-GS/PCI/SSE2 NO MATCH -NVIDIA NV17/AGP/3DNOW! NO MATCH -NVIDIA NV17/AGP/SSE2 NO MATCH +NVIDIA NB9M-GE/PCI/SSE2 supported 1 NVIDIA NB9M +NVIDIA NB9M-GE1/PCI/SSE2 supported 1 NVIDIA NB9M +NVIDIA NB9M-GS/PCI/SSE2 supported 1 NVIDIA NB9M +NVIDIA NB9M-NS/PCI/SSE2 supported 1 NVIDIA NB9M +NVIDIA NB9P-GE1/PCI/SSE2 supported 2 NVIDIA NB9P +NVIDIA NB9P-GS/PCI/SSE2 supported 2 NVIDIA NB9P +NVIDIA NV17/AGP/3DNOW! supported 0 NVIDIA NV17 +NVIDIA NV17/AGP/SSE2 supported 0 NVIDIA NV17 NVIDIA NV34 supported 0 NVIDIA NV34 NVIDIA NV35 supported 0 NVIDIA NV35 -NVIDIA NV36/AGP/SSE/3DNOW! NO MATCH -NVIDIA NV36/AGP/SSE2 NO MATCH -NVIDIA NV41/PCI/SSE2 NO MATCH +NVIDIA NV36/AGP/SSE/3DNOW! supported 1 NVIDIA NV36 +NVIDIA NV36/AGP/SSE2 supported 1 NVIDIA NV36 +NVIDIA NV41/PCI/SSE2 supported 1 NVIDIA NV41 NVIDIA NV43 supported 1 NVIDIA NV43 NVIDIA NV43/PCI/SSE2 supported 1 NVIDIA NV43 NVIDIA NV44 supported 1 NVIDIA NV44 @@ -1455,23 +1455,23 @@ NVIDIA NVIDIA GeForce GTX 465 OpenGL Engine NVIDIA NVIDIA GeForce GTX 470 OpenGL Engine supported 3 NVIDIA GTX 470 NVIDIA NVIDIA GeForce GTX 480 OpenGL Engine supported 3 NVIDIA GTX 480 NVIDIA NVIDIA GeForce Pre-Release GF108 ES OpenGL Engine NO MATCH -NVIDIA NVIDIA GeForce Pre-Release ION OpenGL Engine NO MATCH -NVIDIA NVIDIA GeForce Pre-Release MCP7A-J-DC OpenGL Engine NO MATCH +NVIDIA NVIDIA GeForce Pre-Release ION OpenGL Engine supported 2 NVIDIA ION +NVIDIA NVIDIA GeForce Pre-Release MCP7A-J-DC OpenGL Engine supported 1 NVIDIA MCP7A NVIDIA NVIDIA GeForce4 OpenGL Engine supported 0 NVIDIA GeForce 4 NVIDIA NVIDIA NV34MAP OpenGL Engine supported 0 NVIDIA NV34 NVIDIA NVIDIA Quadro 4000 OpenGL Engine supported 3 NVIDIA Quadro 4000 NVIDIA NVIDIA Quadro FX 4800 OpenGL Engine supported 3 NVIDIA Quadro FX 4800 -NVIDIA NVS 2100M/PCI/SSE2 supported 2 NVIDIA Quadro NVS 2100M +NVIDIA NVS 2100M/PCI/SSE2 supported 0 NVIDIA G100M NVIDIA NVS 300/PCI/SSE2 supported 0 NVIDIA Quadro NVS -NVIDIA NVS 3100M/PCI/SSE2 supported 2 NVIDIA Quadro NVS 3100M -NVIDIA NVS 4100/PCI/SSE2/3DNOW! supported 0 NVIDIA Quadro NVS -NVIDIA NVS 4200M/PCI/SSE2 supported 2 NVIDIA Quadro NVS 4200M -NVIDIA NVS 5100M/PCI/SSE2 supported 2 NVIDIA Quadro NVS 5100M +NVIDIA NVS 3100M/PCI/SSE2 supported 0 NVIDIA G100M +NVIDIA NVS 4100/PCI/SSE2/3DNOW! supported 0 NVIDIA G100 +NVIDIA NVS 4200M/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA NVS 5100M/PCI/SSE2 supported 0 NVIDIA G100M NVIDIA PCI NO MATCH -NVIDIA Quadro 1000M/PCI/SSE2 supported 2 NVIDIA Quadro 1000M -NVIDIA Quadro 2000/PCI/SSE2 supported 3 NVIDIA Quadro 2000 M/D -NVIDIA Quadro 2000M/PCI/SSE2 supported 3 NVIDIA Quadro 2000 M/D -NVIDIA Quadro 3000M/PCI/SSE2 NO MATCH +NVIDIA Quadro 1000M/PCI/SSE2 supported 0 NVIDIA G100 +NVIDIA Quadro 2000/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA Quadro 2000M/PCI/SSE2 supported 0 NVIDIA G 200 +NVIDIA Quadro 3000M/PCI/SSE2 supported 3 NVIDIA Quadro 3000M NVIDIA Quadro 4000 supported 3 NVIDIA Quadro 4000 NVIDIA Quadro 4000 OpenGL Engine supported 3 NVIDIA Quadro 4000 NVIDIA Quadro 4000/PCI/SSE2 supported 3 NVIDIA Quadro 4000 @@ -1483,10 +1483,10 @@ NVIDIA Quadro 600/PCI/SSE2 NVIDIA Quadro 600/PCI/SSE2/3DNOW! supported 2 NVIDIA Quadro 600 NVIDIA Quadro 6000 supported 3 NVIDIA Quadro 6000 NVIDIA Quadro 6000/PCI/SSE2 supported 3 NVIDIA Quadro 6000 -NVIDIA Quadro CX/PCI/SSE2 NO MATCH +NVIDIA Quadro CX/PCI/SSE2 supported 3 NVIDIA Quadro CX NVIDIA Quadro DCC supported 0 NVIDIA Quadro DCC NVIDIA Quadro FX supported 1 NVIDIA Quadro FX -NVIDIA Quadro FX 1100/AGP/SSE2 supported 1 NVIDIA Quadro FX +NVIDIA Quadro FX 1100/AGP/SSE2 supported 0 NVIDIA G100 NVIDIA Quadro FX 1400/PCI/SSE2 supported 2 NVIDIA Quadro 400 NVIDIA Quadro FX 1500 supported 1 NVIDIA Quadro FX NVIDIA Quadro FX 1500/PCI/SSE2 supported 1 NVIDIA Quadro FX @@ -1530,21 +1530,21 @@ NVIDIA Quadro FX 880M NVIDIA Quadro FX 880M/PCI/SSE2 supported 3 NVIDIA Quadro FX 880M NVIDIA Quadro FX Go700/AGP/SSE2 supported 1 NVIDIA Quadro FX NVIDIA Quadro NVS supported 0 NVIDIA Quadro NVS -NVIDIA Quadro NVS 110M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM +NVIDIA Quadro NVS 110M/PCI/SSE2 supported 0 NVIDIA G 110M NVIDIA Quadro NVS 130M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM NVIDIA Quadro NVS 135M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM NVIDIA Quadro NVS 140M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM NVIDIA Quadro NVS 150M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM NVIDIA Quadro NVS 160M/PCI/SSE2 supported 0 NVIDIA Quadro NVS 1xxM -NVIDIA Quadro NVS 210S/PCI/SSE2/3DNOW! supported 0 NVIDIA Quadro NVS +NVIDIA Quadro NVS 210S/PCI/SSE2/3DNOW! supported 1 NVIDIA G 210 NVIDIA Quadro NVS 285/PCI/SSE2 supported 0 NVIDIA Quadro NVS NVIDIA Quadro NVS 290/PCI/SSE2 supported 0 NVIDIA Quadro NVS NVIDIA Quadro NVS 295/PCI/SSE2 supported 0 NVIDIA Quadro NVS -NVIDIA Quadro NVS 320M/PCI/SSE2 supported 2 NVIDIA Quadro NVS 320M +NVIDIA Quadro NVS 320M/PCI/SSE2 supported 2 NVIDIA G 320M NVIDIA Quadro NVS 55/280 PCI/PCI/SSE2 supported 0 NVIDIA Quadro NVS NVIDIA Quadro NVS/PCI/SSE2 supported 0 NVIDIA Quadro NVS NVIDIA Quadro PCI-E Series/PCI/SSE2/3DNOW! NO MATCH -NVIDIA Quadro VX 200/PCI/SSE2 NO MATCH +NVIDIA Quadro VX 200/PCI/SSE2 supported 0 NVIDIA G 200 NVIDIA Quadro/AGP/SSE2 NO MATCH NVIDIA Quadro2 supported 0 NVIDIA Quadro2 NVIDIA Quadro4 supported 0 NVIDIA Quadro4 @@ -1552,7 +1552,7 @@ NVIDIA Quadro4 750 XGL/AGP/SSE2 NVIDIA RIVA TNT unsupported 0 NVIDIA RIVA TNT NVIDIA RIVA TNT2/AGP/SSE2 unsupported 0 NVIDIA RIVA TNT NVIDIA RIVA TNT2/PCI/3DNOW! unsupported 0 NVIDIA RIVA TNT -NVIDIA Tesla C2050/PCI/SSE2 NO MATCH +NVIDIA Tesla C2050/PCI/SSE2 supported 0 NVIDIA G 205M NVIDIA nForce unsupported 0 NVIDIA nForce NVIDIA nForce 730a/PCI/SSE2 unsupported 0 NVIDIA nForce NVIDIA nForce 730a/PCI/SSE2/3DNOW! unsupported 0 NVIDIA nForce -- cgit v1.2.3 From 63b357758ea83dce34d8bc3e2f8ee7246b5aced5 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 6 Oct 2011 14:38:02 -0700 Subject: EXP-1205 FIX -- Some characters in description of toybox dialog is cut off at the bottom --- indra/newview/skins/default/xui/en/floater_toybox.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 5c6fa5bc86..653788bd3c 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -18,6 +18,7 @@ Date: Thu, 6 Oct 2011 16:43:19 -0500 Subject: SH-2454 Fix for attachments casting shadows/showing up in water when "show me in mouselook" is disabled --- indra/newview/pipeline.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 83f9863224..d28bb1f64e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7612,11 +7612,11 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) { BOOL skip_avatar_update = FALSE; - if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) { skip_avatar_update = TRUE; } - + if (!skip_avatar_update) { gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); @@ -8301,7 +8301,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } BOOL skip_avatar_update = FALSE; - if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) { skip_avatar_update = TRUE; } -- cgit v1.2.3 From adeaf71e3314e44a33864dbe90d93040d4247c67 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 6 Oct 2011 15:19:15 -0700 Subject: EXP-1300 WIP Visual feedback for Drag and Drop removed hover highlighting of buttons when dragging over them also updated toolbar button art to match spec --- indra/llui/llbutton.cpp | 13 ++++--------- indra/llui/llbutton.h | 1 - indra/llui/lltoolbar.cpp | 2 +- indra/newview/skins/default/xui/en/widgets/toolbar.xml | 7 +++++++ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index c9ee62296f..68cb5164b6 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -515,15 +515,6 @@ BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) return TRUE; } - -void LLButton::onMouseEnter(S32 x, S32 y, MASK mask) -{ - LLUICtrl::onMouseEnter(x, y, mask); - - if (isInEnabledChain()) - mNeedsHighlight = TRUE; -} - void LLButton::onMouseLeave(S32 x, S32 y, MASK mask) { LLUICtrl::onMouseLeave(x, y, mask); @@ -538,6 +529,10 @@ void LLButton::setHighlight(bool b) BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) { + if (isInEnabledChain() + && (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() != this)) + mNeedsHighlight = TRUE; + if (!childrenHandleHover(x, y, mask)) { if (mMouseDownTimer.getStarted()) diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 14c1d01c7e..a0a7b4e372 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -160,7 +160,6 @@ public: virtual void draw(); /*virtual*/ BOOL postBuild(); - virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void onMouseCaptureLost(); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 7fc6a6de8d..63a1706fe4 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -577,7 +577,7 @@ void LLToolBar::draw() if (command && btn->mIsRunningSignal) { const bool button_command_running = (*btn->mIsRunningSignal)(btn, command->isRunningParameters()); - btn->setFlashing(button_command_running); + btn->setToggleState(button_command_running); } } } diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 1585166114..613dc66762 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -12,6 +12,10 @@ bg_opaque_image_overlay="MouseGray" background_opaque="true"/> Date: Thu, 6 Oct 2011 17:31:59 -0500 Subject: SH-2240 Fix for crash when rendering beacons and Debug GL enabled -- flush every 128 beacons to keep from hitting the end of the immediate mode wrapper buffer. --- indra/newview/llglsandbox.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 844d7ba41c..3f773effcb 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -789,6 +789,8 @@ void LLViewerObjectList::renderObjectBeacons() // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) BOOL flush = FALSE; + S32 flush_me = 128; + for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -818,6 +820,14 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); + + if (--flush_me <= 0) + { + flush_me = 128; + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINES); + } } gGL.end(); } @@ -830,6 +840,8 @@ void LLViewerObjectList::renderObjectBeacons() // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) BOOL flush = FALSE; + S32 flush_me = 128; + for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -858,6 +870,14 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); + + if (--flush_me <= 0) + { + flush_me = 128; + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINES); + } } gGL.end(); -- cgit v1.2.3 From c834bdd05a134d6b3442a31f351a94f21965d4e9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 17:54:06 -0500 Subject: SH-2240 Better fix for beacon rendering -- let LLRender take care of optimization around joining chunks of line segments together into one draw call --- indra/newview/llglsandbox.cpp | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 3f773effcb..ac87da2d71 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -788,9 +788,6 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - BOOL flush = FALSE; - S32 flush_me = 128; - for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -799,18 +796,14 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (flush) - { - gGL.end(); - } - flush = TRUE; gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; + + gGL.begin(LLRender::LINES); gGL.color4fv(color.mV); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f); @@ -820,16 +813,9 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); - - if (--flush_me <= 0) - { - flush_me = 128; - gGL.end(); - gGL.flush(); - gGL.begin(LLRender::LINES); - } + + gGL.end(); } - gGL.end(); } { @@ -839,9 +825,6 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - BOOL flush = FALSE; - S32 flush_me = 128; - for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -849,18 +832,13 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (flush) - { - gGL.end(); - } - flush = TRUE; gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; + gGL.begin(LLRender::LINES); gGL.color4fv(debug_beacon.mColor.mV); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f); @@ -871,16 +849,9 @@ void LLViewerObjectList::renderObjectBeacons() draw_line_cube(0.10f, thisline); - if (--flush_me <= 0) - { - flush_me = 128; - gGL.end(); - gGL.flush(); - gGL.begin(LLRender::LINES); - } + gGL.end(); } - gGL.end(); gGL.flush(); glLineWidth(1.f); -- cgit v1.2.3 From 4eecfd4faeb253ad34258ccbe8e4c206d9d2c478 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 6 Oct 2011 16:42:19 -0700 Subject: Updated FUI toolbar buttons and corresponding floaters including: * About land * Appearance * Gestures * Inventory * Map * Nearby voice * Snapshot --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/skins/default/xui/en/floater_about_land.xml | 2 +- indra/newview/skins/default/xui/en/floater_gesture.xml | 2 +- .../newview/skins/default/xui/en/floater_my_appearance.xml | 3 ++- .../newview/skins/default/xui/en/floater_my_inventory.xml | 2 +- indra/newview/skins/default/xui/en/floater_snapshot.xml | 4 ++-- .../skins/default/xui/en/floater_voice_controls.xml | 10 +++++----- indra/newview/skins/default/xui/en/floater_world_map.xml | 2 +- indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 14 +++++++------- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 1fff95417b..8ee4b7d075 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -96,9 +96,9 @@ label_ref="Command_Inventory_Label" tooltip_ref="Command_Inventory_Tooltip" execute_function="Floater.ToolbarToggle" - execute_parameters="inventory" + execute_parameters="my_inventory" is_running_function="Floater.IsOpen" - is_running_parameters="inventory" + is_running_parameters="my_inventory" /> diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml index 9f5e6828d2..c0424f4de3 100644 --- a/indra/newview/skins/default/xui/en/floater_gesture.xml +++ b/indra/newview/skins/default/xui/en/floater_gesture.xml @@ -5,7 +5,7 @@ height="465" name="gestures" help_topic="gestures" - title="GESTURES" + title="Gestures" background_visible="true" follows="all" label="Places" diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml index 8f97887b3f..de2aa49c0c 100644 --- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -6,9 +6,10 @@ height="588" layout="topleft" name="floater_my_appearance" + help_topic="appearance" save_rect="true" single_instance="true" - title="MY APPEARANCE" + title="Appearance" width="333"> diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml index f017a7ace6..447549db44 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -2,14 +2,14 @@ - NEARBY VOICE + Nearby voice - Group Call with [GROUP] + Group call with [GROUP] - Conference Call + Conference call diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 019e7cd032..3d997a17f7 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -12,7 +12,7 @@ save_rect="true" save_visibility="true" single_instance="true" - title="WORLD MAP" + title="World map" width="650"> - Received Items ([NUM]) - Received Items + Received items ([NUM]) + Received items + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 5475fcd245..3c69a0cb6c 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -64,14 +64,32 @@ user_resize="false" mouse_opaque="false" height="100" - width="100"> + width="200"> + width="200"/> + + + + width="200"/> Date: Mon, 10 Oct 2011 12:16:12 -0700 Subject: sync with viewer-development --- .../newview/skins/default/xui/en/floater_stats.xml | 339 ++++++++++++++------- 1 file changed, 237 insertions(+), 102 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index b87cb9a433..406114294d 100644 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -10,7 +10,7 @@ save_rect="true" save_visibility="true" title="STATISTICS" - width="250"> + width="260"> - + width="260"> + + @@ -52,9 +53,10 @@ unit_label="kbps" stat="kbitstat" bar_min="0" - bar_max="900" - tick_spacing="100" - label_spacing="300" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" show_bar="true" show_history="false"> @@ -65,9 +67,9 @@ stat="packetslostpercentstat" bar_min="0" bar_max="5" - tick_spacing="1" + tick_spacing="0.5" label_spacing="1" - precision="1" + precision="3" show_per_sec="false" show_bar="false" show_mean="true"> @@ -78,15 +80,17 @@ unit_label="msec" stat="simpingstat" bar_min="0" - bar_max="1000" - tick_spacing="100" - label_spacing="200" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" show_bar="false" show_per_sec="false" show_mean="false"> - + - + bar_max="10000" + tick_spacing="1000" + label_spacing="2000" + precision="0" + show_per_sec="false" + show_bar="false"> + - + bar_max="200000" + tick_spacing="25000" + label_spacing="50000" + precision="0" + show_bar="false"> + @@ -138,13 +144,14 @@ unit_label="/sec" stat="numnewobjectsstat" bar_min="0" - bar_max="1000" - tick_spacing="100" - label_spacing="500" + bar_max="2000" + tick_spacing="200" + label_spacing="400" show_per_sec="true" show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + @@ -239,7 +255,12 @@ name="packetsoutstat" label="Packets Out" stat="packetsoutstat" - unit_label="/sec" + unit_label="/sec" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -247,7 +268,12 @@ name="objectkbitstat" label="Objects" stat="objectkbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -255,7 +281,12 @@ name="texturekbitstat" label="Texture" stat="texturekbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -263,7 +294,12 @@ name="assetkbitstat" label="Asset" stat="assetkbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -271,7 +307,12 @@ name="layerskbitstat" label="Layers" stat="layerskbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -279,12 +320,13 @@ name="actualinkbitstat" label="Actual In" stat="actualinkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - show_bar="true" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" show_history="false" > @@ -292,26 +334,27 @@ name="actualoutkbitstat" label="Actual Out" stat="actualoutkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="512.f" - tick_spacing="128.f" - label_spacing="256.f" - show_bar="true" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" show_history="false"> - + @@ -335,10 +378,11 @@ name="simfps" label="Sim FPS" stat="simfps" + precision="1" bar_min="0.f" - bar_max="200.f" - tick_spacing="20.f" - label_spacing="100.f" + bar_max="45.f" + tick_spacing="7.5f" + label_spacing="15.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -350,9 +394,9 @@ stat="simphysicsfps" precision="1" bar_min="0.f" - bar_max="66.f" - tick_spacing="33.f" - label_spacing="33.f" + bar_max="45.f" + tick_spacing="7.5.f" + label_spacing="15.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -369,8 +413,8 @@ precision="0" bar_min="0.f" bar_max="500.f" - tick_spacing="10.f" - label_spacing="40.f" + tick_spacing="50.f" + label_spacing="100.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -383,8 +427,8 @@ precision="0" bar_min="0.f" bar_max="500.f" - tick_spacing="10.f" - label_spacing="40.f" + tick_spacing="50.f" + label_spacing="100.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -395,7 +439,7 @@ label="Memory Allocated" stat="physicsmemoryallocated" unit_label="MB" - precision="0" + precision="1" bar_min="0.f" bar_max="1024.f" tick_spacing="128.f" @@ -468,9 +512,9 @@ stat="simactiveobjects" precision="0" bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -482,9 +526,9 @@ stat="simactivescripts" precision="0" bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" + bar_max="15000.f" + tick_spacing="1875.f" + label_spacing="3750.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -497,9 +541,9 @@ unit_label="eps" precision="0" bar_min="0.f" - bar_max="20000.f" - tick_spacing="2500.f" - label_spacing="5000.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -568,7 +612,7 @@ label="Total Unacked Bytes" stat="simtotalunackedbytes" unit_label="kb" - precision="0" + precision="1" bar_min="0.f" bar_max="100000.f" tick_spacing="25000.f" @@ -587,7 +631,7 @@ label="Total Frame Time" stat="simframemsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -602,7 +646,7 @@ label="Net Time" stat="simnetmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -617,7 +661,7 @@ label="Physics Time" stat="simsimphysicsmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -632,7 +676,7 @@ label="Simulation Time" stat="simsimothermsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -647,7 +691,7 @@ label="Agent Time" stat="simagentmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -662,7 +706,7 @@ label="Images Time" stat="simimagesmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -677,7 +721,7 @@ label="Script Time" stat="simscriptmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -686,6 +730,97 @@ show_bar="false" show_mean="false" > + + + + + + + + + + + + + + + + -- cgit v1.2.3 From e61569d71422931e0d1f8d7e2f6e4db13d8b03ba Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 14:08:14 -0700 Subject: added compound LLSD parsing to param blocks reviewed by Leslie --- indra/llui/llnotifications.cpp | 72 ++++------ indra/llui/llsdparam.cpp | 255 ++++++++++++++++++----------------- indra/llui/llsdparam.h | 66 ++++----- indra/llui/tests/llurlentry_stub.cpp | 2 +- indra/llui/tests/llurlentry_test.cpp | 1 - indra/llui/tests/llurlmatch_test.cpp | 4 +- indra/llxuixml/llinitparam.cpp | 52 ++++--- indra/llxuixml/llinitparam.h | 155 ++++++++++++--------- indra/llxuixml/llxuiparser.cpp | 50 ++++--- indra/llxuixml/llxuiparser.h | 36 +++-- indra/newview/llappviewer.cpp | 47 +++---- 11 files changed, 376 insertions(+), 364 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ffe5908a9d..8f7025a9a6 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -46,6 +46,7 @@ #include #include +#include const std::string NOTIFICATION_PERSIST_VERSION = "0.93"; @@ -416,23 +417,17 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound)); } - for(LLInitParam::ParamIterator::const_iterator it = p.unique.contexts.begin(), - end_it = p.unique.contexts.end(); - it != end_it; - ++it) + BOOST_FOREACH(const LLNotificationTemplate::UniquenessContext& context, p.unique.contexts) { - mUniqueContext.push_back(it->value); + mUniqueContext.push_back(context.value); } lldebugs << "notification \"" << mName << "\": tag count is " << p.tags.size() << llendl; - for(LLInitParam::ParamIterator::const_iterator it = p.tags.begin(), - end_it = p.tags.end(); - it != end_it; - ++it) + BOOST_FOREACH(const LLNotificationTemplate::Tag& tag, p.tags) { - lldebugs << " tag \"" << std::string(it->value) << "\"" << llendl; - mTags.push_back(it->value); + lldebugs << " tag \"" << std::string(tag.value) << "\"" << llendl; + mTags.push_back(tag.value); } mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form)); @@ -1397,14 +1392,12 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter { form.ignore.text = replace; } - for (LLInitParam::ParamIterator::iterator it = form.form_elements.elements.begin(), - end_it = form.form_elements.elements.end(); - it != end_it; - ++it) + + BOOST_FOREACH(LLNotificationForm::FormElement& element, form.form_elements.elements) { - if (it->button.isChosen() && it->button.text() == pattern) + if (element.button.isChosen() && element.button.text() == pattern) { - it->button.text = replace; + element.button.text = replace; } } } @@ -1453,48 +1446,42 @@ bool LLNotifications::loadTemplates() mTemplates.clear(); - for(LLInitParam::ParamIterator::const_iterator it = params.strings.begin(), end_it = params.strings.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::GlobalString& string, params.strings) { - mGlobalStrings[it->name] = it->value; + mGlobalStrings[string.name] = string.value; } std::map form_templates; - for(LLInitParam::ParamIterator::const_iterator it = params.templates.begin(), end_it = params.templates.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::Template& notification_template, params.templates) { - form_templates[it->name] = it->form; + form_templates[notification_template.name] = notification_template.form; } - for(LLInitParam::ParamIterator::iterator it = params.notifications.begin(), end_it = params.notifications.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::Params& notification, params.notifications) { - if (it->form_ref.form_template.isChosen()) + if (notification.form_ref.form_template.isChosen()) { // replace form contents from template - it->form_ref.form = form_templates[it->form_ref.form_template.name]; - if(it->form_ref.form_template.yes_text.isProvided()) + notification.form_ref.form = form_templates[notification.form_ref.form_template.name]; + if(notification.form_ref.form_template.yes_text.isProvided()) { - replaceFormText(it->form_ref.form, "$yestext", it->form_ref.form_template.yes_text); + replaceFormText(notification.form_ref.form, "$yestext", notification.form_ref.form_template.yes_text); } - if(it->form_ref.form_template.no_text.isProvided()) + if(notification.form_ref.form_template.no_text.isProvided()) { - replaceFormText(it->form_ref.form, "$notext", it->form_ref.form_template.no_text); + replaceFormText(notification.form_ref.form, "$notext", notification.form_ref.form_template.no_text); } - if(it->form_ref.form_template.cancel_text.isProvided()) + if(notification.form_ref.form_template.cancel_text.isProvided()) { - replaceFormText(it->form_ref.form, "$canceltext", it->form_ref.form_template.cancel_text); + replaceFormText(notification.form_ref.form, "$canceltext", notification.form_ref.form_template.cancel_text); } - if(it->form_ref.form_template.ignore_text.isProvided()) + if(notification.form_ref.form_template.ignore_text.isProvided()) { - replaceFormText(it->form_ref.form, "$ignoretext", it->form_ref.form_template.ignore_text); + replaceFormText(notification.form_ref.form, "$ignoretext", notification.form_ref.form_template.ignore_text); } } - mTemplates[it->name] = LLNotificationTemplatePtr(new LLNotificationTemplate(*it)); + mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification)); } return true; @@ -1517,12 +1504,9 @@ bool LLNotifications::loadVisibilityRules() mVisibilityRules.clear(); - for(LLInitParam::ParamIterator::iterator it = params.rules.begin(), - end_it = params.rules.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationVisibilityRule::Rule& rule, params.rules) { - mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(*it))); + mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(rule))); } return true; diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 4b69360e33..83bed3e745 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -34,6 +34,7 @@ static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; +static const LLSD NO_VALUE_MARKER; // // LLParamSDParser @@ -60,29 +61,32 @@ LLParamSDParser::LLParamSDParser() } // special case handling of U32 due to ambiguous LLSD::assign overload -bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + sd_to_write.assign((S32)*((const U32*)val_ptr)); - sd_to_write->assign((S32)*((const U32*)val_ptr)); return true; } -bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); return true; } +void LLParamSDParser::submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack) +{ + mCurReadSD = &sd; + block.submitValue(name_stack, *this); +} void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) { @@ -90,7 +94,8 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool mNameStack.clear(); setParseSilently(silent); - readSDValues(sd, block); + LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); + //readSDValues(sd, block); } void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) @@ -100,43 +105,6 @@ void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) block.serializeBlock(*this); } -const LLSD NO_VALUE_MARKER; - -void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block) -{ - if (sd.isMap()) - { - for (LLSD::map_const_iterator it = sd.beginMap(); - it != sd.endMap(); - ++it) - { - mNameStack.push_back(make_pair(it->first, newParseGeneration())); - readSDValues(it->second, block); - mNameStack.pop_back(); - } - } - else if (sd.isArray()) - { - for (LLSD::array_const_iterator it = sd.beginArray(); - it != sd.endArray(); - ++it) - { - mNameStack.back().second = newParseGeneration(); - readSDValues(*it, block); - } - } - else if (sd.isUndefined()) - { - mCurReadSD = &NO_VALUE_MARKER; - block.submitValue(mNameStack, *this); - } - else - { - mCurReadSD = &sd; - block.submitValue(mNameStack, *this); - } -} - /*virtual*/ std::string LLParamSDParser::getCurrentElementName() { std::string full_name = "sd"; @@ -150,81 +118,6 @@ void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block return full_name; } -LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) -{ - //TODO: implement nested LLSD writing - LLSD* sd_to_write = mWriteRootSD; - bool new_traversal = false; - for (name_stack_t::const_iterator it = name_stack.begin(), prev_it = mNameStack.begin(); - it != name_stack.end(); - ++it) - { - bool new_array_entry = false; - if (prev_it == mNameStack.end()) - { - new_traversal = true; - } - else - { - if (!new_traversal // have not diverged yet from previous trace - && prev_it->first == it->first // names match - && prev_it->second != it->second) // versions differ - { - // name stacks match, but version numbers differ in last place. - // create a different entry at this point using an LLSD array - new_array_entry = true; - } - if (prev_it->first != it->first // names differ - || prev_it->second != it->second) // versions differ - { - // at this point we have diverged from our last trace - // so any elements referenced here are new - new_traversal = true; - } - } - - LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; - - if (child_sd->isArray()) - { - if (new_traversal) - { - // write to new element at end - sd_to_write = &(*child_sd)[child_sd->size()]; - } - else - { - // write to last of existing elements, or first element if empty - sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; - } - } - else - { - if (new_array_entry && !child_sd->isArray()) - { - // copy child contents into first element of an array - LLSD new_array = LLSD::emptyArray(); - new_array.append(*child_sd); - // assign array to slot that previously held the single value - *child_sd = new_array; - // return next element in that array - sd_to_write = &((*child_sd)[1]); - } - else - { - sd_to_write = child_sd; - } - } - if (prev_it != mNameStack.end()) - { - ++prev_it; - } - } - mNameStack = name_stack; - - //llinfos << ll_pretty_print_sd(*mWriteRootSD) << llendl; - return sd_to_write; -} bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) { @@ -312,3 +205,125 @@ bool LLParamSDParser::readSD(Parser& parser, void* val_ptr) *((LLSD*)val_ptr) = *self.mCurReadSD; return true; } + +// static +LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range) +{ + LLSD* sd_to_write = &input; + + for (LLInitParam::Parser::name_stack_t::iterator it = name_stack_range.first; + it != name_stack_range.second; + ++it) + { + bool new_traversal = it->second; + + LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; + + if (child_sd->isArray()) + { + if (new_traversal) + { + // write to new element at end + sd_to_write = &(*child_sd)[child_sd->size()]; + } + else + { + // write to last of existing elements, or first element if empty + sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; + } + } + else + { + if (new_traversal + && child_sd->isDefined() + && !child_sd->isArray()) + { + // copy child contents into first element of an array + LLSD new_array = LLSD::emptyArray(); + new_array.append(*child_sd); + // assign array to slot that previously held the single value + *child_sd = new_array; + // return next element in that array + sd_to_write = &((*child_sd)[1]); + } + else + { + sd_to_write = child_sd; + } + } + it->second = false; + } + + return *sd_to_write; +} + +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack) +{ + if (sd.isMap()) + { + for (LLSD::map_const_iterator it = sd.beginMap(); + it != sd.endMap(); + ++it) + { + stack.push_back(make_pair(it->first, true)); + readSDValues(cb, it->second, stack); + stack.pop_back(); + } + } + else if (sd.isArray()) + { + for (LLSD::array_const_iterator it = sd.beginArray(); + it != sd.endArray(); + ++it) + { + stack.back().second = true; + readSDValues(cb, *it, stack); + } + } + else if (sd.isUndefined()) + { + if (!cb.empty()) + { + cb(NO_VALUE_MARKER, stack); + } + } + else + { + if (!cb.empty()) + { + cb(sd, stack); + } + } +} + +namespace LLInitParam +{ + // LLSD specialization + // block param interface + bool ParamValue, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name) + { + LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack); + + LLSD::String string; + + if (p.readValue(string)) + { + sd = string; + return true; + } + return false; + } + + //static + void ParamValue, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack) + { + p.writeValue(sd.asString(), name_stack); + } + + void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t name_stack, const BaseBlock* diff_block) const + { + // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue); + } +} diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index a371c28f68..265993ffb5 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -29,6 +29,15 @@ #define LL_LLSDPARAM_H #include "llinitparam.h" +#include "boost/function.hpp" + +struct LLParamSDParserUtilities +{ + static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); + + typedef boost::function read_sd_cb_t; + static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack = LLInitParam::Parser::name_stack_t()); +}; class LLParamSDParser : public LLInitParam::Parser @@ -45,25 +54,22 @@ public: /*virtual*/ std::string getCurrentElementName(); private: - void readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block); + void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); template - static bool writeTypedValue(Parser& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) + static bool writeTypedValue(Parser& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); - sd_to_write->assign(*((const T*)val_ptr)); + sd_to_write.assign(*((const T*)val_ptr)); return true; } - LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack); - - static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool writeFlag(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); + static bool writeU32Param(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); + static bool writeFlag(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); static bool readFlag(Parser& parser, void* val_ptr); static bool readS32(Parser& parser, void* val_ptr); @@ -85,29 +91,29 @@ private: template class LLSDParamAdapter : public T +{ +public: + LLSDParamAdapter() {} + LLSDParamAdapter(const LLSD& sd) { - public: - LLSDParamAdapter() {} - LLSDParamAdapter(const LLSD& sd) - { - LLParamSDParser parser; - parser.readSD(sd, *this); - } - - operator LLSD() const - { - LLParamSDParser parser; - LLSD sd; - parser.writeSD(sd, *this); - return sd; - } + LLParamSDParser parser; + parser.readSD(sd, *this); + } + + operator LLSD() const + { + LLParamSDParser parser; + LLSD sd; + parser.writeSD(sd, *this); + return sd; + } - LLSDParamAdapter(const T& val) - : T(val) - { - T::operator=(val); - } - }; + LLSDParamAdapter(const T& val) + : T(val) + { + T::operator=(val); + } +}; #endif // LL_LLSDPARAM_H diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index d522123260..c8303bfc89 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -124,7 +124,7 @@ namespace LLInitParam { descriptor.mCurrentBlockPtr = this; } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation){ return true; } + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t name_stack, const LLInitParam::BaseBlock* diff_block) const {} bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_value, S32 max_value) const { return true; } bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 2f814f4200..c1fb050206 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -72,7 +72,6 @@ S32 LLUIImage::getHeight() const namespace LLInitParam { - S32 Parser::sNextParseGeneration = 0; BlockDescriptor::BlockDescriptor() {} ParamDescriptor::ParamDescriptor(param_handle_t p, merge_func_t merge_func, diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index fb6a2eabf1..9dbccf125a 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -66,8 +66,6 @@ namespace LLInitParam BaseBlock::BaseBlock() {} BaseBlock::~BaseBlock() {} - S32 Parser::sNextParseGeneration = 0; - BlockDescriptor::BlockDescriptor() {} ParamDescriptor::ParamDescriptor(param_handle_t p, merge_func_t merge_func, @@ -98,7 +96,7 @@ namespace LLInitParam mEnclosingBlockOffset = 0x7FFFffff & ((U32)(my_addr - block_addr)); } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation){ return true; } + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t name_stack, const LLInitParam::BaseBlock* diff_block) const {} bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const { return true; } bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 99016205c8..2520502cf1 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -62,7 +62,6 @@ namespace LLInitParam mInspectFunc(inspect_func), mMinCount(min_count), mMaxCount(max_count), - mGeneration(0), mUserData(NULL) {} @@ -75,7 +74,6 @@ namespace LLInitParam mInspectFunc(NULL), mMinCount(0), mMaxCount(0), - mGeneration(0), mUserData(NULL) {} @@ -87,8 +85,6 @@ namespace LLInitParam // // Parser // - S32 Parser::sNextParseGeneration = 0; - Parser::~Parser() {} @@ -162,9 +158,9 @@ namespace LLInitParam return (param_address - baseblock_address); } - bool BaseBlock::submitValue(const Parser::name_stack_t& name_stack, Parser& p, bool silent) + bool BaseBlock::submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent) { - if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), -1)) + if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), true)) { if (!silent) { @@ -213,8 +209,7 @@ namespace LLInitParam // each param descriptor remembers its serial number // so we can inspect the same param under different names // and see that it has the same number - (*it)->mGeneration = parser.newParseGeneration(); - name_stack.push_back(std::make_pair("", (*it)->mGeneration)); + name_stack.push_back(std::make_pair("", true)); serialize_func(*param, parser, name_stack, diff_param); name_stack.pop_back(); } @@ -250,12 +245,7 @@ namespace LLInitParam continue; } - if (!duplicate) - { - it->second->mGeneration = parser.newParseGeneration(); - } - - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); + name_stack.push_back(std::make_pair(it->first, !duplicate)); const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; serialize_func(*param, parser, name_stack, diff_param); name_stack.pop_back(); @@ -278,8 +268,7 @@ namespace LLInitParam ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc; if (inspect_func) { - (*it)->mGeneration = parser.newParseGeneration(); - name_stack.push_back(std::make_pair("", (*it)->mGeneration)); + name_stack.push_back(std::make_pair("", true)); inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount); name_stack.pop_back(); } @@ -307,11 +296,7 @@ namespace LLInitParam } } - if (!duplicate) - { - it->second->mGeneration = parser.newParseGeneration(); - } - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); + name_stack.push_back(std::make_pair(it->first, !duplicate)); inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount); name_stack.pop_back(); } @@ -320,16 +305,18 @@ namespace LLInitParam return true; } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 parent_generation) + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool ignored) { BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - bool names_left = name_stack.first != name_stack.second; + bool names_left = name_stack_range.first != name_stack_range.second; - S32 parse_generation = name_stack.first == name_stack.second ? -1 : name_stack.first->second; + bool new_name = names_left + ? name_stack_range.first->second + : true; if (names_left) { - const std::string& top_name = name_stack.first->first; + const std::string& top_name = name_stack_range.first->first; ParamDescriptor::deserialize_func_t deserialize_func = NULL; Param* paramp = NULL; @@ -341,9 +328,18 @@ namespace LLInitParam paramp = getParamFromHandle(found_it->second->mParamHandle); deserialize_func = found_it->second->mDeserializeFunc; - Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); + Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second); ++new_name_stack.first; - return deserialize_func(*paramp, p, new_name_stack, parse_generation); + if (deserialize_func(*paramp, p, new_name_stack, new_name)) + { + // value is no longer new, we know about it now + name_stack_range.first->second = false; + return true; + } + else + { + return false; + } } } @@ -355,7 +351,7 @@ namespace LLInitParam Param* paramp = getParamFromHandle((*it)->mParamHandle); ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc; - if (deserialize_func && deserialize_func(*paramp, p, name_stack, parse_generation)) + if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name)) { return true; } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 1a131d15a3..9245f588d9 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -214,13 +214,13 @@ namespace LLInitParam } }; - typedef std::vector > name_stack_t; - typedef std::pair name_stack_range_t; - typedef std::vector possible_values_t; + typedef std::vector > name_stack_t; + typedef std::pair name_stack_range_t; + typedef std::vector possible_values_t; typedef bool (*parser_read_func_t)(Parser& parser, void* output); - typedef bool (*parser_write_func_t)(Parser& parser, const void*, const name_stack_t&); - typedef boost::function parser_inspect_func_t; + typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); + typedef boost::function parser_inspect_func_t; typedef std::map parser_read_func_map_t; typedef std::map parser_write_func_map_t; @@ -228,7 +228,6 @@ namespace LLInitParam Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), - mParseGeneration(sNextParseGeneration), mParserReadFuncs(&read_map), mParserWriteFuncs(&write_map), mParserInspectFuncs(&inspect_map) @@ -245,7 +244,7 @@ namespace LLInitParam return false; } - template bool writeValue(const T& param, const name_stack_t& name_stack) + template bool writeValue(const T& param, name_stack_t& name_stack) { parser_write_func_map_t::iterator found_it = mParserWriteFuncs->find(&typeid(T)); if (found_it != mParserWriteFuncs->end()) @@ -256,7 +255,7 @@ namespace LLInitParam } // dispatch inspection to registered inspection functions, for each parameter in a param block - template bool inspectValue(const name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values) + template bool inspectValue(name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values) { parser_inspect_func_map_t::iterator found_it = mParserInspectFuncs->find(&typeid(T)); if (found_it != mParserInspectFuncs->end()) @@ -272,10 +271,6 @@ namespace LLInitParam virtual void parserError(const std::string& message); void setParseSilently(bool silent) { mParseSilently = silent; } - S32 getParseGeneration() { return mParseGeneration; } - S32 newParseGeneration() { return mParseGeneration = ++sNextParseGeneration; } - - protected: template void registerParserFuncs(parser_read_func_t read_func, parser_write_func_t write_func = NULL) @@ -296,9 +291,6 @@ namespace LLInitParam parser_read_func_map_t* mParserReadFuncs; parser_write_func_map_t* mParserWriteFuncs; parser_inspect_func_map_t* mParserInspectFuncs; - S32 mParseGeneration; - - static S32 sNextParseGeneration; }; class BaseBlock; @@ -341,7 +333,7 @@ namespace LLInitParam }; typedef bool(*merge_func_t)(Param&, const Param&, bool); - typedef bool(*deserialize_func_t)(Param&, Parser&, const Parser::name_stack_range_t&, S32); + typedef bool(*deserialize_func_t)(Param&, Parser&, const Parser::name_stack_range_t&, bool); typedef void(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const Param* diff_param); typedef void(*inspect_func_t)(const Param&, Parser&, Parser::name_stack_t&, S32 min_count, S32 max_count); typedef bool(*validation_func_t)(const Param*); @@ -366,7 +358,6 @@ namespace LLInitParam validation_func_t mValidationFunc; S32 mMinCount; S32 mMaxCount; - S32 mGeneration; S32 mNumRefs; UserData* mUserData; }; @@ -447,7 +438,7 @@ namespace LLInitParam BaseBlock(); virtual ~BaseBlock(); - bool submitValue(const Parser::name_stack_t& name_stack, Parser& p, bool silent=false); + bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false); param_handle_t getHandleFromParam(const Param* param) const; bool validateBlock(bool emit_errors = true) const; @@ -473,7 +464,7 @@ namespace LLInitParam S32 getLastChangeVersion() const { return mChangeVersion; } - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation); + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); void serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; @@ -593,8 +584,7 @@ namespace LLInitParam mKeyVersion(0), mValidatedVersion(-1), mValidated(false) - { - } + {} void setValue(value_assignment_t val) { @@ -672,11 +662,11 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); // no further names in stack, attempt to parse value now - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { if (parser.readValue(typed_param.getValue())) { @@ -715,7 +705,7 @@ namespace LLInitParam if (!name_stack.empty()) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; } std::string key = typed_param.getValueName(); @@ -811,11 +801,11 @@ namespace LLInitParam } } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); // attempt to parse block... - if(typed_param.deserializeBlock(parser, name_stack, generation)) + if(typed_param.deserializeBlock(parser, name_stack_range, new_name)) { typed_param.clearValueName(); typed_param.enclosingBlock().paramChanged(param, true); @@ -851,7 +841,7 @@ namespace LLInitParam if (!name_stack.empty()) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; } std::string key = typed_param.getValueName(); @@ -943,7 +933,7 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef typename std::vector container_t; + typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef VALUE_TYPE value_t; @@ -970,12 +960,12 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, bool new_name) { self_t& typed_param = static_cast(param); value_t value; // no further names in stack, attempt to parse value now - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { // attempt to read value directly if (parser.readValue(value)) @@ -1015,7 +1005,7 @@ namespace LLInitParam ++it) { std::string key = it->getValue(); - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; if(key.empty()) // not parsed via name values, write out value directly @@ -1132,8 +1122,7 @@ namespace LLInitParam typedef NAME_VALUE_LOOKUP name_value_lookup_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr), - mLastParseGeneration(0) + : Param(block_descriptor.mCurrentBlockPtr) { std::copy(value.begin(), value.end(), back_inserter(mValues)); @@ -1153,13 +1142,12 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); bool new_value = false; - if (generation != typed_param.mLastParseGeneration - || typed_param.mValues.empty()) + if (new_name || typed_param.mValues.empty()) { new_value = true; typed_param.mValues.push_back(value_t()); @@ -1168,12 +1156,8 @@ namespace LLInitParam param_value_t& value = typed_param.mValues.back(); // attempt to parse block... - if(value.deserializeBlock(parser, name_stack, generation)) + if(value.deserializeBlock(parser, name_stack_range, new_name)) { - if (new_value) - { // successfully parsed new value, let's keep it - typed_param.mLastParseGeneration = generation; - } typed_param.enclosingBlock().paramChanged(param, true); typed_param.setProvided(true); return true; @@ -1187,11 +1171,6 @@ namespace LLInitParam // try to parse a per type named value if (name_value_lookup_t::getValueFromName(name, value.getValue())) { - if (new_value) - { // successfully parsed new value, let's keep it - typed_param.mLastParseGeneration = generation; - } - typed_param.mValues.back().setValueName(name); typed_param.mValues.back().mKeyVersion = value.getLastChangeVersion(); typed_param.enclosingBlock().paramChanged(param, true); @@ -1219,7 +1198,7 @@ namespace LLInitParam it != end_it; ++it) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; std::string key = it->getValueName(); if (!key.empty() && it->mKeyVersion == it->getLastChangeVersion()) @@ -1317,8 +1296,6 @@ namespace LLInitParam } container_t mValues; - - S32 mLastParseGeneration; }; template @@ -1625,9 +1602,9 @@ namespace LLInitParam } } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { //std::string message = llformat("Deprecated value %s ignored", getName().c_str()); //parser.parserWarning(message); @@ -1669,18 +1646,16 @@ namespace LLInitParam typedef Block super_t; BatchBlock() - : mLastParseGeneration(-1) {} - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation) + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name) { - if (generation != mLastParseGeneration) + if (new_name) { // reset block *static_cast(this) = defaultBatchValue(); - mLastParseGeneration = generation; } - return super_t::deserializeBlock(p, name_stack, generation); + return super_t::deserializeBlock(p, name_stack_range, new_name); } bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) @@ -1688,7 +1663,6 @@ namespace LLInitParam if (overwrite) { *static_cast(this) = defaultBatchValue(); - mLastParseGeneration = -1; // merge individual parameters into destination return super_t::mergeBlock(super_t::selfBlockDescriptor(), other, overwrite); } @@ -1700,19 +1674,20 @@ namespace LLInitParam static DERIVED_BLOCK default_value; return default_value; } - - S32 mLastParseGeneration; }; + // FIXME: this specialization is not currently used, as it only matches against the BatchBlock base class + // and not the derived class with the actual params template class ParamValue , NAME_VALUE_LOOKUP, true> - : public Param, + : public NAME_VALUE_LOOKUP, protected BatchBlock { + public: typedef BatchBlock block_t; typedef const BatchBlock& value_assignment_t; @@ -1734,7 +1709,6 @@ namespace LLInitParam void setValue(value_assignment_t val) { *this = val; - block_t::mLastParseGeneration = -1; } value_assignment_t getValue() const @@ -1764,6 +1738,59 @@ namespace LLInitParam mutable bool mValidated; // lazy validation flag }; + template <> + class ParamValue , + false> + : public TypeValues, + public BaseBlock + { + public: + typedef ParamValue, false> self_t; + typedef const LLSD& value_assignment_t; + + ParamValue() + : mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + {} + + ParamValue(value_assignment_t other) + : mValue(other), + mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + {} + + void setValue(value_assignment_t val) { mValue = val; } + + value_assignment_t getValue() const { return mValue; } + LLSD& getValue() { return mValue; } + + operator value_assignment_t() const { return mValue; } + value_assignment_t operator()() const { return mValue; } + + S32 mKeyVersion; + + // block param interface + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); + void serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; + bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const + { + //TODO: implement LLSD params as schema type Any + return true; + } + + protected: + mutable S32 mValidatedVersion; + mutable bool mValidated; // lazy validation flag + + private: + static void serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack); + + LLSD mValue; + }; + template class CustomParamValue : public Block > >, @@ -1790,11 +1817,11 @@ namespace LLInitParam mValidated(false) {} - bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack, S32 generation) + bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack_range, bool new_name) { derived_t& typed_param = static_cast(*this); // try to parse direct value T - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { if(parser.readValue(typed_param.mValue)) { @@ -1808,7 +1835,7 @@ namespace LLInitParam } // fall back on parsing block components for T - return typed_param.BaseBlock::deserializeBlock(parser, name_stack, generation); + return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); } void serializeBlock(Parser& parser, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index c60f656c2c..1bb550d98f 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -513,7 +513,6 @@ static LLInitParam::Parser::parser_inspect_func_map_t sXUIInspectFuncs; // LLXUIParser::LLXUIParser() : Parser(sXUIReadFuncs, sXUIWriteFuncs, sXUIInspectFuncs), - mLastWriteGeneration(-1), mCurReadDepth(0) { if (sXUIReadFuncs.empty()) @@ -583,7 +582,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) if (!text_contents.empty()) { mCurReadNode = nodep; - mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mNameStack.push_back(std::make_pair(std::string("value"), true)); // child nodes are not necessarily valid parameters (could be a child widget) // so don't complain once we've recursed if (!block.submitValue(mNameStack, *this, true)) @@ -618,7 +617,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) // since there is no widget named "rect" if (child_name.find(".") == std::string::npos) { - mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); + mNameStack.push_back(std::make_pair(child_name, true)); num_tokens_pushed++; } else @@ -654,7 +653,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } } @@ -704,7 +703,7 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } @@ -728,7 +727,7 @@ void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &bloc } // go from a stack of names to a specific XML node -LLXMLNodePtr LLXUIParser::getNode(const name_stack_t& stack) +LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) { name_stack_t name_stack; for (name_stack_t::const_iterator it = stack.begin(); @@ -781,7 +780,7 @@ bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) return self.mCurReadNode == DUMMY_NODE; } -bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& stack) { // just create node LLXUIParser& self = static_cast(parser); @@ -798,7 +797,7 @@ bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) return success; } -bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -817,7 +816,7 @@ bool LLXUIParser::readStringValue(Parser& parser, void* val_ptr) return true; } -bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -855,7 +854,7 @@ bool LLXUIParser::readU8Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getByteValue(1, (U8*)val_ptr); } -bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -879,7 +878,7 @@ bool LLXUIParser::readS8Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -903,7 +902,7 @@ bool LLXUIParser::readU16Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -927,7 +926,7 @@ bool LLXUIParser::readS16Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -945,7 +944,7 @@ bool LLXUIParser::readU32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getUnsignedValue(1, (U32*)val_ptr); } -bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -963,7 +962,7 @@ bool LLXUIParser::readS32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getIntValue(1, (S32*)val_ptr); } -bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -981,7 +980,7 @@ bool LLXUIParser::readF32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getFloatValue(1, (F32*)val_ptr); } -bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -999,7 +998,7 @@ bool LLXUIParser::readF64Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getDoubleValue(1, (F64*)val_ptr); } -bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1023,7 +1022,7 @@ bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1050,7 +1049,7 @@ bool LLXUIParser::readUIColorValue(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1079,7 +1078,7 @@ bool LLXUIParser::readUUIDValue(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1098,7 +1097,7 @@ bool LLXUIParser::readSDValue(Parser& parser, void* val_ptr) return true; } -bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); @@ -1207,7 +1206,6 @@ const char* NO_VALUE_MARKER = "no_value"; LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t element_cb) : Parser(sSimpleXUIReadFuncs, sSimpleXUIWriteFuncs, sSimpleXUIInspectFuncs), - mLastWriteGeneration(-1), mCurReadDepth(0), mElementCB(element_cb) { @@ -1338,7 +1336,7 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) { // compound attribute if (child_name.find(".") == std::string::npos) { - mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); + mNameStack.push_back(std::make_pair(child_name, true)); num_tokens_pushed++; mScope.push_back(child_name); } @@ -1365,7 +1363,7 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } mScope.push_back(mNameStack.back().first); @@ -1398,7 +1396,7 @@ bool LLSimpleXUIParser::readAttributes(const char **atts) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } @@ -1420,7 +1418,7 @@ bool LLSimpleXUIParser::processText() LLStringUtil::trim(mTextContents); if (!mTextContents.empty()) { - mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mNameStack.push_back(std::make_pair(std::string("value"), true)); mCurAttributeValueBegin = mTextContents.c_str(); mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); mNameStack.pop_back(); diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 42a79b4100..e0402523da 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -133,23 +133,23 @@ private: static bool readSDValue(Parser& parser, void* val_ptr); //writer helper functions - static bool writeFlag(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS8Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU16Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS16Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeF32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeF64Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeColor4Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeUIColorValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeUUIDValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeSDValue(Parser& parser, const void* val_ptr, const name_stack_t&); - - LLXMLNodePtr getNode(const name_stack_t& stack); + static bool writeFlag(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeStringValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF64Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeSDValue(Parser& parser, const void* val_ptr, name_stack_t&); + + LLXMLNodePtr getNode(name_stack_t& stack); private: Parser::name_stack_t mNameStack; @@ -159,7 +159,6 @@ private: typedef std::map out_nodes_t; out_nodes_t mOutNodes; - S32 mLastWriteGeneration; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; @@ -226,7 +225,6 @@ private: Parser::name_stack_t mNameStack; struct XML_ParserStruct* mParser; - S32 mLastWriteGeneration; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fa0b392f1b..5077a0a596 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -109,6 +109,7 @@ // Third party library includes #include +#include #if LL_WINDOWS @@ -2041,42 +2042,37 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, llerrs << "Invalid settings location list" << llendl; } - for(LLInitParam::ParamIterator::const_iterator it = mSettingsLocationList->groups.begin(), end_it = mSettingsLocationList->groups.end(); - it != end_it; - ++it) + BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) { // skip settings groups that aren't the one we requested - if (it->name() != location_key) continue; + if (group.name() != location_key) continue; - ELLPath path_index = (ELLPath)it->path_index(); + ELLPath path_index = (ELLPath)group.path_index(); if(path_index <= LL_PATH_NONE || path_index >= LL_PATH_LAST) { llerrs << "Out of range path index in app_settings/settings_files.xml" << llendl; return false; } - LLInitParam::ParamIterator::const_iterator file_it, end_file_it; - for (file_it = it->files.begin(), end_file_it = it->files.end(); - file_it != end_file_it; - ++file_it) + BOOST_FOREACH(const SettingsFile& file, group.files) { - llinfos << "Attempting to load settings for the group " << file_it->name() + llinfos << "Attempting to load settings for the group " << file.name() << " - from location " << location_key << llendl; - LLControlGroup* settings_group = LLControlGroup::getInstance(file_it->name); + LLControlGroup* settings_group = LLControlGroup::getInstance(file.name); if(!settings_group) { - llwarns << "No matching settings group for name " << file_it->name() << llendl; + llwarns << "No matching settings group for name " << file.name() << llendl; continue; } std::string full_settings_path; - if (file_it->file_name_setting.isProvided() - && gSavedSettings.controlExists(file_it->file_name_setting)) + if (file.file_name_setting.isProvided() + && gSavedSettings.controlExists(file.file_name_setting)) { // try to find filename stored in file_name_setting control - full_settings_path = gSavedSettings.getString(file_it->file_name_setting); + full_settings_path = gSavedSettings.getString(file.file_name_setting); if (full_settings_path.empty()) { continue; @@ -2090,16 +2086,16 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, else { // by default, use specified file name - full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file_it->file_name()); + full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file.file_name()); } - if(settings_group->loadFromFile(full_settings_path, set_defaults, file_it->persistent)) + if(settings_group->loadFromFile(full_settings_path, set_defaults, file.persistent)) { // success! llinfos << "Loaded settings file " << full_settings_path << llendl; } else { // failed to load - if(file_it->required) + if(file.required) { llerrs << "Error: Cannot load required settings file from: " << full_settings_path << llendl; return false; @@ -2122,20 +2118,15 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string LLAppViewer::getSettingsFilename(const std::string& location_key, const std::string& file) { - for(LLInitParam::ParamIterator::const_iterator it = mSettingsLocationList->groups.begin(), end_it = mSettingsLocationList->groups.end(); - it != end_it; - ++it) + BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) { - if (it->name() == location_key) + if (group.name() == location_key) { - LLInitParam::ParamIterator::const_iterator file_it, end_file_it; - for (file_it = it->files.begin(), end_file_it = it->files.end(); - file_it != end_file_it; - ++file_it) + BOOST_FOREACH(const SettingsFile& settings_file, group.files) { - if (file_it->name() == file) + if (settings_file.name() == file) { - return file_it->file_name; + return settings_file.file_name; } } } -- cgit v1.2.3 From da3c7da7a585ea14a5a494ac7f36e7714bc86ab8 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 15:04:00 -0700 Subject: side toolbar buttons are now squares again --- indra/llui/lltoolbar.h | 4 ++-- indra/newview/skins/default/xui/en/widgets/toolbar.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 9e48dee608..84fa7ec0df 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index d36b015005..60e7c34d84 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -33,9 +33,9 @@ image_pressed="PushButton_Press" image_pressed_selected="PushButton_Selected_Press" image_selected="PushButton_Selected_Press" - desired_height="35" - button_width.min="35" - button_width.max="35" + desired_height="38" + button_width.min="38" + button_width.max="38" follows="left|top" label="" chrome="true" -- cgit v1.2.3 From 0526d673093b2279777dc8be5aae9cc33cb1c822 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 15:31:25 -0700 Subject: EXP-1312 FIX Floaters should appear in region not covered by toolbars moved floater snap region to middle of toolbars and constrained floaters to that snap region also made toybox floater pass all drag and drop events along to toolbar --- indra/llui/llfloater.cpp | 2 +- indra/newview/llfloatertoybox.cpp | 11 +++++++++++ indra/newview/llfloatertoybox.h | 5 +++++ indra/newview/skins/default/xui/en/main_view.xml | 7 ------- indra/newview/skins/default/xui/en/panel_toolbar_view.xml | 7 +++++++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index cc49238a0b..cba14e21c3 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2549,7 +2549,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out } // move window fully onscreen - if (floater->translateIntoRect( getLocalRect(), allow_partial_outside )) + if (floater->translateIntoRect( getSnapRect(), allow_partial_outside )) { floater->clearSnapTarget(); } diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 609041803a..fa60022911 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -120,5 +120,16 @@ void LLFloaterToybox::onBtnRestoreDefaults() LLToolBarView::loadDefaultToolbars(); } +BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + S32 local_x = x - mToolBar->getRect().mLeft; + S32 local_y = y - mToolBar->getRect().mBottom; + return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); +} + // eof diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index f7245506c5..f0a6cf1a8b 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -43,6 +43,11 @@ public: // virtuals BOOL postBuild(); void draw(); + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); protected: void onBtnRestoreDefaults(); diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 57baa7cdd3..96d070ae50 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -74,13 +74,6 @@ user_resize="false" name="hud container" width="500"> - + Date: Mon, 10 Oct 2011 16:31:56 -0600 Subject: fix for SH-2464: Crash on exit in LLPrivateMemoryPoolManager::freeMem --- indra/llcommon/llmemory.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- indra/llcommon/llmemory.h | 1 + 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 8c02ad8290..7d340483b7 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1773,6 +1773,7 @@ void LLPrivateMemoryPool::LLChunkHashElement::remove(LLPrivateMemoryPool::LLMemo //class LLPrivateMemoryPoolManager //-------------------------------------------------------------------- LLPrivateMemoryPoolManager* LLPrivateMemoryPoolManager::sInstance = NULL ; +std::vector LLPrivateMemoryPoolManager::sDanglingPoolList ; LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled) { @@ -1797,7 +1798,7 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() S32 k = 0 ; for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter) { - llinfos << k++ << ", " << iter->second << llendl ; + llinfos << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; } sMemAllocationTracker.clear() ; } @@ -1817,7 +1818,17 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() { if(mPoolList[i]) { - delete mPoolList[i] ; + if(mPoolList[i]->isEmpty()) + { + delete mPoolList[i] ; + } + else + { + //can not delete this pool because it has alloacted memory to be freed. + //move it to the dangling list. + sDanglingPoolList.push_back(mPoolList[i]) ; + } + mPoolList[i] = NULL ; } } @@ -1953,6 +1964,32 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr } else { + if(!sInstance) //the private memory manager is destroyed, try the dangling list + { + for(S32 i = 0 ; i < sDanglingPoolList.size(); i++) + { + if(sDanglingPoolList[i]->findChunk((char*)addr)) + { + sDanglingPoolList[i]->freeMem(addr) ; + if(sDanglingPoolList[i]->isEmpty()) + { + delete sDanglingPoolList[i] ; + + if(i < sDanglingPoolList.size() - 1) + { + sDanglingPoolList[i] = sDanglingPoolList[sDanglingPoolList.size() - 1] ; + } + sDanglingPoolList.pop_back() ; + } + + addr = NULL ; + break ; + } + } + } + + llassert_always(!addr) ; //addr should be release before hitting here! + free(addr) ; } } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index db753f0d8b..25e6c68e88 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -399,6 +399,7 @@ private: std::vector mPoolList ; BOOL mPrivatePoolEnabled; + static std::vector sDanglingPoolList ; public: //debug and statistics info. void updateStatistics() ; -- cgit v1.2.3 From fba3f5dfd6ab51debd97c2c0e635ddcad388bcfe Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 10 Oct 2011 15:44:31 -0700 Subject: Added picks command and icon. Changed toolbar button text layout to halign left. --- indra/newview/app_settings/commands.xml | 10 +++++ indra/newview/skins/default/textures/textures.xml | 45 +++++++++++---------- .../skins/default/textures/toolbar_icons/picks.png | Bin 0 -> 1368 bytes .../skins/default/xui/en/floater_toybox.xml | 1 + indra/newview/skins/default/xui/en/strings.xml | 2 + .../skins/default/xui/en/widgets/toolbar.xml | 2 + 6 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/picks.png diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index dab57d44bd..f5581baa19 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -152,6 +152,16 @@ is_running_function="Floater.IsOpen" is_running_parameters="people" /> + - - - - - - + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/textures/toolbar_icons/picks.png b/indra/newview/skins/default/textures/toolbar_icons/picks.png new file mode 100644 index 0000000000..4499bf562b Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/picks.png differ diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 653788bd3c..90b7e906a5 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -74,6 +74,7 @@ image_color="ButtonImageColor" image_color_disabled="ButtonImageColor" flash_color="ButtonUnselectedFgColor" + halign="left" hover_glow_amount="0.15" display_pressed_state="false" /> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index f021fdd6a1..d12dda88be 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3668,6 +3668,7 @@ Try enclosing path to the editor with double quotes. Mini-map Move People + Picks Places Preferences Profile @@ -3692,6 +3693,7 @@ Try enclosing path to the editor with double quotes. Show nearby people Moving your avatar Friends, groups, and nearby people + Favorite places Places you've saved Preferences Edit or view your profile diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 60e7c34d84..09967de7cc 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -14,6 +14,7 @@ background_opaque="true"/> Date: Mon, 10 Oct 2011 15:53:44 -0700 Subject: Mac build fix --- indra/llui/llsdparam.cpp | 9 ++++++--- indra/llui/llsdparam.h | 3 ++- indra/llxuixml/llinitparam.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 83bed3e745..da50c0ff39 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -66,7 +66,8 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); sd_to_write.assign((S32)*((const U32*)val_ptr)); return true; @@ -77,7 +78,8 @@ bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* v LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); return true; } @@ -324,6 +326,7 @@ namespace LLInitParam void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t name_stack, const BaseBlock* diff_block) const { // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue); + Parser::name_stack_t stack; + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack); } } diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index 265993ffb5..784358d038 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -62,7 +62,8 @@ private: LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + LLInitParam::Parser::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); sd_to_write.assign(*((const T*)val_ptr)); return true; diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 9245f588d9..06140d0931 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -960,7 +960,7 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, bool new_name) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); value_t value; -- cgit v1.2.3 From 2d34dab6a3d3f4b8ad78aee941800fe8f5f27bd1 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 16:54:55 -0700 Subject: fixed toolbar serialization --- indra/llxuixml/llxuiparser.cpp | 26 ++++++++------------------ indra/llxuixml/llxuiparser.h | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 1bb550d98f..aee8fa8d8f 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -729,22 +729,11 @@ void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &bloc // go from a stack of names to a specific XML node LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) { - name_stack_t name_stack; - for (name_stack_t::const_iterator it = stack.begin(); - it != stack.end(); - ++it) - { - if (!it->first.empty()) - { - name_stack.push_back(*it); - } - } - LLXMLNodePtr out_node = mWriteRootNode; - name_stack_t::const_iterator next_it = name_stack.begin(); - for (name_stack_t::const_iterator it = name_stack.begin(); - it != name_stack.end(); + name_stack_t::iterator next_it = stack.begin(); + for (name_stack_t::iterator it = stack.begin(); + it != stack.end(); it = next_it) { ++next_it; @@ -753,17 +742,18 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) continue; } - out_nodes_t::iterator found_it = mOutNodes.lower_bound(it->second); + out_nodes_t::iterator found_it = mOutNodes.find(it->first); // node with this name not yet written - if (found_it == mOutNodes.end() || mOutNodes.key_comp()(found_it->first, it->second)) + if (found_it == mOutNodes.end() || it->second) { // make an attribute if we are the last element on the name stack - bool is_attribute = next_it == name_stack.end(); + bool is_attribute = next_it == stack.end(); LLXMLNodePtr new_node = new LLXMLNode(it->first.c_str(), is_attribute); out_node->addChild(new_node); - mOutNodes.insert(found_it, std::make_pair(it->second, new_node)); + mOutNodes[it->first] = new_node; out_node = new_node; + it->second = false; } else { diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index e0402523da..d7cd256967 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -157,7 +157,7 @@ private: // Root of the widget XML sub-tree, for example, "line_editor" LLXMLNodePtr mWriteRootNode; - typedef std::map out_nodes_t; + typedef std::map out_nodes_t; out_nodes_t mOutNodes; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; -- cgit v1.2.3 From 068035959804d6a16a41ddb2ef62da00dceb2689 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 17:03:12 -0700 Subject: converted bad toolbars.xml file from error to warning --- indra/newview/lltoolbarview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 44b244f163..a0e080b783 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -152,7 +152,7 @@ bool LLToolBarView::loadToolbars(bool force_default) LLXMLNodePtr root; if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) { - llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl; return false; } if(!root->hasName("toolbars")) -- cgit v1.2.3 From fd03ae299bfaf83789e511912d99d204c0833e7f Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 10 Oct 2011 17:08:51 -0700 Subject: EXP-1274 Create floater for "Avatar Picker" content EXP-1299 Nearby Voice floater can't be closed by clicking the sidebar button again. EXP-1306 Prompt text to "Change your avatar" and "Destinations" floaters get pushed down one line when the floater dialog gets resized to minimum width --- indra/llui/llfloater.cpp | 21 ++++++--- indra/llui/llfloater.h | 2 +- indra/llui/llresizehandle.cpp | 12 ----- indra/llui/llresizehandle.h | 7 +-- indra/newview/CMakeLists.txt | 2 + indra/newview/llcallfloater.cpp | 19 ++------ indra/newview/llcallfloater.h | 2 +- indra/newview/llfloateravatar.cpp | 54 ++++++++++++++++++++++ indra/newview/llfloateravatar.h | 43 +++++++++++++++++ indra/newview/llfloaterdestinations.cpp | 1 + indra/newview/llnearbychatbar.cpp | 7 ++- indra/newview/llviewerfloaterreg.cpp | 3 +- .../skins/default/xui/en/floater_avatar.xml | 6 +-- .../skins/default/xui/en/floater_destinations.xml | 5 +- 14 files changed, 132 insertions(+), 52 deletions(-) create mode 100644 indra/newview/llfloateravatar.cpp create mode 100644 indra/newview/llfloateravatar.h diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c28bcc2ec9..f85e46e28d 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -459,15 +459,24 @@ void LLFloater::layoutResizeCtrls() mResizeHandle[3]->setRect(rect); } -void LLFloater::enableResizeCtrls(bool enable) +void LLFloater::enableResizeCtrls(bool enable, bool width, bool height) { + mResizeBar[LLResizeBar::LEFT]->setVisible(enable && width); + mResizeBar[LLResizeBar::LEFT]->setEnabled(enable && width); + + mResizeBar[LLResizeBar::TOP]->setVisible(enable && height); + mResizeBar[LLResizeBar::TOP]->setEnabled(enable && height); + + mResizeBar[LLResizeBar::RIGHT]->setVisible(enable && width); + mResizeBar[LLResizeBar::RIGHT]->setEnabled(enable && width); + + mResizeBar[LLResizeBar::BOTTOM]->setVisible(enable && height); + mResizeBar[LLResizeBar::BOTTOM]->setEnabled(enable && height); + for (S32 i = 0; i < 4; ++i) { - mResizeBar[i]->setVisible(enable); - mResizeBar[i]->setEnabled(enable); - - mResizeHandle[i]->setVisible(enable); - mResizeHandle[i]->setEnabled(enable); + mResizeHandle[i]->setVisible(enable && width && height); + mResizeHandle[i]->setEnabled(enable && width && height); } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5aff542049..af9665e599 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -291,6 +291,7 @@ public: void updateTransparency(ETypeTransparency transparency_type); + void enableResizeCtrls(bool enable, bool width = true, bool height = true); protected: virtual void applySavedVariables(); @@ -340,7 +341,6 @@ private: BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); - void enableResizeCtrls(bool enable); void addDragHandle(); void layoutDragHandle(); // repair layout diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 942e84eeb6..c3a51c36c9 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -55,8 +55,6 @@ LLResizeHandle::LLResizeHandle(const LLResizeHandle::Params& p) mImage( NULL ), mMinWidth( p.min_width ), mMinHeight( p.min_height ), - mMaxWidth(S32_MAX), - mMaxHeight(S32_MAX), mCorner( p.corner ) { if( RIGHT_BOTTOM == mCorner) @@ -179,11 +177,6 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_width = mMinWidth; delta_x = x_multiple * (mMinWidth - orig_rect.getWidth()); } - else if (new_width > mMaxWidth) - { - new_width = mMaxWidth; - delta_x = x_multiple * (mMaxWidth - orig_rect.getWidth()); - } S32 new_height = orig_rect.getHeight() + y_multiple * delta_y; if( new_height < mMinHeight ) @@ -191,11 +184,6 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_height = mMinHeight; delta_y = y_multiple * (mMinHeight - orig_rect.getHeight()); } - else if (new_height > mMaxHeight) - { - new_height = mMaxHeight; - delta_y = y_multiple * (mMaxHeight - orig_rect.getHeight()); - } switch( mCorner ) { diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 5cfe3fb63c..7541b9e6c0 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -55,10 +55,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } - - void setMaxWidth(S32 width) { mMaxWidth = width;} - void setMaxHeight(S32 height) { mMaxHeight = height;} - + private: BOOL pointInHandle( S32 x, S32 y ); @@ -69,9 +66,7 @@ private: LLCoordGL mLastMouseDir; LLPointer mImage; S32 mMinWidth; - S32 mMaxWidth; S32 mMinHeight; - S32 mMaxHeight; const ECorner mCorner; }; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 941cb6b9f9..97ccfeac29 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -168,6 +168,7 @@ set(viewer_SOURCE_FILES llfloaterabout.cpp llfloateranimpreview.cpp llfloaterauction.cpp + llfloateravatar.cpp llfloateravatarpicker.cpp llfloateravatartextures.cpp llfloaterbeacons.cpp @@ -733,6 +734,7 @@ set(viewer_HEADER_FILES llfloaterabout.h llfloateranimpreview.h llfloaterauction.h + llfloateravatar.h llfloateravatarpicker.h llfloateravatartextures.h llfloaterbeacons.h diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 945a760d05..4c6ddc8be7 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -44,7 +44,6 @@ #include "llparticipantlist.h" #include "llspeakers.h" #include "lltextutil.h" -#include "lltransientfloatermgr.h" #include "llviewercontrol.h" #include "llviewerdisplayname.h" #include "llviewerwindow.h" @@ -97,7 +96,7 @@ static void* create_non_avatar_caller(void*) LLVoiceChannel* LLCallFloater::sCurrentVoiceChannel = NULL; LLCallFloater::LLCallFloater(const LLSD& key) -: LLTransientDockableFloater(NULL, false, key) +: LLFloater(key) , mSpeakerManager(NULL) , mParticipants(NULL) , mAvatarList(NULL) @@ -113,10 +112,6 @@ LLCallFloater::LLCallFloater(const LLSD& key) mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL); LLVoiceClient::instance().addObserver(this); - LLTransientFloaterMgr::getInstance()->addControlView(this); - - // force docked state since this floater doesn't save it between recreations - setDocked(true); // update the agent's name if display name setting change LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLCallFloater::updateAgentModeratorState, this)); @@ -139,13 +134,11 @@ LLCallFloater::~LLCallFloater() { LLVoiceClient::getInstance()->removeObserver(this); } - LLTransientFloaterMgr::getInstance()->removeControlView(this); } // virtual BOOL LLCallFloater::postBuild() { - LLTransientDockableFloater::postBuild(); mAvatarList = getChild("speakers_list"); mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLCallFloater::onAvatarListRefreshed, this)); @@ -154,12 +147,6 @@ BOOL LLCallFloater::postBuild() mNonAvatarCaller = findChild("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); - LLView *anchor_panel = LLBottomTray::getInstance()->getChild("speak_flyout_btn"); - - setDockControl(new LLDockControl( - anchor_panel, this, - getDockTongue(), LLDockControl::TOP)); - initAgentData(); connectToChannel(LLVoiceChannel::getCurrentVoiceChannel()); @@ -204,13 +191,13 @@ void LLCallFloater::draw() if (mParticipants) mParticipants->updateRecentSpeakersOrder(); - LLTransientDockableFloater::draw(); + LLFloater::draw(); } // virtual void LLCallFloater::setFocus( BOOL b ) { - LLTransientDockableFloater::setFocus(b); + LLFloater::setFocus(b); // Force using active floater transparency (STORM-730). // We have to override setFocus() for LLCallFloater because selecting an item diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 00a3f76e56..ea78cd53b7 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -52,7 +52,7 @@ class LLSpeakersDelayActionsStorage; * When the Resident is engaged in any chat except Nearby Chat, the Voice Control Panel * also provides a 'Leave Call' button to allow the Resident to leave that voice channel. */ -class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipantObserver +class LLCallFloater : public LLFloater, LLVoiceClientParticipantObserver { public: diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp new file mode 100644 index 0000000000..bdc5b581a9 --- /dev/null +++ b/indra/newview/llfloateravatar.cpp @@ -0,0 +1,54 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/** + * Floater that appears when buying an object, giving a preview + * of its contents and their permissions. + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloateravatar.h" +#include "lluictrlfactory.h" + + +LLFloaterAvatar::LLFloaterAvatar(const LLSD& key) + : LLFloater(key) +{ +} + +LLFloaterAvatar::~LLFloaterAvatar() +{ +} + +BOOL LLFloaterAvatar::postBuild() +{ + enableResizeCtrls(true, true, false); + return TRUE; +} + + diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h new file mode 100644 index 0000000000..cadc5e4028 --- /dev/null +++ b/indra/newview/llfloateravatar.h @@ -0,0 +1,43 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_FLOATER_AVATAR_H +#define LL_FLOATER_AVATAR_H + +#include "llfloater.h" + +class LLFloaterAvatar: + public LLFloater +{ + friend class LLFloaterReg; +private: + LLFloaterAvatar(const LLSD& key); + /*virtual*/ ~LLFloaterAvatar(); + /*virtual*/ BOOL postBuild(); +}; + +#endif diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index 52d1f67c36..af21cb593f 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -47,6 +47,7 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { + enableResizeCtrls(true, true, false); return TRUE; } diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index cba4fafe42..caa20b767c 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -452,6 +452,8 @@ BOOL LLNearbyChatBar::postBuild() mExpandedHeight = getMinHeight() + EXPANDED_HEIGHT; + enableResizeCtrls(true, true, false); + return TRUE; } @@ -462,6 +464,7 @@ void LLNearbyChatBar::applyRectControl() { getChildView("nearby_chat")->setVisible(true); mExpandedHeight = getRect().getHeight(); + enableResizeCtrls(true); } } @@ -707,13 +710,13 @@ void LLNearbyChatBar::onToggleNearbyChatPanel() mExpandedHeight = getRect().getHeight(); nearby_chat->setVisible(FALSE); reshape(getRect().getWidth(), getMinHeight()); - mResizeHandle[0]->setMaxHeight(getMinHeight()); + enableResizeCtrls(true, true, false); } else { nearby_chat->setVisible(TRUE); reshape(getRect().getWidth(), mExpandedHeight); - mResizeHandle[0]->setMaxHeight(S32_MAX); + enableResizeCtrls(true); } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b0daf9f3c2..619d74e7ac 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -37,6 +37,7 @@ #include "llfloaterabout.h" #include "llfloateranimpreview.h" #include "llfloaterauction.h" +#include "llfloateravatar.h" #include "llfloateravatarpicker.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" @@ -168,7 +169,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar", "floater_avatar.xml", &LLFloaterReg::build); + LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml index a0c1f4c021..666aa2d164 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar.xml @@ -3,11 +3,9 @@ legacy_header_height="225" can_minimize="true" can_close="true" - user_resize="true" can_resize="true" min_height="230" - min_width="455" - max_height="230" + min_width="445" height="230" layout="topleft" name="Avatar" @@ -19,7 +17,7 @@ diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml index 9dd9338f37..669b7eb15a 100644 --- a/indra/newview/skins/default/xui/en/floater_destinations.xml +++ b/indra/newview/skins/default/xui/en/floater_destinations.xml @@ -7,7 +7,6 @@ can_resize="true" min_height="230" min_width="525" - max_height="230" height="230" layout="topleft" name="Destinations" @@ -15,11 +14,11 @@ help_topic="destinations" save_rect="true" title="Destinations" - width="445"> + width="525"> Date: Mon, 10 Oct 2011 17:29:04 -0700 Subject: EXP-1302 PARTIAL Make the Speak button work as a toolbar button First pass - no Push-To-Talk functionality. --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/llagent.cpp | 38 ++++++++++++++++++++++++++++++++- indra/newview/llagent.h | 16 +++++++++++++- indra/newview/llbottomtray.cpp | 3 +++ 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index dab57d44bd..139eabcae4 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -207,11 +207,11 @@ icon="Command_Speak_Icon" label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" - execute_function="Floater.ToolbarToggle" + execute_function="Agent.ToggleMicrophone" execute_parameters="speak" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="speak" - is_running_function="Floater.IsOpen" + is_running_function="Agent.IsMicrophoneOn" is_running_parameters="speak" /> inputUserControlState(true); + LLVoiceClient::getInstance()->inputUserControlState(false); + } + else + { + LLVoiceClient::getInstance()->inputUserControlState(false); + LLVoiceClient::getInstance()->inputUserControlState(true); + } +} + +// static +bool LLAgent::isMicrophoneOn(const LLSD& sdname) +{ + return gAgent.mMicrophoneOn; +} // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that @@ -261,6 +292,9 @@ LLAgent::LLAgent() : mCurrentFidget(0), mFirstLogin(FALSE), mGenderChosen(FALSE), + + mVoiceConnected(false), + mMicrophoneOn(false), mAppearanceSerialNum(0), @@ -280,6 +314,8 @@ LLAgent::LLAgent() : LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); } // Requires gSavedSettings to be initialized. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 1775a0235c..0355e68b6e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -282,7 +282,21 @@ public: static void toggleFlying(); static bool enableFlying(); BOOL canFly(); // Does this parcel allow you to fly? - + + //-------------------------------------------------------------------- + // Voice + //-------------------------------------------------------------------- +public: + bool isVoiceConnected() const { return mVoiceConnected; } + void setVoiceConnected(const bool b) { mVoiceConnected = b; } + + static void toggleMicrophone(const LLSD& name); + static bool isMicrophoneOn(const LLSD& sdname); + +private: + bool mVoiceConnected; + bool mMicrophoneOn; + //-------------------------------------------------------------------- // Chat //-------------------------------------------------------------------- diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 98712f1334..af91702f9b 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -387,6 +387,9 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) { bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + + gAgent.setVoiceConnected(voice_status); + getChild("speak_flyout_btn")->setEnabled(voice_status); gMenuBarView->getChild("Nearby Voice")->setEnabled(voice_status); if (voice_status) -- cgit v1.2.3 From 6a570a9bdc2660e4db87e8e7a65b724e1ad8d1b2 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 17:52:37 -0700 Subject: fixed icons moving when clicking on icon-only toolbars --- indra/llui/llbutton.cpp | 2 +- indra/llui/lltoolbar.cpp | 5 +++++ indra/llui/lltoolbar.h | 2 ++ indra/newview/skins/default/xui/en/widgets/toolbar.xml | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 68cb5164b6..ba3748a573 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1002,7 +1002,7 @@ void LLButton::resize(LLUIString label) if (mImageOverlay) { S32 overlay_width = mImageOverlay->getWidth(); - F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight(); + F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight(); overlay_width = llround((F32)overlay_width * scale_factor); switch(mImageOverlayAlignment) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 6332b2674a..5ba54edf1c 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -852,3 +852,8 @@ void LLToolBarButton::onMouseCaptureLost() { mIsDragged = false; } + +void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent); +} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 84fa7ec0df..a81a5fdb39 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -62,6 +62,8 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); + void reshape(S32 width, S32 height, BOOL called_from_parent = true); + void setCommandId(const LLCommandId& id) { mId = id; } void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 09967de7cc..be5dfaf18c 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -31,6 +31,8 @@ flash_color="EmphasisColor"/> Date: Mon, 10 Oct 2011 18:00:24 -0700 Subject: EXP-1300 : Simplify and clean up of the DaD which now doesn't duplicate the dragged tool. --- indra/llui/llcommandmanager.h | 4 +- indra/llui/lltoolbar.cpp | 83 ++++++++++++++--------------------------- indra/llui/lltoolbar.h | 12 +++--- indra/newview/lltoolbarview.cpp | 64 ++++++++++++++++++++++++++----- indra/newview/lltoolbarview.h | 10 ++--- 5 files changed, 95 insertions(+), 78 deletions(-) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index fdad7cd1b5..46e0fe6e69 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -68,8 +68,8 @@ public: mUUID = LLUUID::generateNewID(p.name); } - LLCommandId(const std::string& name, const LLUUID& uuid) - : mName(name), + LLCommandId(const LLUUID& uuid) + : mName(""), mUUID(uuid) { } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 6332b2674a..776e91b7e5 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -114,8 +114,6 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; - mDraggedCommand = LLCommandId::null; - mRank = 0; } LLToolBar::~LLToolBar() @@ -211,19 +209,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) // Create the button and do the things that don't need ordering LLToolBarButton* button = createButton(commandId); mButtonPanel->addChild(button); - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - mButtonMap.insert(std::make_pair(temp_command.uuid(), button)); + mButtonMap.insert(std::make_pair(commandId.uuid(), button)); // Insert the command and button in the right place in their respective lists - if ((rank >= mButtonCommands.size()) || (rank < 0)) + if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE)) { // In that case, back load - mButtonCommands.push_back(temp_command); + mButtonCommands.push_back(commandId); mButtons.push_back(button); } else @@ -238,7 +231,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) rank--; } // ...then insert - mButtonCommands.insert(it_command,temp_command); + mButtonCommands.insert(it_command,commandId); mButtons.insert(it_button,button); } @@ -247,27 +240,28 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) return true; } -bool LLToolBar::removeCommand(const LLCommandId& commandId) +// Remove a command from the list +// Returns the rank of the command in the original list so that doing addCommand(id,rank) right after +// a removeCommand(id) would leave the list unchanged. +// Returns RANK_NONE if the command is not found in the list +int LLToolBar::removeCommand(const LLCommandId& commandId) { - if (!hasCommand(commandId)) return false; + if (!hasCommand(commandId)) return RANK_NONE; llinfos << "Merov debug : removeCommand, " << commandId.name() << ", " << commandId.uuid() << llendl; // First erase the map record - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); mButtonMap.erase(it); // Now iterate on the commands and buttons to identify the relevant records + int rank = 0; std::list::iterator it_button = mButtons.begin(); command_id_list_t::iterator it_command = mButtonCommands.begin(); - while (*it_command != temp_command) + while (*it_command != commandId) { ++it_button; ++it_command; + ++rank; } // Delete the button and erase the command and button records @@ -277,7 +271,7 @@ bool LLToolBar::removeCommand(const LLCommandId& commandId) mNeedsLayout = true; - return true; + return rank; } void LLToolBar::clearCommandsList() @@ -292,12 +286,7 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const { if (commandId != LLCommandId::null) { - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::const_iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::const_iterator it = mButtonMap.find(commandId.uuid()); return (it != mButtonMap.end()); } @@ -310,12 +299,7 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) if (commandId != LLCommandId::null) { - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); if (it != mButtonMap.end()) { it->second->setEnabled(enabled); @@ -410,6 +394,10 @@ void LLToolBar::resizeButtonsInRow(std::vector& buttons_in_row } } +// Returns the position of the coordinates as a rank in the button list. +// The rank is the position a tool dropped in (x,y) would assume in the button list. +// The value returned is between 0 and mButtons.size(), 0 being the first element to the left +// (or top) and mButtons.size() the last one to the right (or bottom). int LLToolBar::getRankFromPosition(S32 x, S32 y) { int rank = 0; @@ -618,12 +606,6 @@ void LLToolBar::draw() } } } - // HACK!!! - if (!mDragAndDropTarget) - { - removeCommand(mDraggedCommand); - mDraggedCommand = LLCommandId::null; - } updateLayoutAsNeeded(); // rect may have shifted during layout @@ -654,12 +636,7 @@ void LLToolBar::createButtons() LLToolBarButton* button = createButton(command_id); mButtons.push_back(button); mButtonPanel->addChild(button); - LLCommandId temp_command = command_id; - if (command_id.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - mButtonMap.insert(std::make_pair(temp_command.uuid(), button)); + mButtonMap.insert(std::make_pair(command_id.uuid(), button)); } mNeedsLayout = true; } @@ -736,7 +713,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - //llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl; + llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl; // If we have a drop callback, that means that we can handle the drop BOOL handled = (mHandleDropCallback ? TRUE : FALSE); @@ -761,19 +738,13 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, LLAssetType::EType type = inv_item->getType(); if (type == LLAssetType::AT_WIDGET) { - mRank = getRankFromPosition(x, y); - mDraggedCommand = LLCommandId("Drag Tool",inv_item->getUUID()); - removeCommand(mDraggedCommand); - addCommand(mDraggedCommand,mRank); + LLCommandId dragged_command(inv_item->getUUID()); + int rank = getRankFromPosition(x, y); + removeCommand(dragged_command); + addCommand(dragged_command,rank); mDragAndDropTarget = true; } } - else - { - removeCommand(mDraggedCommand); - mDraggedCommand = LLCommandId::null; - } - } return handled; diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 84fa7ec0df..56bc8b9bb3 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), @@ -161,9 +161,11 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); + + static const int RANK_NONE = -1; - bool addCommand(const LLCommandId& commandId, int rank = -1); - bool removeCommand(const LLCommandId& commandId); + bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE); + int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); @@ -184,8 +186,6 @@ protected: tool_handledrag_callback_t mHandleDragItemCallback; tool_handledrop_callback_t mHandleDropCallback; bool mDragAndDropTarget; - int mRank; - LLCommandId mDraggedCommand; public: // Methods used in loading and saving toolbar settings diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 44b244f163..8273d1491d 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -41,7 +41,6 @@ LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register r("toolbar_view"); -bool LLToolBarView::sDragStarted = false; bool isToolDragged() { @@ -331,18 +330,25 @@ void LLToolBarView::draw() void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid) { - //llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << llendl; + llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; + // Flag the tool dragging but don't start it yet + gToolBarView->mDragStarted = false; + gToolBarView->mDragCommand = LLCommandId::null; + gToolBarView->mDragRank = LLToolBar::RANK_NONE; + gToolBarView->mDragToolbar = NULL; LLToolDragAndDrop::getInstance()->setDragStart( x, y ); - sDragStarted = false; } BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) { -// llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y )) { - if (!sDragStarted) + if (!gToolBarView->mDragStarted) { + llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; + // Start the tool dragging: + + // First, create the global drag and drop object std::vector types; uuid_vec_t cargo_ids; types.push_back(DAD_WIDGET); @@ -350,9 +356,35 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET); LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER; LLUUID srcID; - //llinfos << "Merov debug: handleDragTool() : beginMultiDrag()" << llendl; LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID); - sDragStarted = true; + llinfos << "Merov debug: beginMultiDrag() launched" << llendl; + + // Second, check if the command is present in one of the 3 toolbars + // If it is, store the command, the toolbar and the rank in the toolbar and + // set a callback on end drag so that we reinsert the command if no drop happened + /* + gToolBarView->mDragCommand = LLCommandId(uuid); + if ((gToolBarView->mDragRank = gToolBarView->mToolbarLeft->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarLeft; + } + else if ((gToolBarView->mDragRank = gToolBarView->mToolbarRight->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarRight; + } + else if ((gToolBarView->mDragRank = gToolBarView->mToolbarBottom->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarBottom; + } + if (gToolBarView->mDragRank != LLToolBar::RANK_NONE) + { + llinfos << "Merov debug: rank of dragged tool = " << gToolBarView->mDragRank << llendl; + LLToolDragAndDrop::getInstance()->setEndDragCallback(boost::bind(&LLToolBarView::onEndDrag, gToolBarView)); + } + */ + + llinfos << "Merov debug: Drag started cleanly" << llendl; + gToolBarView->mDragStarted = true; return TRUE; } else @@ -375,7 +407,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t //llinfos << "Merov debug : handleDropTool. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); - LLCommandId command_id("",inv_item->getUUID()); + LLCommandId command_id(inv_item->getUUID()); LLCommand* command = mgr.getCommand(command_id); if (command) { @@ -408,5 +440,19 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t void LLToolBarView::stopDragTool() { - sDragStarted = false; + // Clear the saved command, toolbar and rank + gToolBarView->mDragStarted = false; + gToolBarView->mDragCommand = LLCommandId::null; + gToolBarView->mDragRank = LLToolBar::RANK_NONE; + gToolBarView->mDragToolbar = NULL; } + +void LLToolBarView::onEndDrag() +{ + // If there's a saved command, reinsert it in the saved toolbar + if (gToolBarView->mDragRank != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar->addCommand(gToolBarView->mDragCommand,gToolBarView->mDragRank); + } + stopDragTool(); +} \ No newline at end of file diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index a0c526ac54..6623e63f8a 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -78,6 +78,7 @@ public: static BOOL handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); static BOOL handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); static void stopDragTool(); + void onEndDrag(); protected: friend class LLUICtrlFactory; @@ -94,12 +95,11 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; - bool mDragging; - LLToolBarButton* mDragButton; - S32 mMouseX; - S32 mMouseY; - static bool sDragStarted; + LLCommandId mDragCommand; + int mDragRank; + LLToolBar* mDragToolbar; + bool mDragStarted; }; extern LLToolBarView* gToolBarView; -- cgit v1.2.3 From 71879916428e9e15081d73696f46bb4a32877265 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Oct 2011 19:03:40 -0700 Subject: EXP-1300 : Add the caret images and xml (no code yet) --- indra/newview/skins/default/textures/textures.xml | 3 +++ .../textures/toolbar_icons/caret_bottom.png | Bin 0 -> 139 bytes .../default/textures/toolbar_icons/caret_left.png | Bin 0 -> 893 bytes .../default/textures/toolbar_icons/caret_right.png | Bin 0 -> 892 bytes .../skins/default/xui/en/panel_toolbar_view.xml | 30 +++++++++++++++++++++ 5 files changed, 33 insertions(+) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_left.png create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_right.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index e7fb836f45..27577d42ea 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -149,6 +149,9 @@ with the same filename but different name + + + diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png new file mode 100644 index 0000000000..82f58b22b9 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png new file mode 100644 index 0000000000..75eecc84ed Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png new file mode 100644 index 0000000000..677459ae1c Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png differ diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index bc96bfbab5..5d6967ed32 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -47,6 +47,16 @@ bottom="-10" side="left" button_display_mode="icons_only"> + + @@ -109,6 +129,16 @@ follows="left|right|bottom" button_display_mode="icons_with_text" visible="true"> + -- cgit v1.2.3 From ec23ec68ea8835e4155e083ec5570245b0aef1ec Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:17:38 -0700 Subject: EXP-1310 FIX Profile button should open Web Profile floater removed unused LLWeb functions for opening non-web media moved logic inside floaters and away from auxiliary functions --- indra/llui/llfloaterreg.cpp | 6 ++++- indra/llui/llhelp.h | 1 + indra/newview/app_settings/commands.xml | 6 ++--- indra/newview/llavataractions.cpp | 19 +++++++++++----- indra/newview/llavataractions.h | 3 ++- indra/newview/llfloaterhelpbrowser.cpp | 17 +++++++++----- indra/newview/llfloaterhelpbrowser.h | 2 -- indra/newview/llfloaterwebcontent.cpp | 39 ++++++++++++++------------------- indra/newview/llmediactrl.cpp | 11 +--------- indra/newview/llpanelprofile.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 4 ++-- indra/newview/llviewerhelp.cpp | 37 +++++++------------------------ indra/newview/llviewerhelp.h | 6 ++--- indra/newview/llviewermenu.cpp | 32 ++++++++++++++++++++++++++- indra/newview/llweb.cpp | 4 +++- indra/newview/llweb.h | 10 ++++----- 16 files changed, 103 insertions(+), 96 deletions(-) diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d0ae9413a3..ae06eb74ac 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -110,7 +110,11 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) int index = list.size(); res = build_func(key); - + if (!res) + { + llwarns << "Failed to build floater type: '" << name << "'." << llendl; + return NULL; + } bool success = res->buildFromFile(xui_file, NULL); if (!success) { diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h index 83317bd03c..1726347a78 100644 --- a/indra/llui/llhelp.h +++ b/indra/llui/llhelp.h @@ -32,6 +32,7 @@ class LLHelp { public: virtual void showTopic(const std::string &topic) = 0; + virtual std::string getURL(const std::string &topic) = 0; // return default (fallback) topic name suitable for showTopic() virtual std::string defaultTopic() = 0; // return topic to use before the user logs in diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 881bc22144..d758647d3a 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -187,10 +187,8 @@ icon="Command_Profile_Icon" label_ref="Command_Profile_Label" tooltip_ref="Command_Profile_Tooltip" - execute_function="Floater.ToolbarToggle" - execute_parameters="my_profile" - is_running_function="Floater.IsOpen" - is_running_parameters="my_profile" + execute_function="Avatar.ToggleMyProfile" + is_running_function="Avatar.IsMyProfileOpen" /> profile_rect(gSavedSettings, "WebProfileRect"); - LLFloaterWebContent::create(LLFloaterWebContent::Params(). - url(url). - id(agent_id.asString()). - show_chrome(show_chrome). - window_class("profile"). - preferred_media_size(profile_rect)); + LLFloaterWebContent::Params p; + p.url(url). + id(agent_id.asString()). + show_chrome(show_chrome). + window_class("profile"). + preferred_media_size(profile_rect); + LLFloaterReg::showInstance("profile", p); } // static @@ -342,6 +343,12 @@ bool LLAvatarActions::profileVisible(const LLUUID& id) return browser && browser->isShown(); } +//static +LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) +{ + LLFloaterWebContent *browser = dynamic_cast (LLFloaterReg::findInstance("profile", LLSD().with("id", id))); + return browser; +} //static void LLAvatarActions::hideProfile(const LLUUID& id) diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index fbfd815f41..748b7cb3d1 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -35,7 +35,7 @@ #include class LLInventoryPanel; - +class LLFloater; /** * Friend-related actions (add, remove, offer teleport, etc) @@ -96,6 +96,7 @@ public: static void showProfile(const LLUUID& id); static void hideProfile(const LLUUID& id); static bool profileVisible(const LLUUID& id); + static LLFloater* getProfileFloater(const LLUUID& id); /** * Show avatar on world map. diff --git a/indra/newview/llfloaterhelpbrowser.cpp b/indra/newview/llfloaterhelpbrowser.cpp index 3012638d44..fd9c37ae73 100644 --- a/indra/newview/llfloaterhelpbrowser.cpp +++ b/indra/newview/llfloaterhelpbrowser.cpp @@ -39,6 +39,7 @@ #include "llurlhistory.h" #include "llmediactrl.h" #include "llviewermedia.h" +#include "llviewerhelp.h" LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key) @@ -74,6 +75,17 @@ void LLFloaterHelpBrowser::buildURLHistory() void LLFloaterHelpBrowser::onOpen(const LLSD& key) { gSavedSettings.setBOOL("HelpFloaterOpen", TRUE); + + std::string topic = key.asString(); + + if (topic == "__local") + { + mBrowser->navigateToLocalPage( "help-offline" , "index.html" ); + } + else + { + mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic)); + } } //virtual @@ -148,8 +160,3 @@ void LLFloaterHelpBrowser::openMedia(const std::string& media_url) mBrowser->navigateTo(media_url, "text/html"); setCurrentURL(media_url); } - -void LLFloaterHelpBrowser::navigateToLocalPage( const std::string& subdir, const std::string& filename_in ) -{ - mBrowser->navigateToLocalPage(subdir, filename_in); -} diff --git a/indra/newview/llfloaterhelpbrowser.h b/indra/newview/llfloaterhelpbrowser.h index afe0f4df69..80b0ecc06b 100644 --- a/indra/newview/llfloaterhelpbrowser.h +++ b/indra/newview/llfloaterhelpbrowser.h @@ -48,8 +48,6 @@ class LLFloaterHelpBrowser : /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); void openMedia(const std::string& media_url); - - void navigateToLocalPage( const std::string& subdir, const std::string& filename_in ); private: void buildURLHistory(); diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 2c9a736aff..c76aeb0498 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -88,20 +88,6 @@ BOOL LLFloaterWebContent::postBuild() return TRUE; } -bool LLFloaterWebContent::matchesKey(const LLSD& key) -{ - LLUUID id = key["id"]; - if (id.notNull()) - { - return id == mKey["id"].asUUID(); - } - else - { - return key["target"].asString() == mKey["target"].asString(); - } -} - - void LLFloaterWebContent::initializeURLHistory() { // start with an empty list @@ -123,6 +109,20 @@ void LLFloaterWebContent::initializeURLHistory() } } +bool LLFloaterWebContent::matchesKey(const LLSD& key) +{ + Params p(mKey); + Params other_p(key); + if (!other_p.target().empty() && other_p.target() != "_blank") + { + return other_p.target() == p.target(); + } + else + { + return other_p.id() == p.id(); + } +} + //static LLFloater* LLFloaterWebContent::create( Params p) { @@ -139,14 +139,7 @@ LLFloater* LLFloaterWebContent::create( Params p) } S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit"); - - LLSD sd; - sd["target"] = p.target; - if(LLFloaterReg::findInstance(p.window_class, sd) != NULL) - { - // There's already a web browser for this tag, so we won't be opening a new window. - } - else if(browser_window_limit != 0) + if(browser_window_limit != 0) { // showInstance will open a new window. Figure out how many web browsers are already open, // and close the least recently opened one if this will put us over the limit. @@ -166,7 +159,7 @@ LLFloater* LLFloaterWebContent::create( Params p) } } - return LLFloaterReg::showInstance(p.window_class, p); + return new LLFloaterWebContent(p); } //static diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 0bdeb114f5..1f1e49726d 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1122,16 +1122,7 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) lldebugs << "No gFloaterView for onPopuup()" << llendl; }; - // (for now) open web content floater if that's our parent, otherwise, open the current media floater - // (this will change soon) - if ( floater_name == "web_content" ) - { - LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); - } - else - { - LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); - } + LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } else { diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index fd5c3362bb..27390fca78 100755 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -72,7 +72,7 @@ public: std::string agent_name = params[0]; llinfos << "Profile, agent_name " << agent_name << llendl; std::string url = getProfileURL(agent_name); - LLWeb::loadWebURLInternal(url); + LLWeb::loadURLInternal(url); return true; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 619d74e7ac..3463eec5d8 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -288,7 +288,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterUIPreviewUtil::registerFloater(); @@ -301,7 +301,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterWindowSizeUtil::registerFloater(); LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp index 3a3d4f3881..d1120b6269 100644 --- a/indra/newview/llviewerhelp.cpp +++ b/indra/newview/llviewerhelp.cpp @@ -69,15 +69,12 @@ LLHelpHandler gHelpHandler; ////////////////////////////// // implement LLHelp interface -void LLViewerHelp::showTopic(const std::string &topic) +std::string LLViewerHelp::getURL(const std::string &topic) { // allow overriding the help server with a local help file if( gSavedSettings.getBOOL("HelpUseLocal") ) { - showHelp(); - LLFloaterHelpBrowser* helpbrowser = dynamic_cast(LLFloaterReg::getInstance("help_browser")); - helpbrowser->navigateToLocalPage( "help-offline" , "index.html" ); - return; + return "__local"; } // if the help topic is empty, use the default topic @@ -99,11 +96,12 @@ void LLViewerHelp::showTopic(const std::string &topic) } } - // work out the URL for this topic and display it - showHelp(); - - std::string helpURL = LLViewerHelpUtil::buildHelpURL( help_topic ); - setRawURL(helpURL); + return LLViewerHelpUtil::buildHelpURL( help_topic ); +} + +void LLViewerHelp::showTopic(const std::string& topic) +{ + LLFloaterReg::showInstance("help_browser", topic); } std::string LLViewerHelp::defaultTopic() @@ -146,23 +144,4 @@ std::string LLViewerHelp::getTopicFromFocus() return defaultTopic(); } -// static -void LLViewerHelp::showHelp() -{ - LLFloaterReg::showInstance("help_browser"); -} - -// static -void LLViewerHelp::setRawURL(std::string url) -{ - LLFloaterHelpBrowser* helpbrowser = dynamic_cast(LLFloaterReg::getInstance("help_browser")); - if (helpbrowser) - { - helpbrowser->openMedia(url); - } - else - { - llwarns << "Eep, help_browser floater not found" << llendl; - } -} diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h index 7612986227..a983012e2e 100644 --- a/indra/newview/llviewerhelp.h +++ b/indra/newview/llviewerhelp.h @@ -45,6 +45,8 @@ class LLViewerHelp : public LLHelp, public LLSingleton /// display the specified help topic in the help viewer /*virtual*/ void showTopic(const std::string &topic); + std::string getURL(const std::string& topic); + // return topic derived from viewer UI focus, else default topic std::string getTopicFromFocus(); @@ -56,10 +58,6 @@ class LLViewerHelp : public LLHelp, public LLSingleton // return topic to use for the top-level help, invoked by F1 /*virtual*/ std::string f1HelpTopic(); - - private: - static void showHelp(); // make sure help UI is visible & raised - static void setRawURL(std::string url); // send URL to help UI }; #endif // header guard diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fbfde711a9..bc0f38dd77 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5370,6 +5370,34 @@ class LLAvatarAddFriend : public view_listener_t } }; + +class LLAvatarToggleMyProfile : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID()); + if (LLFloater::isMinimized(instance)) + { + instance->setMinimized(FALSE); + instance->setFocus(TRUE); + } + else if (!LLFloater::isShown(instance)) + { + LLAvatarActions::showProfile(gAgent.getID()); + } + else if (!instance->hasFocus() && !instance->getIsChrome()) + { + instance->setFocus(TRUE); + } + else + { + instance->closeFloater(); + } + return true; + } +}; + + class LLAvatarAddContact : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -7229,7 +7257,7 @@ void handle_web_browser_test(const LLSD& param) void handle_web_content_test(const LLSD& param) { std::string url = param.asString(); - LLWeb::loadWebURLInternal(url); + LLWeb::loadURLInternal(url); } void handle_buy_currency_test(void*) @@ -8165,6 +8193,8 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call"); enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall)); view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); + view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); + enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::profileVisible, gAgent.getID())); view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2)); diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 6f7115ff6d..7bc5453688 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -125,7 +125,9 @@ void LLWeb::loadURLInternal(const std::string &url, const std::string& target, c // Explicitly open a Web URL using the Web content floater void LLWeb::loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid) { - LLFloaterWebContent::create(LLFloaterWebContent::Params().url(url).target(target).id(uuid)); + LLFloaterWebContent::Params p; + p.url(url).target(target).id(uuid); + LLFloaterReg::showInstance("web_content", p); } // static diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index dc5958e57f..376abc0ece 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -46,21 +46,19 @@ public: static void loadURL(const std::string& url, const std::string& target, const std::string& uuid = LLStringUtil::null); static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); } /// Load the given url in the user's preferred web browser - static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); } - static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); } + static void loadURL(const char* url, const std::string& target = LLStringUtil::null) { loadURL( ll_safe_string(url), target); } /// Load the given url in the Second Life internal web browser static void loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null); - static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); } + static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null, LLStringUtil::null);} /// Load the given url in the operating system's web browser, async if we want to return immediately /// before browser has spawned - static void loadURLExternal(const std::string& url) { loadURLExternal(url, LLStringUtil::null); }; + static void loadURLExternal(const std::string& url) {loadURLExternal(url, LLStringUtil::null);} static void loadURLExternal(const std::string& url, const std::string& uuid); static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null); // Explicitly open a Web URL using the Web content floater vs. the more general media browser static void loadWebURL(const std::string& url, const std::string& target, const std::string& uuid); - static void loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid); - static void loadWebURLInternal(const std::string &url) { loadWebURLInternal(url, LLStringUtil::null, LLStringUtil::null); } + static void loadWebURLInternal(const std::string &url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null); /// Returns escaped url (eg, " " to "%20") - used by all loadURL methods static std::string escapeURL(const std::string& url); -- cgit v1.2.3 From a530382c257809c6ee4371156f332efaaa0e23d9 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:19:16 -0700 Subject: added newline --- indra/newview/lltoolbarview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 318bede6f0..7977faeab7 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -455,4 +455,4 @@ void LLToolBarView::onEndDrag() gToolBarView->mDragToolbar->addCommand(gToolBarView->mDragCommand,gToolBarView->mDragRank); } stopDragTool(); -} \ No newline at end of file +} -- cgit v1.2.3 From fd1a688f463703ec78a399b35fed19b3d907c91b Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:21:01 -0700 Subject: fixed bad merge --- indra/llui/lltoolbar.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index ca04a0e5d5..321064a0fd 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), -- cgit v1.2.3 From 3211c6e3089b03d73f2e260be4037304660f834d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 11 Oct 2011 00:26:03 -0500 Subject: SH-2240 WIP on removing lots of string comparisons that were added to deal with exploding amounts of non-built-in GL state --- indra/llrender/llglslshader.cpp | 26 +- indra/llrender/llglslshader.h | 2 + indra/llrender/llrender.cpp | 49 ++-- indra/llrender/llshadermgr.cpp | 174 ++++++++++++ indra/llrender/llshadermgr.h | 125 +++++++++ indra/newview/llviewercontrol.cpp | 1 + indra/newview/llviewerdisplay.cpp | 1 + indra/newview/llviewershadermgr.cpp | 77 +----- indra/newview/llviewershadermgr.h | 45 --- indra/newview/llwlparamset.cpp | 4 + indra/newview/pipeline.cpp | 538 +++++++++++++++++++++++------------- indra/newview/pipeline.h | 74 +++++ 12 files changed, 772 insertions(+), 344 deletions(-) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index ddadf07d73..bbb62ea3c1 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -320,7 +320,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++) { if ( (mUniform[i] == -1) - && (LLShaderMgr::instance()->mReservedUniforms[i].compare(0, length, name, LLShaderMgr::instance()->mReservedUniforms[i].length()) == 0)) + && (LLShaderMgr::instance()->mReservedUniforms[i] == name)) { //found it mUniform[i] = location; @@ -334,7 +334,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector * uniforms) for (U32 i = 0; i < uniforms->size(); i++) { if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1) - && ((*uniforms)[i].compare(0, length, name, (*uniforms)[i].length()) == 0)) + && ((*uniforms)[i] == name)) { //found it mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location; @@ -762,8 +762,12 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c } } +static LLFastTimer::DeclareTimer FTM_UNIFORM_LOCATION("Get Uniform Location"); + GLint LLGLSLShader::getUniformLocation(const string& uniform) { + LLFastTimer t(FTM_UNIFORM_LOCATION); + GLint ret = -1; if (mProgramObject > 0) { @@ -783,13 +787,19 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform) } } - /*if (gDebugGL) + return ret; +} + +GLint LLGLSLShader::getUniformLocation(U32 index) +{ + LLFastTimer t(FTM_UNIFORM_LOCATION); + + GLint ret = -1; + if (mProgramObject > 0) { - if (ret == -1 && ret != glGetUniformLocationARB(mProgramObject, uniform.c_str())) - { - llerrs << "Uniform map invalid." << llendl; - } - }*/ + llassert(index < mUniform.size()); + return mUniform[index]; + } return ret; } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index beef57796d..eb19599eca 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -114,6 +114,8 @@ public: void vertexAttrib4fv(U32 index, GLfloat* v); GLint getUniformLocation(const std::string& uniform); + GLint getUniformLocation(U32 index); + GLint getAttribLocation(U32 attrib); GLint mapUniformTextureChannel(GLint location, GLenum type); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index c73701bbcc..afb19fce55 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -34,6 +34,7 @@ #include "llimagegl.h" #include "llrendertarget.h" #include "lltexture.h" +#include "llshadermgr.h" LLRender gGL; @@ -1127,13 +1128,13 @@ void LLRender::syncLightState() diffuse[i].set(light->mDiffuse.mV); } - shader->uniform4fv("light_position", 8, position[0].mV); - shader->uniform3fv("light_direction", 8, direction[0].mV); - shader->uniform3fv("light_attenuation", 8, attenuation[0].mV); - shader->uniform3fv("light_diffuse", 8, diffuse[0].mV); - shader->uniform4fv("light_ambient", 1, mAmbientLightColor.mV); + shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV); + shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, 8, direction[0].mV); + shader->uniform3fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV); + shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV); + shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV); //HACK -- duplicate sunlight color for compatibility with drivers that can't deal with multiple shader objects referencing the same uniform - shader->uniform4fv("sunlight_color", 1, diffuse[0].mV); + shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV); } } @@ -1151,14 +1152,14 @@ void LLRender::syncMatrices() GL_TEXTURE, }; - std::string name[] = + U32 name[] = { - "modelview_matrix", - "projection_matrix", - "texture_matrix0", - "texture_matrix1", - "texture_matrix2", - "texture_matrix3", + LLShaderMgr::MODELVIEW_MATRIX, + LLShaderMgr::PROJECTION_MATRIX, + LLShaderMgr::TEXTURE_MATRIX0, + LLShaderMgr::TEXTURE_MATRIX1, + LLShaderMgr::TEXTURE_MATRIX2, + LLShaderMgr::TEXTURE_MATRIX3, }; LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; @@ -1185,7 +1186,7 @@ void LLRender::syncMatrices() shader->mMatHash[i] = mMatHash[i]; //update normal matrix - S32 loc = shader->getUniformLocation("normal_matrix"); + S32 loc = shader->getUniformLocation(LLShaderMgr::NORMAL_MATRIX); if (loc > -1) { if (cached_normal_hash != mMatHash[i]) @@ -1203,12 +1204,12 @@ void LLRender::syncMatrices() norm.m[8], norm.m[9], norm.m[10] }; - shader->uniformMatrix3fv("normal_matrix", 1, GL_FALSE, norm_mat); + shader->uniformMatrix3fv(LLShaderMgr::NORMAL_MATRIX, 1, GL_FALSE, norm_mat); } //update MVP matrix mvp_done = true; - loc = shader->getUniformLocation("modelview_projection_matrix"); + loc = shader->getUniformLocation(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX); if (loc > -1) { U32 proj = MM_PROJECTION; @@ -1221,7 +1222,7 @@ void LLRender::syncMatrices() cached_mvp_proj_hash = mMatHash[MM_PROJECTION]; } - shader->uniformMatrix4fv("modelview_projection_matrix", 1, GL_FALSE, cached_mvp.m); + shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m); } } @@ -1237,7 +1238,7 @@ void LLRender::syncMatrices() if (!mvp_done) { //update MVP matrix - S32 loc = shader->getUniformLocation("modelview_projection_matrix"); + S32 loc = shader->getUniformLocation(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX); if (loc > -1) { if (cached_mvp_mdv_hash != mMatHash[i] || cached_mvp_proj_hash != mMatHash[MM_PROJECTION]) @@ -1249,7 +1250,7 @@ void LLRender::syncMatrices() cached_mvp_proj_hash = mMatHash[MM_PROJECTION]; } - shader->uniformMatrix4fv("modelview_projection_matrix", 1, GL_FALSE, cached_mvp.m); + shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m); } } } @@ -2176,7 +2177,7 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) if (shader) { - shader->uniform4f("color", r,g,b,1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,1.f); } else { @@ -2191,7 +2192,7 @@ void LLRender::diffuseColor3fv(const F32* c) if (shader) { - shader->uniform4f("color", c[0], c[1], c[2], 1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0], c[1], c[2], 1.f); } else { @@ -2206,7 +2207,7 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) if (shader) { - shader->uniform4f("color", r,g,b,a); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,a); } else { @@ -2221,7 +2222,7 @@ void LLRender::diffuseColor4fv(const F32* c) if (shader) { - shader->uniform4fv("color", 1, c); + shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, c); } else { @@ -2236,7 +2237,7 @@ void LLRender::diffuseColor4ubv(const U8* c) if (shader) { - shader->uniform4f("color", c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); } else { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 16180c6831..0a99c66d09 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -897,3 +897,177 @@ BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj) return success; } +//virtual +void LLShaderMgr::initAttribsAndUniforms() +{ + //MUST match order of enum in LLVertexBuffer.h + mReservedAttribs.push_back("position"); + mReservedAttribs.push_back("normal"); + mReservedAttribs.push_back("texcoord0"); + mReservedAttribs.push_back("texcoord1"); + mReservedAttribs.push_back("texcoord2"); + mReservedAttribs.push_back("texcoord3"); + mReservedAttribs.push_back("diffuse_color"); + mReservedAttribs.push_back("emissive"); + mReservedAttribs.push_back("binormal"); + mReservedAttribs.push_back("weight"); + mReservedAttribs.push_back("weight4"); + mReservedAttribs.push_back("clothing"); + mReservedAttribs.push_back("texture_index"); + + //matrix state + mReservedUniforms.push_back("modelview_matrix"); + mReservedUniforms.push_back("projection_matrix"); + mReservedUniforms.push_back("inv_proj"); + mReservedUniforms.push_back("modelview_projection_matrix"); + mReservedUniforms.push_back("normal_matrix"); + mReservedUniforms.push_back("texture_matrix0"); + mReservedUniforms.push_back("texture_matrix1"); + mReservedUniforms.push_back("texture_matrix2"); + mReservedUniforms.push_back("texture_matrix3"); + llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_MATRIX3+1); + + mReservedUniforms.push_back("viewport"); + + mReservedUniforms.push_back("light_position"); + mReservedUniforms.push_back("light_direction"); + mReservedUniforms.push_back("light_attenuation"); + mReservedUniforms.push_back("light_diffuse"); + mReservedUniforms.push_back("light_ambient"); + mReservedUniforms.push_back("light_count"); + mReservedUniforms.push_back("light"); + mReservedUniforms.push_back("light_col"); + mReservedUniforms.push_back("far_z"); + + llassert(mReservedUniforms.size() == LLShaderMgr::MULTI_LIGHT_FAR_Z+1); + + + mReservedUniforms.push_back("proj_mat"); + mReservedUniforms.push_back("proj_near"); + mReservedUniforms.push_back("proj_p"); + mReservedUniforms.push_back("proj_n"); + mReservedUniforms.push_back("proj_origin"); + mReservedUniforms.push_back("proj_range"); + mReservedUniforms.push_back("proj_ambiance"); + mReservedUniforms.push_back("proj_shadow_idx"); + mReservedUniforms.push_back("shadow_fade"); + mReservedUniforms.push_back("proj_focus"); + mReservedUniforms.push_back("proj_lod"); + mReservedUniforms.push_back("proj_ambient_lod"); + + llassert(mReservedUniforms.size() == LLShaderMgr::PROJECTOR_AMBIENT_LOD+1); + + mReservedUniforms.push_back("color"); + mReservedUniforms.push_back("highlight_color"); + + mReservedUniforms.push_back("diffuseMap"); + mReservedUniforms.push_back("specularMap"); + mReservedUniforms.push_back("bumpMap"); + mReservedUniforms.push_back("environmentMap"); + mReservedUniforms.push_back("cloude_noise_texture"); + mReservedUniforms.push_back("fullbright"); + mReservedUniforms.push_back("lightnorm"); + mReservedUniforms.push_back("sunlight_color"); + mReservedUniforms.push_back("ambient"); + mReservedUniforms.push_back("blue_horizon"); + mReservedUniforms.push_back("blue_density"); + mReservedUniforms.push_back("haze_horizon"); + mReservedUniforms.push_back("haze_density"); + mReservedUniforms.push_back("cloud_shadow"); + mReservedUniforms.push_back("density_multiplier"); + mReservedUniforms.push_back("distance_multiplier"); + mReservedUniforms.push_back("max_y"); + mReservedUniforms.push_back("glow"); + mReservedUniforms.push_back("cloud_color"); + mReservedUniforms.push_back("cloud_pos_density1"); + mReservedUniforms.push_back("cloud_pos_density2"); + mReservedUniforms.push_back("cloud_scale"); + mReservedUniforms.push_back("gamma"); + mReservedUniforms.push_back("scene_light_strength"); + + llassert(mReservedUniforms.size() == LLShaderMgr::SCENE_LIGHT_STRENGTH+1); + + mReservedUniforms.push_back("center"); + mReservedUniforms.push_back("size"); + mReservedUniforms.push_back("falloff"); + + + mReservedUniforms.push_back("minLuminance"); + mReservedUniforms.push_back("maxExtractAlpha"); + mReservedUniforms.push_back("lumWeights"); + mReservedUniforms.push_back("warmthWeights"); + mReservedUniforms.push_back("warmthAmount"); + mReservedUniforms.push_back("glowStrength"); + mReservedUniforms.push_back("glowDelta"); + + llassert(mReservedUniforms.size() == LLShaderMgr::GLOW_DELTA+1); + + mReservedUniforms.push_back("shadow_matrix"); + mReservedUniforms.push_back("env_mat"); + mReservedUniforms.push_back("shadow_clip"); + mReservedUniforms.push_back("sun_wash"); + mReservedUniforms.push_back("shadow_noise"); + mReservedUniforms.push_back("blur_size"); + mReservedUniforms.push_back("ssao_radius"); + mReservedUniforms.push_back("ssao_max_radius"); + mReservedUniforms.push_back("ssao_factor"); + mReservedUniforms.push_back("ssao_factor_inv"); + mReservedUniforms.push_back("ssao_effect_mat"); + mReservedUniforms.push_back("screen_res"); + mReservedUniforms.push_back("near_clip"); + mReservedUniforms.push_back("shadow_offset"); + mReservedUniforms.push_back("shadow_bias"); + mReservedUniforms.push_back("spot_shadow_bias"); + mReservedUniforms.push_back("spot_shadow_offset"); + mReservedUniforms.push_back("sun_dir"); + mReservedUniforms.push_back("shadow_res"); + mReservedUniforms.push_back("proj_shadow_res"); + mReservedUniforms.push_back("depth_cutoff"); + mReservedUniforms.push_back("norm_cutoff"); + + llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_NORM_CUTOFF+1); + + mReservedUniforms.push_back("tc_scale"); + mReservedUniforms.push_back("rcp_screen_res"); + mReservedUniforms.push_back("rcp_frame_opt"); + mReservedUniforms.push_back("rcp_frame_opt2"); + + mReservedUniforms.push_back("focal_distance"); + mReservedUniforms.push_back("blur_constant"); + mReservedUniforms.push_back("tan_pixel_angle"); + mReservedUniforms.push_back("magnification"); + + mReservedUniforms.push_back("depthMap"); + mReservedUniforms.push_back("shadowMap0"); + mReservedUniforms.push_back("shadowMap1"); + mReservedUniforms.push_back("shadowMap2"); + mReservedUniforms.push_back("shadowMap3"); + mReservedUniforms.push_back("shadowMap4"); + mReservedUniforms.push_back("shadowMap5"); + + llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW5+1); + + mReservedUniforms.push_back("normalMap"); + mReservedUniforms.push_back("positionMap"); + mReservedUniforms.push_back("diffuseRect"); + mReservedUniforms.push_back("specularRect"); + mReservedUniforms.push_back("noiseMap"); + mReservedUniforms.push_back("lightFunc"); + mReservedUniforms.push_back("lightMap"); + mReservedUniforms.push_back("bloomMap"); + mReservedUniforms.push_back("projectionMap"); + + llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); + + std::set dupe_check; + + for (U32 i = 0; i < mReservedUniforms.size(); ++i) + { + if (dupe_check.find(mReservedUniforms[i]) != dupe_check.end()) + { + llerrs << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << llendl; + } + dupe_check.insert(mReservedUniforms[i]); + } +} + diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 2f30103811..9cc2f1bd7f 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -36,9 +36,134 @@ public: LLShaderMgr(); virtual ~LLShaderMgr(); + typedef enum + { + MODELVIEW_MATRIX = 0, + PROJECTION_MATRIX, + INVERSE_PROJECTION_MATRIX, + MODELVIEW_PROJECTION_MATRIX, + NORMAL_MATRIX, + TEXTURE_MATRIX0, + TEXTURE_MATRIX1, + TEXTURE_MATRIX2, + TEXTURE_MATRIX3, + VIEWPORT, + LIGHT_POSITION, + LIGHT_DIRECTION, + LIGHT_ATTENUATION, + LIGHT_DIFFUSE, + LIGHT_AMBIENT, + MULTI_LIGHT_COUNT, + MULTI_LIGHT, + MULTI_LIGHT_COL, + MULTI_LIGHT_FAR_Z, + PROJECTOR_MATRIX, + PROJECTOR_NEAR, + PROJECTOR_P, + PROJECTOR_N, + PROJECTOR_ORIGIN, + PROJECTOR_RANGE, + PROJECTOR_AMBIANCE, + PROJECTOR_SHADOW_INDEX, + PROJECTOR_SHADOW_FADE, + PROJECTOR_FOCUS, + PROJECTOR_LOD, + PROJECTOR_AMBIENT_LOD, + DIFFUSE_COLOR, + HIGHLIGHT_COLOR, + DIFFUSE_MAP, + SPECULAR_MAP, + BUMP_MAP, + ENVIRONMENT_MAP, + CLOUD_NOISE_MAP, + FULLBRIGHT, + LIGHTNORM, + SUNLIGHT_COLOR, + AMBIENT, + BLUE_HORIZON, + BLUE_DENSITY, + HAZE_HORIZON, + HAZE_DENSITY, + CLOUD_SHADOW, + DENSITY_MULTIPLIER, + DISTANCE_MULTIPLIER, + MAX_Y, + GLOW, + CLOUD_COLOR, + CLOUD_POS_DENSITY1, + CLOUD_POS_DENSITY2, + CLOUD_SCALE, + GAMMA, + SCENE_LIGHT_STRENGTH, + LIGHT_CENTER, + LIGHT_SIZE, + LIGHT_FALLOFF, + + GLOW_MIN_LUMINANCE, + GLOW_MAX_EXTRACT_ALPHA, + GLOW_LUM_WEIGHTS, + GLOW_WARMTH_WEIGHTS, + GLOW_WARMTH_AMOUNT, + GLOW_STRENGTH, + GLOW_DELTA, + + DEFERRED_SHADOW_MATRIX, + DEFERRED_ENV_MAT, + DEFERRED_SHADOW_CLIP, + DEFERRED_SUN_WASH, + DEFERRED_SHADOW_NOISE, + DEFERRED_BLUR_SIZE, + DEFERRED_SSAO_RADIUS, + DEFERRED_SSAO_MAX_RADIUS, + DEFERRED_SSAO_FACTOR, + DEFERRED_SSAO_FACTOR_INV, + DEFERRED_SSAO_EFFECT_MAT, + DEFERRED_SCREEN_RES, + DEFERRED_NEAR_CLIP, + DEFERRED_SHADOW_OFFSET, + DEFERRED_SHADOW_BIAS, + DEFERRED_SPOT_SHADOW_BIAS, + DEFERRED_SPOT_SHADOW_OFFSET, + DEFERRED_SUN_DIR, + DEFERRED_SHADOW_RES, + DEFERRED_PROJ_SHADOW_RES, + DEFERRED_DEPTH_CUTOFF, + DEFERRED_NORM_CUTOFF, + + FXAA_TC_SCALE, + FXAA_RCP_SCREEN_RES, + FXAA_RCP_FRAME_OPT, + FXAA_RCP_FRAME_OPT2, + + DOF_FOCAL_DISTANCE, + DOF_BLUR_CONSTANT, + DOF_TAN_PIXEL_ANGLE, + DOF_MAGNIFICATION, + + DEFERRED_DEPTH, + DEFERRED_SHADOW0, + DEFERRED_SHADOW1, + DEFERRED_SHADOW2, + DEFERRED_SHADOW3, + DEFERRED_SHADOW4, + DEFERRED_SHADOW5, + DEFERRED_NORMAL, + DEFERRED_POSITION, + DEFERRED_DIFFUSE, + DEFERRED_SPECULAR, + DEFERRED_NOISE, + DEFERRED_LIGHTFUNC, + DEFERRED_LIGHT, + DEFERRED_BLOOM, + DEFERRED_PROJECTION, + END_RESERVED_UNIFORMS + } eGLSLReservedUniforms; + // singleton pattern implementation static LLShaderMgr * instance(); + virtual void initAttribsAndUniforms(void); + BOOL attachShaderFeatures(LLGLSLShader * shader); void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE); BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 5b178f82d8..3692da64fc 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -388,6 +388,7 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue) LLRenderTarget::sUseFBO = newvalue.asBoolean(); if (gPipeline.isInit()) { + LLPipeline::refreshCachedSettings(); gPipeline.updateRenderDeferred(); gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 7220f2a20f..1832416a4b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -862,6 +862,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // gGL.popMatrix(); //} + LLPipeline::refreshCachedSettings(); LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; LLPipeline::refreshRenderDeferred(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ac489e0caf..8bc573135c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -195,6 +195,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mMaxAvatarShaderLevel(0) { /// Make sure WL Sky is the first program + //ONLY shaders that need WL Param management should be added here mShaderList.push_back(&gWLSkyProgram); mShaderList.push_back(&gWLCloudProgram); mShaderList.push_back(&gAvatarProgram); @@ -209,16 +210,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram); mShaderList.push_back(&gObjectSimpleAlphaMaskProgram); mShaderList.push_back(&gObjectBumpProgram); - mShaderList.push_back(&gUIProgram); - mShaderList.push_back(&gCustomAlphaProgram); - mShaderList.push_back(&gGlowCombineProgram); - mShaderList.push_back(&gGlowCombineFXAAProgram); - mShaderList.push_back(&gTwoTextureAddProgram); - mShaderList.push_back(&gOneTextureNoColorProgram); - mShaderList.push_back(&gSolidColorProgram); - mShaderList.push_back(&gOcclusionProgram); - mShaderList.push_back(&gDebugProgram); - mShaderList.push_back(&gAlphaMaskProgram); mShaderList.push_back(&gObjectEmissiveProgram); mShaderList.push_back(&gObjectEmissiveWaterProgram); mShaderList.push_back(&gObjectFullbrightProgram); @@ -260,23 +251,16 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectShinyNonIndexedWaterProgram); mShaderList.push_back(&gUnderWaterProgram); mShaderList.push_back(&gDeferredSunProgram); - mShaderList.push_back(&gDeferredBlurLightProgram); mShaderList.push_back(&gDeferredSoftenProgram); - mShaderList.push_back(&gDeferredLightProgram); - mShaderList.push_back(&gDeferredMultiLightProgram); mShaderList.push_back(&gDeferredAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); mShaderList.push_back(&gDeferredFullbrightProgram); mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); - mShaderList.push_back(&gDeferredPostProgram); - mShaderList.push_back(&gFXAAProgram); mShaderList.push_back(&gDeferredWaterProgram); mShaderList.push_back(&gDeferredAvatarAlphaProgram); mShaderList.push_back(&gDeferredWLSkyProgram); mShaderList.push_back(&gDeferredWLCloudProgram); - mShaderList.push_back(&gDeferredStarProgram); - mShaderList.push_back(&gNormalMapGenProgram); } LLViewerShaderMgr::~LLViewerShaderMgr() @@ -300,70 +284,13 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) { if (mReservedAttribs.empty()) { - //MUST match order of enum in LLVertexBuffer.h - mReservedAttribs.push_back("position"); - mReservedAttribs.push_back("normal"); - mReservedAttribs.push_back("texcoord0"); - mReservedAttribs.push_back("texcoord1"); - mReservedAttribs.push_back("texcoord2"); - mReservedAttribs.push_back("texcoord3"); - mReservedAttribs.push_back("diffuse_color"); - mReservedAttribs.push_back("emissive"); - mReservedAttribs.push_back("binormal"); - mReservedAttribs.push_back("weight"); - mReservedAttribs.push_back("weight4"); - mReservedAttribs.push_back("clothing"); - mReservedAttribs.push_back("texture_index"); + LLShaderMgr::initAttribsAndUniforms(); mAvatarUniforms.push_back("matrixPalette"); mAvatarUniforms.push_back("gWindDir"); mAvatarUniforms.push_back("gSinWaveParams"); mAvatarUniforms.push_back("gGravity"); - mReservedUniforms.reserve(24); - mReservedUniforms.push_back("diffuseMap"); - mReservedUniforms.push_back("specularMap"); - mReservedUniforms.push_back("bumpMap"); - mReservedUniforms.push_back("environmentMap"); - mReservedUniforms.push_back("cloude_noise_texture"); - mReservedUniforms.push_back("fullbright"); - mReservedUniforms.push_back("lightnorm"); - mReservedUniforms.push_back("sunlight_color"); - mReservedUniforms.push_back("ambient"); - mReservedUniforms.push_back("blue_horizon"); - mReservedUniforms.push_back("blue_density"); - mReservedUniforms.push_back("haze_horizon"); - mReservedUniforms.push_back("haze_density"); - mReservedUniforms.push_back("cloud_shadow"); - mReservedUniforms.push_back("density_multiplier"); - mReservedUniforms.push_back("distance_multiplier"); - mReservedUniforms.push_back("max_y"); - mReservedUniforms.push_back("glow"); - mReservedUniforms.push_back("cloud_color"); - mReservedUniforms.push_back("cloud_pos_density1"); - mReservedUniforms.push_back("cloud_pos_density2"); - mReservedUniforms.push_back("cloud_scale"); - mReservedUniforms.push_back("gamma"); - mReservedUniforms.push_back("scene_light_strength"); - - mReservedUniforms.push_back("depthMap"); - mReservedUniforms.push_back("shadowMap0"); - mReservedUniforms.push_back("shadowMap1"); - mReservedUniforms.push_back("shadowMap2"); - mReservedUniforms.push_back("shadowMap3"); - mReservedUniforms.push_back("shadowMap4"); - mReservedUniforms.push_back("shadowMap5"); - - mReservedUniforms.push_back("normalMap"); - mReservedUniforms.push_back("positionMap"); - mReservedUniforms.push_back("diffuseRect"); - mReservedUniforms.push_back("specularRect"); - mReservedUniforms.push_back("noiseMap"); - mReservedUniforms.push_back("lightFunc"); - mReservedUniforms.push_back("lightMap"); - mReservedUniforms.push_back("bloomMap"); - mReservedUniforms.push_back("projectionMap"); - mWLUniforms.push_back("camPosLocal"); mTerrainUniforms.reserve(5); diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 5bcdf11be5..01f8c3987c 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -71,51 +71,6 @@ public: SHADER_COUNT }; - typedef enum - { - DIFFUSE_MAP = 0, - SPECULAR_MAP, - BUMP_MAP, - ENVIRONMENT_MAP, - CLOUD_NOISE_MAP, - FULLBRIGHT, - LIGHTNORM, - SUNLIGHT_COLOR, - AMBIENT, - BLUE_HORIZON, - BLUE_DENSITY, - HAZE_HORIZON, - HAZE_DENSITY, - CLOUD_SHADOW, - DENSITY_MULTIPLIER, - DISTANCE_MULTIPLIER, - MAX_Y, - GLOW, - CLOUD_COLOR, - CLOUD_POS_DENSITY1, - CLOUD_POS_DENSITY2, - CLOUD_SCALE, - GAMMA, - SCENE_LIGHT_STRENGTH, - DEFERRED_DEPTH, - DEFERRED_SHADOW0, - DEFERRED_SHADOW1, - DEFERRED_SHADOW2, - DEFERRED_SHADOW3, - DEFERRED_SHADOW4, - DEFERRED_SHADOW5, - DEFERRED_NORMAL, - DEFERRED_POSITION, - DEFERRED_DIFFUSE, - DEFERRED_SPECULAR, - DEFERRED_NOISE, - DEFERRED_LIGHTFUNC, - DEFERRED_LIGHT, - DEFERRED_BLOOM, - DEFERRED_PROJECTION, - END_RESERVED_UNIFORMS - } eGLSLReservedUniforms; - typedef enum { SHINY_ORIGIN = END_RESERVED_UNIFORMS diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index 22fba90f65..4a1db3d26c 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -69,12 +69,16 @@ LLWLParamSet::LLWLParamSet(void) : */ } +static LLFastTimer::DeclareTimer FTM_WL_PARAM_UPDATE("WL Param Update"); + void LLWLParamSet::update(LLGLSLShader * shader) const { for(LLSD::map_const_iterator i = mParamValues.beginMap(); i != mParamValues.endMap(); ++i) { + LLFastTimer t(FTM_WL_PARAM_UPDATE); + const std::string& param = i->first; if( param == "star_brightness" || param == "preset_num" || param == "sun_angle" || diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 42873dbca8..e4125c8dc8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -113,6 +113,79 @@ //#define DEBUG_INDICES #endif +//cached settings +BOOL LLPipeline::RenderAvatarVP; +BOOL LLPipeline::VertexShaderEnable; +BOOL LLPipeline::WindLightUseAtmosShaders; +BOOL LLPipeline::RenderDeferred; +F32 LLPipeline::RenderDeferredSunWash; +U32 LLPipeline::RenderFSAASamples; +U32 LLPipeline::RenderResolutionDivisor; +BOOL LLPipeline::RenderUIBuffer; +S32 LLPipeline::RenderShadowDetail; +BOOL LLPipeline::RenderDeferredSSAO; +F32 LLPipeline::RenderShadowResolutionScale; +BOOL LLPipeline::RenderLocalLights; +BOOL LLPipeline::RenderDelayCreation; +BOOL LLPipeline::RenderAnimateRes; +BOOL LLPipeline::FreezeTime; +S32 LLPipeline::DebugBeaconLineWidth; +F32 LLPipeline::RenderHighlightBrightness; +LLColor4 LLPipeline::RenderHighlightColor; +F32 LLPipeline::RenderHighlightThickness; +BOOL LLPipeline::RenderSpotLightsInNondeferred; +LLColor4 LLPipeline::PreviewAmbientColor; +LLColor4 LLPipeline::PreviewDiffuse0; +LLColor4 LLPipeline::PreviewSpecular0; +LLColor4 LLPipeline::PreviewDiffuse1; +LLColor4 LLPipeline::PreviewSpecular1; +LLColor4 LLPipeline::PreviewDiffuse2; +LLColor4 LLPipeline::PreviewSpecular2; +LLVector3 LLPipeline::PreviewDirection0; +LLVector3 LLPipeline::PreviewDirection1; +LLVector3 LLPipeline::PreviewDirection2; +F32 LLPipeline::RenderGlowMinLuminance; +F32 LLPipeline::RenderGlowMaxExtractAlpha; +F32 LLPipeline::RenderGlowWarmthAmount; +LLVector3 LLPipeline::RenderGlowLumWeights; +LLVector3 LLPipeline::RenderGlowWarmthWeights; +S32 LLPipeline::RenderGlowResolutionPow; +S32 LLPipeline::RenderGlowIterations; +F32 LLPipeline::RenderGlowWidth; +F32 LLPipeline::RenderGlowStrength; +BOOL LLPipeline::RenderDepthOfField; +F32 LLPipeline::CameraFocusTransitionTime; +F32 LLPipeline::CameraFNumber; +F32 LLPipeline::CameraFocalLength; +F32 LLPipeline::CameraFieldOfView; +F32 LLPipeline::RenderShadowNoise; +F32 LLPipeline::RenderShadowBlurSize; +F32 LLPipeline::RenderSSAOScale; +U32 LLPipeline::RenderSSAOMaxScale; +F32 LLPipeline::RenderSSAOFactor; +LLVector3 LLPipeline::RenderSSAOEffect; +F32 LLPipeline::RenderShadowOffsetError; +F32 LLPipeline::RenderShadowBiasError; +F32 LLPipeline::RenderShadowOffset; +F32 LLPipeline::RenderShadowBias; +F32 LLPipeline::RenderSpotShadowOffset; +F32 LLPipeline::RenderSpotShadowBias; +F32 LLPipeline::RenderEdgeDepthCutoff; +F32 LLPipeline::RenderEdgeNormCutoff; +LLVector3 LLPipeline::RenderShadowGaussian; +F32 LLPipeline::RenderShadowBlurDistFactor; +BOOL LLPipeline::RenderDeferredAtmospheric; +S32 LLPipeline::RenderReflectionDetail; +F32 LLPipeline::RenderHighlightFadeTime; +LLVector3 LLPipeline::RenderShadowClipPlanes; +LLVector3 LLPipeline::RenderShadowOrthoClipPlanes; +LLVector3 LLPipeline::RenderShadowNearDist; +F32 LLPipeline::RenderFarClip; +LLVector3 LLPipeline::RenderShadowSplitExponent; +F32 LLPipeline::RenderShadowErrorCutoff; +F32 LLPipeline::RenderShadowFOVCutoff; +BOOL LLPipeline::CameraOffset; + const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f; const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; @@ -371,6 +444,8 @@ void LLPipeline::init() { LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT); + refreshCachedSettings(); + gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); @@ -588,7 +663,7 @@ void LLPipeline::allocatePhysicsBuffer() void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { - U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples")); + U32 samples = gGLManager.getNumFBOFSAASamples(RenderFSAASamples); //try to allocate screen buffers at requested resolution and samples // - on failure, shrink number of samples and try again @@ -638,7 +713,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) mScreenWidth = resX; mScreenHeight = resY; - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + U32 res_mod = RenderResolutionDivisor; if (res_mod > 1 && res_mod < resX && res_mod < resY) { @@ -646,7 +721,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) resY /= res_mod; } - if (gSavedSettings.getBOOL("RenderUIBuffer")) + if (RenderUIBuffer) { if (!mUIScreen.allocate(resX,resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) { @@ -656,8 +731,8 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (LLPipeline::sRenderDeferred) { - S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail"); - BOOL ssao = gSavedSettings.getBOOL("RenderDeferredSSAO"); + S32 shadow_detail = RenderShadowDetail; + BOOL ssao = RenderDeferredSSAO; //allocate deferred rendering color buffers if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; @@ -683,7 +758,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) mDeferredLight.release(); } - F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale"); + F32 scale = RenderShadowResolutionScale; if (shadow_detail > 0) { //allocate 4 sun shadow maps @@ -749,12 +824,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) //static void LLPipeline::updateRenderDeferred() { - BOOL deferred = ((gSavedSettings.getBOOL("RenderDeferred") && + BOOL deferred = ((RenderDeferred && LLRenderTarget::sUseFBO && - LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - gSavedSettings.getBOOL("VertexShaderEnable") && - gSavedSettings.getBOOL("RenderAvatarVP") && - gSavedSettings.getBOOL("WindLightUseAtmosShaders")) ? TRUE : FALSE) && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + VertexShaderEnable && + RenderAvatarVP && + WindLightUseAtmosShaders) ? TRUE : FALSE) && !gUseWireframe; sRenderDeferred = deferred; @@ -770,6 +845,82 @@ void LLPipeline::refreshRenderDeferred() updateRenderDeferred(); } +//static +void LLPipeline::refreshCachedSettings() +{ + VertexShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable"); + RenderAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP"); + WindLightUseAtmosShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); + RenderDeferred = gSavedSettings.getBOOL("RenderDeferred"); + RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); + RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); + RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); + RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); + RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail"); + RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO"); + RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale"); + RenderLocalLights = gSavedSettings.getBOOL("RenderLocalLights"); + RenderDelayCreation = gSavedSettings.getBOOL("RenderDelayCreation"); + RenderAnimateRes = gSavedSettings.getBOOL("RenderAnimateRes"); + FreezeTime = gSavedSettings.getBOOL("FreezeTime"); + DebugBeaconLineWidth = gSavedSettings.getS32("DebugBeaconLineWidth"); + RenderHighlightBrightness = gSavedSettings.getF32("RenderHighlightBrightness"); + RenderHighlightColor = gSavedSettings.getColor4("RenderHighlightColor"); + RenderHighlightThickness = gSavedSettings.getF32("RenderHighlightThickness"); + RenderSpotLightsInNondeferred = gSavedSettings.getBOOL("RenderSpotLightsInNondeferred"); + PreviewAmbientColor = gSavedSettings.getColor4("PreviewAmbientColor"); + PreviewDiffuse0 = gSavedSettings.getColor4("PreviewDiffuse0"); + PreviewSpecular0 = gSavedSettings.getColor4("PreviewSpecular0"); + PreviewDiffuse1 = gSavedSettings.getColor4("PreviewDiffuse1"); + PreviewSpecular1 = gSavedSettings.getColor4("PreviewSpecular1"); + PreviewDiffuse2 = gSavedSettings.getColor4("PreviewDiffuse2"); + PreviewSpecular2 = gSavedSettings.getColor4("PreviewSpecular2"); + PreviewDirection0 = gSavedSettings.getVector3("PreviewDirection0"); + PreviewDirection1 = gSavedSettings.getVector3("PreviewDirection1"); + PreviewDirection2 = gSavedSettings.getVector3("PreviewDirection2"); + RenderGlowMinLuminance = gSavedSettings.getF32("RenderGlowMinLuminance"); + RenderGlowMaxExtractAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha"); + RenderGlowWarmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount"); + RenderGlowLumWeights = gSavedSettings.getVector3("RenderGlowLumWeights"); + RenderGlowWarmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights"); + RenderGlowResolutionPow = gSavedSettings.getS32("RenderGlowResolutionPow"); + RenderGlowIterations = gSavedSettings.getS32("RenderGlowIterations"); + RenderGlowWidth = gSavedSettings.getF32("RenderGlowWidth"); + RenderGlowStrength = gSavedSettings.getF32("RenderGlowStrength"); + RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField"); + CameraFocusTransitionTime = gSavedSettings.getF32("CameraFocusTransitionTime"); + CameraFNumber = gSavedSettings.getF32("CameraFNumber"); + CameraFocalLength = gSavedSettings.getF32("CameraFocalLength"); + CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView"); + RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise"); + RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize"); + RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale"); + RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale"); + RenderSSAOFactor = gSavedSettings.getF32("RenderSSAOFactor"); + RenderSSAOEffect = gSavedSettings.getVector3("RenderSSAOEffect"); + RenderShadowOffsetError = gSavedSettings.getF32("RenderShadowOffsetError"); + RenderShadowBiasError = gSavedSettings.getF32("RenderShadowBiasError"); + RenderShadowOffset = gSavedSettings.getF32("RenderShadowOffset"); + RenderShadowBias = gSavedSettings.getF32("RenderShadowBias"); + RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset"); + RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias"); + RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff"); + RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff"); + RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian"); + RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); + RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric"); + RenderReflectionDetail = gSavedSettings.getS32("RenderReflectionDetail"); + RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime"); + RenderShadowClipPlanes = gSavedSettings.getVector3("RenderShadowClipPlanes"); + RenderShadowOrthoClipPlanes = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes"); + RenderShadowNearDist = gSavedSettings.getVector3("RenderShadowNearDist"); + RenderFarClip = gSavedSettings.getF32("RenderFarClip"); + RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent"); + RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff"); + RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff"); + CameraOffset = gSavedSettings.getBOOL("CameraOffset"); +} + void LLPipeline::releaseGLBuffers() { assertInitialized(); @@ -1041,7 +1192,7 @@ S32 LLPipeline::setLightingDetail(S32 level) if (level < 0) { - if (gSavedSettings.getBOOL("RenderLocalLights")) + if (RenderLocalLights) { level = 1; } @@ -1362,7 +1513,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj) { LLMemType mt_ao(LLMemType::MTYPE_PIPELINE_ADD_OBJECT); - if (gSavedSettings.getBOOL("RenderDelayCreation")) + if (RenderDelayCreation) { mCreateQ.push_back(vobj); } @@ -1425,7 +1576,7 @@ void LLPipeline::createObject(LLViewerObject* vobj) markRebuild(drawablep, LLDrawable::REBUILD_ALL, TRUE); - if (drawablep->getVOVolume() && gSavedSettings.getBOOL("RenderAnimateRes")) + if (drawablep->getVOVolume() && RenderAnimateRes) { // fun animated res drawablep->updateXform(TRUE); @@ -1464,7 +1615,7 @@ void LLPipeline::resetFrameStats() //external functions for asynchronous updating void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep) { - if (gSavedSettings.getBOOL("FreezeTime")) + if (FreezeTime) { return; } @@ -1494,7 +1645,7 @@ void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep) void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep) { - if (gSavedSettings.getBOOL("FreezeTime")) + if (FreezeTime) { return; } @@ -1551,7 +1702,7 @@ void LLPipeline::updateMove() LLFastTimer t(FTM_UPDATE_MOVE); LLMemType mt_um(LLMemType::MTYPE_PIPELINE_UPDATE_MOVE); - if (gSavedSettings.getBOOL("FreezeTime")) + if (FreezeTime) { return; } @@ -2911,7 +3062,7 @@ void renderScriptedBeacons(LLDrawable* drawablep) { if (gPipeline.sRenderBeacons) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); } if (gPipeline.sRenderHighlight) @@ -2937,7 +3088,7 @@ void renderScriptedTouchBeacons(LLDrawable* drawablep) { if (gPipeline.sRenderBeacons) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); } if (gPipeline.sRenderHighlight) @@ -2962,7 +3113,7 @@ void renderPhysicalBeacons(LLDrawable* drawablep) { if (gPipeline.sRenderBeacons) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); } if (gPipeline.sRenderHighlight) @@ -2998,7 +3149,7 @@ void renderMOAPBeacons(LLDrawable* drawablep) { if (gPipeline.sRenderBeacons) { - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); } if (gPipeline.sRenderHighlight) @@ -3023,7 +3174,7 @@ void renderParticleBeacons(LLDrawable* drawablep) if (gPipeline.sRenderBeacons) { LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f); - gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth); } if (gPipeline.sRenderHighlight) @@ -3216,7 +3367,7 @@ void LLPipeline::postSort(LLCamera& camera) if (gPipeline.sRenderBeacons) { //pos += LLVector3(0.f, 0.f, 0.2f); - gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth); } } // now deal with highlights for all those seeable sound sources @@ -3281,7 +3432,7 @@ void render_hud_elements() if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d() // Draw the tracking overlays @@ -3368,9 +3519,9 @@ void LLPipeline::renderHighlights() gGL.begin(LLRender::TRIANGLES); - F32 scale = gSavedSettings.getF32("RenderHighlightBrightness"); - LLColor4 color = gSavedSettings.getColor4("RenderHighlightColor"); - F32 thickness = gSavedSettings.getF32("RenderHighlightThickness"); + F32 scale = RenderHighlightBrightness; + LLColor4 color = RenderHighlightColor; + F32 thickness = RenderHighlightThickness; for (S32 pass = 0; pass < 2; ++pass) { @@ -3425,7 +3576,7 @@ void LLPipeline::renderHighlights() if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { gHighlightProgram.bind(); - gHighlightProgram.uniform4f("highlight_color",1,1,1,0.5f); + gHighlightProgram.uniform4f(LLShaderMgr::HIGHLIGHT_COLOR,1,1,1,0.5f); } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) @@ -3457,7 +3608,7 @@ void LLPipeline::renderHighlights() color.setVec(1.f, 0.f, 0.f, 0.5f); if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { - gHighlightProgram.uniform4f("highlight_color",1,0,0,0.5f); + gHighlightProgram.uniform4f(LLShaderMgr::HIGHLIGHT_COLOR,1,0,0,0.5f); } int count = mHighlightFaces.size(); for (S32 i = 0; i < count; i++) @@ -3530,7 +3681,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) gGL.matrixMode(LLRender::MM_MODELVIEW); LLGLSPipeline gls_pipeline; - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2); @@ -3755,7 +3906,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) } } - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); LLVertexBuffer::unbind(); @@ -3836,7 +3987,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LLGLEnable cull(GL_CULL_FACE); - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); calcNearbyLights(camera); setupHWLights(NULL); @@ -5051,8 +5202,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light_state->setQuadraticAttenuation(0.f); } + if (light->isLightSpotlight() // directional (spot-)light - && (LLPipeline::sRenderDeferred || gSavedSettings.getBOOL("RenderSpotLightsInNondeferred"))) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on + && (LLPipeline::sRenderDeferred || RenderSpotLightsInNondeferred)) // these are only rendered as GL spotlights if we're in deferred rendering mode *or* the setting forces them on { LLVector3 spotparams = light->getSpotLightParams(); LLQuaternion quat = light->getRenderRotation(); @@ -5233,19 +5385,19 @@ void LLPipeline::enableLightsPreview() glEnable(GL_LIGHTING); } - LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor"); + LLColor4 ambient = PreviewAmbientColor; gGL.setAmbientLightColor(ambient); - LLColor4 diffuse0 = gSavedSettings.getColor4("PreviewDiffuse0"); - LLColor4 specular0 = gSavedSettings.getColor4("PreviewSpecular0"); - LLColor4 diffuse1 = gSavedSettings.getColor4("PreviewDiffuse1"); - LLColor4 specular1 = gSavedSettings.getColor4("PreviewSpecular1"); - LLColor4 diffuse2 = gSavedSettings.getColor4("PreviewDiffuse2"); - LLColor4 specular2 = gSavedSettings.getColor4("PreviewSpecular2"); + LLColor4 diffuse0 = PreviewDiffuse0; + LLColor4 specular0 = PreviewSpecular0; + LLColor4 diffuse1 = PreviewDiffuse1; + LLColor4 specular1 = PreviewSpecular1; + LLColor4 diffuse2 = PreviewDiffuse2; + LLColor4 specular2 = PreviewSpecular2; - LLVector3 dir0 = gSavedSettings.getVector3("PreviewDirection0"); - LLVector3 dir1 = gSavedSettings.getVector3("PreviewDirection1"); - LLVector3 dir2 = gSavedSettings.getVector3("PreviewDirection2"); + LLVector3 dir0 = PreviewDirection0; + LLVector3 dir1 = PreviewDirection1; + LLVector3 dir2 = PreviewDirection2; dir0.normVec(); dir1.normVec(); @@ -6085,7 +6237,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + U32 res_mod = RenderResolutionDivisor; LLVector2 tc1(0,0); LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2, @@ -6124,16 +6276,18 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } gGlowExtractProgram.bind(); - F32 minLum = llmax(gSavedSettings.getF32("RenderGlowMinLuminance"), 0.0f); - F32 maxAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha"); - F32 warmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount"); - LLVector3 lumWeights = gSavedSettings.getVector3("RenderGlowLumWeights"); - LLVector3 warmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights"); - gGlowExtractProgram.uniform1f("minLuminance", minLum); - gGlowExtractProgram.uniform1f("maxExtractAlpha", maxAlpha); - gGlowExtractProgram.uniform3f("lumWeights", lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]); - gGlowExtractProgram.uniform3f("warmthWeights", warmthWeights.mV[0], warmthWeights.mV[1], warmthWeights.mV[2]); - gGlowExtractProgram.uniform1f("warmthAmount", warmthAmount); + F32 minLum = llmax((F32) RenderGlowMinLuminance, 0.0f); + F32 maxAlpha = RenderGlowMaxExtractAlpha; + F32 warmthAmount = RenderGlowWarmthAmount; + LLVector3 lumWeights = RenderGlowLumWeights; + LLVector3 warmthWeights = RenderGlowWarmthWeights; + + + gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MIN_LUMINANCE, minLum); + gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_MAX_EXTRACT_ALPHA, maxAlpha); + gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_LUM_WEIGHTS, lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]); + gGlowExtractProgram.uniform3f(LLShaderMgr::GLOW_WARMTH_WEIGHTS, warmthWeights.mV[0], warmthWeights.mV[1], warmthWeights.mV[2]); + gGlowExtractProgram.uniform1f(LLShaderMgr::GLOW_WARMTH_AMOUNT, warmthAmount); LLGLEnable blend_on(GL_BLEND); LLGLEnable test(GL_ALPHA_TEST); @@ -6164,22 +6318,22 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) tc2.setVec(2,2); // power of two between 1 and 1024 - U32 glowResPow = gSavedSettings.getS32("RenderGlowResolutionPow"); + U32 glowResPow = RenderGlowResolutionPow; const U32 glow_res = llmax(1, llmin(1024, 1 << glowResPow)); - S32 kernel = gSavedSettings.getS32("RenderGlowIterations")*2; - F32 delta = gSavedSettings.getF32("RenderGlowWidth") / glow_res; + S32 kernel = RenderGlowIterations*2; + F32 delta = RenderGlowWidth / glow_res; // Use half the glow width if we have the res set to less than 9 so that it looks // almost the same in either case. if (glowResPow < 9) { delta *= 0.5f; } - F32 strength = gSavedSettings.getF32("RenderGlowStrength"); + F32 strength = RenderGlowStrength; gGlowProgram.bind(); - gGlowProgram.uniform1f("glowStrength", strength); + gGlowProgram.uniform1f(LLShaderMgr::GLOW_STRENGTH, strength); for (S32 i = 0; i < kernel; i++) { @@ -6200,11 +6354,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (i%2 == 0) { - gGlowProgram.uniform2f("glowDelta", delta, 0); + gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, delta, 0); } else { - gGlowProgram.uniform2f("glowDelta", 0, delta); + gGlowProgram.uniform2f(LLShaderMgr::GLOW_DELTA, 0, delta); } gGL.begin(LLRender::TRIANGLE_STRIP); @@ -6245,11 +6399,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (LLPipeline::sRenderDeferred) { + bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater() && !LLToolMgr::getInstance()->inBuildMode() && - gSavedSettings.getBOOL("RenderDepthOfField"); + RenderDepthOfField; + - bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 1; + bool multisample = RenderFSAASamples > 1; if (multisample) { @@ -6261,7 +6417,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glViewport(0, 0, width, height); gGlowCombineFXAAProgram.bind(); - gGlowCombineFXAAProgram.uniform2f("screen_res", width, height); + gGlowCombineFXAAProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, width, height); gGL.getTexUnit(0)->bind(&mGlow[1]); gGL.getTexUnit(1)->bind(&mScreen); @@ -6284,7 +6440,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) LLGLSLShader* shader = &gFXAAProgram; shader->bind(); - S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); + S32 channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); if (channel > -1) { mFXAABuffer.bindTexture(0, channel); @@ -6294,10 +6450,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) F32 scale_x = (F32) width/mFXAABuffer.getWidth(); F32 scale_y = (F32) height/mFXAABuffer.getHeight(); - shader->uniform2f("tc_scale", scale_x, scale_y); - shader->uniform2f("rcp_screen_res", 1.f/width*scale_x, 1.f/height*scale_y); - shader->uniform4f("rcp_frame_opt", -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y); - shader->uniform4f("rcp_frame_opt2", -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y); + shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y); + shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f/width*scale_x, 1.f/height*scale_y); + shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y); + shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.vertex2f(-1,-1); @@ -6391,7 +6547,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } else if (transition_time < 1.f) { //currently in a transition, continue interpolating - transition_time += 1.f/gSavedSettings.getF32("CameraFocusTransitionTime")*gFrameIntervalSeconds; + transition_time += 1.f/CameraFocusTransitionTime*gFrameIntervalSeconds; transition_time = llmin(transition_time, 1.f); F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f; @@ -6404,12 +6560,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) //convert to mm F32 subject_distance = current_distance*1000.f; - F32 fnumber = gSavedSettings.getF32("CameraFNumber"); - F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); + F32 fnumber = CameraFNumber; + F32 default_focal_length = CameraFocalLength; F32 fov = LLViewerCamera::getInstance()->getView(); - const F32 default_fov = gSavedSettings.getF32("CameraFieldOfView") * F_PI/180.f; + const F32 default_fov = CameraFieldOfView * F_PI/180.f; //const F32 default_aspect_ratio = gSavedSettings.getF32("CameraAspectRatio"); //F32 aspect_ratio = (F32) mScreen.getWidth()/(F32)mScreen.getHeight(); @@ -6432,13 +6588,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) blur_constant /= 1000.f; //convert to meters for shader F32 magnification = focal_length/(subject_distance-focal_length); - shader->uniform1f("focal_distance", -subject_distance/1000.f); - shader->uniform1f("blur_constant", blur_constant); - shader->uniform1f("tan_pixel_angle", tanf(1.f/LLDrawable::sCurPixelAngle)); - shader->uniform1f("magnification", magnification); + shader->uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance/1000.f); + shader->uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant); + shader->uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f/LLDrawable::sCurPixelAngle)); + shader->uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification); } - S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); + S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); if (channel > -1) { mScreen.bindTexture(0, channel); @@ -6446,7 +6602,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (multisample) { //bloom has already been added, bind black - channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_BLOOM); + channel = shader->enableTexture(LLShaderMgr::DEFERRED_BLOOM); if (channel > -1) { gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sBlackImagep); @@ -6519,7 +6675,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.getTexUnit(0)->bind(&mGlow[1]); gGL.getTexUnit(1)->bind(&mScreen); - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); buff->setBuffer(mask); buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3); @@ -6611,28 +6767,28 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n shader.bind(); S32 channel = 0; - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(0,channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(1, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); if (channel > -1) { mDeferredScreen.bindTexture(2, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage()); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage()); if (channel > -1) { gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE); @@ -6646,21 +6802,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n glh::matrix4f projection = glh_get_current_projection(); glh::matrix4f inv_proj = projection.inverse(); - shader.uniformMatrix4fv("inv_proj", 1, FALSE, inv_proj.m); - shader.uniform4f("viewport", (F32) gGLViewport[0], + shader.uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); + shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0], (F32) gGLViewport[1], (F32) gGLViewport[2], (F32) gGLViewport[3]); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NOISE); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); if (channel > -1) { gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, noise_map); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); if (channel > -1) { gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); @@ -6668,7 +6824,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n stop_glerror(); - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage()); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage()); if (channel > -1) { if (light_index > 0) @@ -6682,7 +6838,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_BLOOM); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_BLOOM); if (channel > -1) { mGlow[1].bindTexture(0, channel); @@ -6692,7 +6848,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n for (U32 i = 0; i < 4; i++) { - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE); stop_glerror(); if (channel > -1) { @@ -6710,7 +6866,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n for (U32 i = 4; i < 6; i++) { - channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i); stop_glerror(); if (channel > -1) { @@ -6739,12 +6895,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n mat[i+80] = mSunShadowMatrix[5].m[i]; } - shader.uniformMatrix4fv("shadow_matrix[0]", 6, FALSE, mat); - shader.uniformMatrix4fv("shadow_matrix", 6, FALSE, mat); + shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat); stop_glerror(); - channel = shader.enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); if (channel > -1) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; @@ -6759,24 +6914,23 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniform3fv("env_mat[0]", 3, mat); - shader.uniform3fv("env_mat", 3, mat); + shader.uniform3fv(LLShaderMgr::DEFERRED_ENV_MAT, 3, mat); } } - shader.uniform4fv("shadow_clip", 1, mSunClipPlanes.mV); - shader.uniform1f("sun_wash", gSavedSettings.getF32("RenderDeferredSunWash")); - shader.uniform1f("shadow_noise", gSavedSettings.getF32("RenderShadowNoise")); - shader.uniform1f("blur_size", gSavedSettings.getF32("RenderShadowBlurSize")); + shader.uniform4fv(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1, mSunClipPlanes.mV); + shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash); + shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise); + shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize); - shader.uniform1f("ssao_radius", gSavedSettings.getF32("RenderSSAOScale")); - shader.uniform1f("ssao_max_radius", gSavedSettings.getU32("RenderSSAOMaxScale")); + shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale); + shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, RenderSSAOMaxScale); - F32 ssao_factor = gSavedSettings.getF32("RenderSSAOFactor"); - shader.uniform1f("ssao_factor", ssao_factor); - shader.uniform1f("ssao_factor_inv", 1.0/ssao_factor); + F32 ssao_factor = RenderSSAOFactor; + shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor); + shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor); - LLVector3 ssao_effect = gSavedSettings.getVector3("RenderSSAOEffect"); + LLVector3 ssao_effect = RenderSSAOEffect; F32 matrix_diag = (ssao_effect[0] + 2.0*ssao_effect[1])/3.0; F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0; // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by @@ -6784,23 +6938,23 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag, matrix_nondiag, matrix_diag, matrix_nondiag, matrix_nondiag, matrix_nondiag, matrix_diag}; - shader.uniformMatrix3fv("ssao_effect_mat", 1, GL_FALSE, ssao_effect_mat); - - F32 shadow_offset_error = 1.f + gSavedSettings.getF32("RenderShadowOffsetError") * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); - F32 shadow_bias_error = 1.f + gSavedSettings.getF32("RenderShadowBiasError") * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); - - shader.uniform2f("screen_res", mDeferredScreen.getWidth(), mDeferredScreen.getHeight()); - shader.uniform1f("near_clip", LLViewerCamera::getInstance()->getNear()*2.f); - shader.uniform1f ("shadow_offset", gSavedSettings.getF32("RenderShadowOffset")*shadow_offset_error); - shader.uniform1f("shadow_bias", gSavedSettings.getF32("RenderShadowBias")*shadow_bias_error); - shader.uniform1f ("spot_shadow_offset", gSavedSettings.getF32("RenderSpotShadowOffset")); - shader.uniform1f("spot_shadow_bias", gSavedSettings.getF32("RenderSpotShadowBias")); - - shader.uniform3fv("sun_dir", 1, mTransformedSunDir.mV); - shader.uniform2f("shadow_res", mShadow[0].getWidth(), mShadow[0].getHeight()); - shader.uniform2f("proj_shadow_res", mShadow[4].getWidth(), mShadow[4].getHeight()); - shader.uniform1f("depth_cutoff", gSavedSettings.getF32("RenderEdgeDepthCutoff")); - shader.uniform1f("norm_cutoff", gSavedSettings.getF32("RenderEdgeNormCutoff")); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat); + + F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); + F32 shadow_bias_error = 1.f + RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); + + shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredScreen.getWidth(), mDeferredScreen.getHeight()); + shader.uniform1f(LLShaderMgr::DEFERRED_NEAR_CLIP, LLViewerCamera::getInstance()->getNear()*2.f); + shader.uniform1f (LLShaderMgr::DEFERRED_SHADOW_OFFSET, RenderShadowOffset*shadow_offset_error); + shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_BIAS, RenderShadowBias*shadow_bias_error); + shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_OFFSET, RenderSpotShadowOffset); + shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias); + + shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV); + shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mShadow[0].getWidth(), mShadow[0].getHeight()); + shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mShadow[4].getWidth(), mShadow[4].getHeight()); + shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); + shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); if (shader.getUniformLocation("norm_mat") >= 0) @@ -6839,7 +6993,7 @@ void LLPipeline::renderDeferredLighting() 0, 0, mDeferredDepth.getWidth(), mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); } - LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); + LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { @@ -6886,7 +7040,7 @@ void LLPipeline::renderDeferredLighting() gGL.pushMatrix(); gGL.loadIdentity(); - if (gSavedSettings.getBOOL("RenderDeferredSSAO") || gSavedSettings.getS32("RenderShadowDetail") > 0) + if (RenderDeferredSSAO || RenderShadowDetail > 0) { mDeferredLight.bindTarget(); { //paint shadow/SSAO light map (direct lighting lightmap) @@ -6932,7 +7086,7 @@ void LLPipeline::renderDeferredLighting() mDeferredLight.flush(); } - if (gSavedSettings.getBOOL("RenderDeferredSSAO")) + if (RenderDeferredSSAO) { //soften direct lighting lightmap LLFastTimer ftm(FTM_SOFTEN_SHADOW); //blur lightmap @@ -6943,10 +7097,10 @@ void LLPipeline::renderDeferredLighting() bindDeferredShader(gDeferredBlurLightProgram); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); - LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); + LLVector3 go = RenderShadowGaussian; const U32 kern_length = 4; - F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); - F32 dist_factor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); + F32 blur_size = RenderShadowBlurSize; + F32 dist_factor = RenderShadowBlurDistFactor; // sample symmetrically with the middle sample falling exactly on 0.0 F32 x = 0.f; @@ -7011,7 +7165,7 @@ void LLPipeline::renderDeferredLighting() glClearColor(0,0,0,0); mScreen.clear(GL_COLOR_BUFFER_BIT); - if (gSavedSettings.getBOOL("RenderDeferredAtmospheric")) + if (RenderDeferredAtmospheric) { //apply sunlight contribution LLFastTimer ftm(FTM_ATMOSPHERICS); bindDeferredShader(gDeferredSoftenProgram); @@ -7056,7 +7210,7 @@ void LLPipeline::renderDeferredLighting() gPipeline.popRenderTypeMask(); } - BOOL render_local = gSavedSettings.getBOOL("RenderLocalLights"); + BOOL render_local = RenderLocalLights; if (render_local) { @@ -7162,10 +7316,10 @@ void LLPipeline::renderDeferredLighting() LLFastTimer ftm(FTM_LOCAL_LIGHTS); //glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); - gDeferredLightProgram.uniform3fv("center", 1, tc.v); - gDeferredLightProgram.uniform1f("size", s*s); - gDeferredLightProgram.uniform3fv("color", 1, col.mV); - gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); + gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s); + gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); + gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f); //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); gGL.syncMatrices(); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -7197,7 +7351,7 @@ void LLPipeline::renderDeferredLighting() mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); - gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) { @@ -7236,16 +7390,16 @@ void LLPipeline::renderDeferredLighting() v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110 v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111 - gDeferredSpotLightProgram.uniform3fv("center", 1, tc.v); - gDeferredSpotLightProgram.uniform1f("size", s*s); - gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV); - gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); + gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s); + gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); + gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f); gGL.syncMatrices(); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_SHORT, get_box_fan_indices_ptr(camera, center)); } - gDeferredSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION); unbindDeferredShader(gDeferredSpotLightProgram); } @@ -7292,12 +7446,12 @@ void LLPipeline::renderDeferredLighting() count++; if (count == max_count || fullscreen_lights.empty()) { - gDeferredMultiLightProgram.uniform1i("light_count", count); - gDeferredMultiLightProgram.uniform4fv("light", count, (GLfloat*) light); - gDeferredMultiLightProgram.uniform4fv("light_col", count, (GLfloat*) col); - gDeferredMultiLightProgram.uniform1f("far_z", far_z); + gDeferredMultiLightProgram.uniform1i(LLShaderMgr::MULTI_LIGHT_COUNT, count); + gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*) light); + gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*) col); + gDeferredMultiLightProgram.uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z); far_z = 0.f; - count = 0; + count = 0; mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } } @@ -7306,7 +7460,7 @@ void LLPipeline::renderDeferredLighting() bindDeferredShader(gDeferredMultiSpotLightProgram); - gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -7331,14 +7485,14 @@ void LLPipeline::renderDeferredLighting() LLColor3 col = volume->getLightColor(); col *= volume->getLightIntensity(); - gDeferredMultiSpotLightProgram.uniform3fv("center", 1, tc.v); - gDeferredMultiSpotLightProgram.uniform1f("size", s*s); - gDeferredMultiSpotLightProgram.uniform3fv("color", 1, col.mV); - gDeferredMultiSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); + gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s); + gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); + gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f); mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } - gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION); unbindDeferredShader(gDeferredMultiSpotLightProgram); gGL.popMatrix(); @@ -7463,13 +7617,13 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) F32 proj_range = far_clip - near_clip; glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip); screen_to_light = trans * light_proj * screen_to_light; - shader.uniformMatrix4fv("proj_mat", 1, FALSE, screen_to_light.m); - shader.uniform1f("proj_near", near_clip); - shader.uniform3fv("proj_p", 1, p1.v); - shader.uniform3fv("proj_n", 1, n.v); - shader.uniform3fv("proj_origin", 1, screen_origin.v); - shader.uniform1f("proj_range", proj_range); - shader.uniform1f("proj_ambiance", params.mV[2]); + shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, FALSE, screen_to_light.m); + shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip); + shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v); + shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v); + shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, screen_origin.v); + shader.uniform1f(LLShaderMgr::PROJECTOR_RANGE, proj_range); + shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIANCE, params.mV[2]); S32 s_idx = -1; for (U32 i = 0; i < 2; i++) @@ -7480,15 +7634,15 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) } } - shader.uniform1i("proj_shadow_idx", s_idx); + shader.uniform1i(LLShaderMgr::PROJECTOR_SHADOW_INDEX, s_idx); if (s_idx >= 0) { - shader.uniform1f("shadow_fade", 1.f-mSpotLightFade[s_idx]); + shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f-mSpotLightFade[s_idx]); } else { - shader.uniform1f("shadow_fade", 1.f); + shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f); } { @@ -7522,7 +7676,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) img = LLViewerFetchedTexture::sWhiteImagep; } - S32 channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); + S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); if (channel > -1) { @@ -7532,9 +7686,9 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) F32 lod_range = logf(img->getWidth())/logf(2.f); - shader.uniform1f("proj_focus", focus); - shader.uniform1f("proj_lod", lod_range); - shader.uniform1f("proj_ambient_lod", llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f)); + shader.uniform1f(LLShaderMgr::PROJECTOR_FOCUS, focus); + shader.uniform1f(LLShaderMgr::PROJECTOR_LOD, lod_range); + shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIENT_LOD, llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f)); } } @@ -7543,17 +7697,17 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) { stop_glerror(); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, mDeferredScreen.getUsage()); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage()); - shader.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_BLOOM); + shader.disableTexture(LLShaderMgr::DEFERRED_NORMAL, mDeferredScreen.getUsage()); + shader.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mDeferredScreen.getUsage()); + shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, mDeferredScreen.getUsage()); + shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredScreen.getUsage()); + shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, mDeferredLight.getUsage()); + shader.disableTexture(LLShaderMgr::DIFFUSE_MAP); + shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM); for (U32 i = 0; i < 4; i++) { - if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE) > -1) + if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE) > -1) { glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); } @@ -7561,16 +7715,16 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) for (U32 i = 4; i < 6; i++) { - if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i) > -1) + if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); } } - shader.disableTexture(LLViewerShaderMgr::DEFERRED_NOISE); - shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC); + shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); + shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); - S32 channel = shader.disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); if (channel > -1) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; @@ -7718,7 +7872,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); - S32 detail = gSavedSettings.getS32("RenderReflectionDetail"); + S32 detail = RenderReflectionDetail; if (detail > 0) { //mask out selected geometry based on reflection detail if (detail < 4) @@ -7742,7 +7896,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) if (LLDrawPoolWater::sNeedsDistortionUpdate) { - if (gSavedSettings.getS32("RenderReflectionDetail") > 0) + if (RenderReflectionDetail > 0) { gPipeline.grabReferences(ref_result); LLGLUserClipPlane clip_plane(plane, mat, projection); @@ -8233,7 +8387,7 @@ void LLPipeline::generateHighlight(LLCamera& camera) if (!mHighlightSet.empty()) { - F32 transition = gFrameIntervalSeconds/gSavedSettings.getF32("RenderHighlightFadeTime"); + F32 transition = gFrameIntervalSeconds/RenderHighlightFadeTime; LLGLDisable test(GL_ALPHA_TEST); LLGLDepthTest depth(GL_FALSE); @@ -8279,7 +8433,7 @@ void LLPipeline::generateHighlight(LLCamera& camera) void LLPipeline::generateSunShadow(LLCamera& camera) { - if (!sRenderDeferred || gSavedSettings.getS32("RenderShadowDetail") <= 0) + if (!sRenderDeferred || RenderShadowDetail <= 0) { return; } @@ -8337,25 +8491,25 @@ void LLPipeline::generateSunShadow(LLCamera& camera) glh::matrix4f proj[6]; //clip contains parallel split distances for 3 splits - LLVector3 clip = gSavedSettings.getVector3("RenderShadowClipPlanes"); + LLVector3 clip = RenderShadowClipPlanes; //F32 slope_threshold = gSavedSettings.getF32("RenderShadowSlopeThreshold"); //far clip on last split is minimum of camera view distance and 128 mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); - clip = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes"); + clip = RenderShadowOrthoClipPlanes; mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]); //currently used for amount to extrude frusta corners for constructing shadow frusta - LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist"); + LLVector3 n = RenderShadowNearDist; //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; //put together a universal "near clip" plane for shadow frusta LLPlane shadow_near_clip; { LLVector3 p = gAgent.getPositionAgent(); - p += mSunDir * gSavedSettings.getF32("RenderFarClip")*2.f; + p += mSunDir * RenderFarClip*2.f; shadow_near_clip.setVec(p, mSunDir); } @@ -8442,7 +8596,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) F32 range = far_clip-near_clip; - LLVector3 split_exp = gSavedSettings.getVector3("RenderShadowSplitExponent"); + LLVector3 split_exp = RenderShadowSplitExponent; F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) ); @@ -8653,7 +8807,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadowError.mV[j] /= wpf.size(); mShadowError.mV[j] /= size.mV[0]; - if (mShadowError.mV[j] > gSavedSettings.getF32("RenderShadowErrorCutoff")) + if (mShadowError.mV[j] > RenderShadowErrorCutoff) { //just use ortho projection mShadowFOV.mV[j] = -1.f; origin.clearVec(); @@ -8696,7 +8850,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) fovx = acos(fovx); fovz = acos(fovz); - F32 cutoff = llmin(gSavedSettings.getF32("RenderShadowFOVCutoff"), 1.4f); + F32 cutoff = llmin((F32) RenderShadowFOVCutoff, 1.4f); mShadowFOV.mV[j] = fovx; @@ -8840,7 +8994,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //hack to disable projector shadows - bool gen_shadow = gSavedSettings.getS32("RenderShadowDetail") > 1; + bool gen_shadow = RenderShadowDetail > 1; if (gen_shadow) { @@ -8979,7 +9133,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } - if (!gSavedSettings.getBOOL("CameraOffset")) + if (!CameraOffset) { glh_set_current_modelview(saved_view); glh_set_current_projection(saved_proj); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 86579261ca..584e6e4c23 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -360,6 +360,7 @@ public: static void updateRenderDeferred(); static void refreshRenderDeferred(); + static void refreshCachedSettings(); static void throttleNewMemoryAllocation(BOOL disable); @@ -771,6 +772,79 @@ public: //debug use static U32 sCurRenderPoolType ; + + //cached settings + static BOOL WindLightUseAtmosShaders; + static BOOL VertexShaderEnable; + static BOOL RenderAvatarVP; + static BOOL RenderDeferred; + static F32 RenderDeferredSunWash; + static U32 RenderFSAASamples; + static U32 RenderResolutionDivisor; + static BOOL RenderUIBuffer; + static S32 RenderShadowDetail; + static BOOL RenderDeferredSSAO; + static F32 RenderShadowResolutionScale; + static BOOL RenderLocalLights; + static BOOL RenderDelayCreation; + static BOOL RenderAnimateRes; + static BOOL FreezeTime; + static S32 DebugBeaconLineWidth; + static F32 RenderHighlightBrightness; + static LLColor4 RenderHighlightColor; + static F32 RenderHighlightThickness; + static BOOL RenderSpotLightsInNondeferred; + static LLColor4 PreviewAmbientColor; + static LLColor4 PreviewDiffuse0; + static LLColor4 PreviewSpecular0; + static LLColor4 PreviewDiffuse1; + static LLColor4 PreviewSpecular1; + static LLColor4 PreviewDiffuse2; + static LLColor4 PreviewSpecular2; + static LLVector3 PreviewDirection0; + static LLVector3 PreviewDirection1; + static LLVector3 PreviewDirection2; + static F32 RenderGlowMinLuminance; + static F32 RenderGlowMaxExtractAlpha; + static F32 RenderGlowWarmthAmount; + static LLVector3 RenderGlowLumWeights; + static LLVector3 RenderGlowWarmthWeights; + static S32 RenderGlowResolutionPow; + static S32 RenderGlowIterations; + static F32 RenderGlowWidth; + static F32 RenderGlowStrength; + static BOOL RenderDepthOfField; + static F32 CameraFocusTransitionTime; + static F32 CameraFNumber; + static F32 CameraFocalLength; + static F32 CameraFieldOfView; + static F32 RenderShadowNoise; + static F32 RenderShadowBlurSize; + static F32 RenderSSAOScale; + static U32 RenderSSAOMaxScale; + static F32 RenderSSAOFactor; + static LLVector3 RenderSSAOEffect; + static F32 RenderShadowOffsetError; + static F32 RenderShadowBiasError; + static F32 RenderShadowOffset; + static F32 RenderShadowBias; + static F32 RenderSpotShadowOffset; + static F32 RenderSpotShadowBias; + static F32 RenderEdgeDepthCutoff; + static F32 RenderEdgeNormCutoff; + static LLVector3 RenderShadowGaussian; + static F32 RenderShadowBlurDistFactor; + static BOOL RenderDeferredAtmospheric; + static S32 RenderReflectionDetail; + static F32 RenderHighlightFadeTime; + static LLVector3 RenderShadowClipPlanes; + static LLVector3 RenderShadowOrthoClipPlanes; + static LLVector3 RenderShadowNearDist; + static F32 RenderFarClip; + static LLVector3 RenderShadowSplitExponent; + static F32 RenderShadowErrorCutoff; + static F32 RenderShadowFOVCutoff; + static BOOL CameraOffset; }; void render_bbox(const LLVector3 &min, const LLVector3 &max); -- cgit v1.2.3 From c841337d2b8fcf50df3f9626f9ecb188243ab43a Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 11 Oct 2011 06:11:38 -0400 Subject: STORM-1579 xml formatting issues in Region/Estate floater Changed covenant and debug panes per Oz's request. Covenant is taller; Restart buttons are moved to the right. --- .../skins/default/xui/en/panel_region_covenant.xml | 2 +- .../skins/default/xui/en/panel_region_debug.xml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml index 3ec6a1959a..df16f6fd37 100644 --- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml +++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml @@ -107,7 +107,7 @@ - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml deleted file mode 100644 index 0f330a7b98..0000000000 --- a/indra/newview/skins/default/xui/en/panel_side_tray.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 4c663ca8b997bd74fb3b646c3cb3870555dfeb91 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 13 Oct 2011 15:17:51 -0700 Subject: EXP-1314 FIX -- No floater for Marketplace EXP-1338 FIX -- Clicking on active Toybox buttons triggers clicking sound EXP-1339 FIX -- No minimum resize dimension for Place floater EXP-1340 FIX -- No minimum resize demension for Appearance floater EXP-1341 FIX -- Places Floater doesn't have Help button * Toybox buttons no longer have click sounds * Marketplace button opens external browser to marketplace url * Minimum sizes for places and appearance floaters * Marketplace URL's now all use https --- indra/newview/app_settings/commands.xml | 5 +- indra/newview/app_settings/settings.xml | 70 +++++++++++----------- indra/newview/llviewermenu.cpp | 2 + .../skins/default/xui/en/floater_my_appearance.xml | 2 + .../skins/default/xui/en/floater_places.xml | 3 + .../skins/default/xui/en/floater_toybox.xml | 1 + 6 files changed, 44 insertions(+), 39 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index e4aaca1bd0..c83494df25 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -116,10 +116,7 @@ icon="Command_Marketplace_Icon" label_ref="Command_Marketplace_Label" tooltip_ref="Command_Marketplace_Tooltip" - execute_function="Floater.ToggleOrBringToFront" - execute_parameters="marketplace" - is_running_function="Floater.IsOpen" - is_running_parameters="marketplace" + execute_function="Avatar.OpenMarketplace" /> Type String Value - http://marketplace.secondlife.com/ + https://marketplace.secondlife.com/
MarketplaceURL_objectFemale @@ -5105,7 +5105,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/attachments + https://marketplace.secondlife.com/trampoline/viewer21/attachments MarketplaceURL_objectMale @@ -5116,7 +5116,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/attachments + https://marketplace.secondlife.com/trampoline/viewer21/attachments MarketplaceURL_clothingFemale @@ -5127,7 +5127,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/clothing_female_avatar + https://marketplace.secondlife.com/trampoline/viewer21/clothing_female_avatar MarketplaceURL_clothingMale @@ -5138,7 +5138,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/clothing_male_avatar + https://marketplace.secondlife.com/trampoline/viewer21/clothing_male_avatar MarketplaceURL_bodypartFemale @@ -5149,7 +5149,7 @@ Type String Value - http://marketplace.secondlife.com + https://marketplace.secondlife.com/ MarketplaceURL_bodypartMale @@ -5160,7 +5160,7 @@ Type String Value - http://marketplace.secondlife.com/ + https://marketplace.secondlife.com/ MarketplaceURL_glovesMale @@ -5171,7 +5171,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men MarketplaceURL_glovesFemale @@ -5182,7 +5182,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men MarketplaceURL_jacketFemale @@ -5193,7 +5193,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/jacket_womens + https://marketplace.secondlife.com/trampoline/viewer21/jacket_womens MarketplaceURL_jacketMale @@ -5204,7 +5204,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/jacket_mens + https://marketplace.secondlife.com/trampoline/viewer21/jacket_mens MarketplaceURL_shirtFemale @@ -5215,7 +5215,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shirt_womens + https://marketplace.secondlife.com/trampoline/viewer21/shirt_womens MarketplaceURL_shirtMale @@ -5226,7 +5226,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shirt_mens + https://marketplace.secondlife.com/trampoline/viewer21/shirt_mens MarketplaceURL_undershirtFemale @@ -5237,7 +5237,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/undershirt_womens + https://marketplace.secondlife.com/trampoline/viewer21/undershirt_womens MarketplaceURL_undershirtMale @@ -5248,7 +5248,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/undershirt_mens + https://marketplace.secondlife.com/trampoline/viewer21/undershirt_mens MarketplaceURL_skirtFemale @@ -5259,7 +5259,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/skirts_women + https://marketplace.secondlife.com/trampoline/viewer21/skirts_women MarketplaceURL_skirtMale @@ -5270,7 +5270,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/skirts_women + https://marketplace.secondlife.com/trampoline/viewer21/skirts_women MarketplaceURL_pantsFemale @@ -5281,7 +5281,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/pants_women + https://marketplace.secondlife.com/trampoline/viewer21/pants_women MarketplaceURL_pantsMale @@ -5292,7 +5292,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/pants_men + https://marketplace.secondlife.com/trampoline/viewer21/pants_men MarketplaceURL_underpantsFemale @@ -5303,7 +5303,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/underwear_women + https://marketplace.secondlife.com/trampoline/viewer21/underwear_women MarketplaceURL_underpantsMale @@ -5314,7 +5314,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/underwear_men + https://marketplace.secondlife.com/trampoline/viewer21/underwear_men MarketplaceURL_shoesFemale @@ -5325,7 +5325,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shoes_women + https://marketplace.secondlife.com/trampoline/viewer21/shoes_women MarketplaceURL_shoesMale @@ -5336,7 +5336,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shoes_men + https://marketplace.secondlife.com/trampoline/viewer21/shoes_men MarketplaceURL_socksFemale @@ -5347,7 +5347,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/socks_women + https://marketplace.secondlife.com/trampoline/viewer21/socks_women MarketplaceURL_socksMale @@ -5358,7 +5358,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/socks_women + https://marketplace.secondlife.com/trampoline/viewer21/socks_women MarketplaceURL_tattooMale @@ -5369,7 +5369,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men MarketplaceURL_tattooFemale @@ -5380,7 +5380,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men MarketplaceURL_hairFemale @@ -5391,7 +5391,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_hair + https://marketplace.secondlife.com/trampoline/viewer21/womens_hair MarketplaceURL_hairMale @@ -5402,7 +5402,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_hair + https://marketplace.secondlife.com/trampoline/viewer21/mens_hair MarketplaceURL_eyesFemale @@ -5413,7 +5413,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_eyes + https://marketplace.secondlife.com/trampoline/viewer21/womens_eyes MarketplaceURL_eyesMale @@ -5424,7 +5424,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_eyes + https://marketplace.secondlife.com/trampoline/viewer21/mens_eyes MarketplaceURL_shapeFemale @@ -5435,7 +5435,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_shape + https://marketplace.secondlife.com/trampoline/viewer21/womens_shape MarketplaceURL_shapeMale @@ -5446,7 +5446,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_shape + https://marketplace.secondlife.com/trampoline/viewer21/mens_shape MarketplaceURL_skinFemale @@ -5457,7 +5457,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_skin + https://marketplace.secondlife.com/trampoline/viewer21/womens_skin MarketplaceURL_skinMale @@ -5468,7 +5468,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_skin + https://marketplace.secondlife.com/trampoline/viewer21/mens_skin MaxDragDistance diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4b90f1952a..5d215c7f6d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8259,6 +8259,8 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); + + commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2)); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml index 758a1d5be9..74c4e22841 100644 --- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -11,6 +11,8 @@ save_rect="true" single_instance="true" title="APPEARANCE" + min_height="230" + min_width="333" width="333"> Date: Thu, 13 Oct 2011 16:48:59 -0700 Subject: * Hooked up build FUI toolbar button * Added Shop button to status bar * Changed "Inventory..." menu item to go to same window as toolbar inventory button --- indra/newview/app_settings/commands.xml | 2 +- indra/newview/llstatusbar.cpp | 5 +++- indra/newview/skins/default/textures/textures.xml | 1 + .../default/textures/toolbar_icons/mini_cart.png | Bin 0 -> 2987 bytes indra/newview/skins/default/xui/en/menu_viewer.xml | 18 +++----------- .../skins/default/xui/en/panel_status_bar.xml | 27 ++++++++++++++++++--- 6 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/mini_cart.png diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index c83494df25..7c6468459c 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -35,7 +35,7 @@ icon="Command_Build_Icon" label_ref="Command_Build_Label" tooltip_ref="Command_Build_Tooltip" - execute_function="Floater.ToggleOrBringToFront" + execute_function="Build.Toggle" execute_parameters="build" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="build" diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 1b8be7a5b2..75db269bde 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -169,6 +169,8 @@ BOOL LLStatusBar::postBuild() getChild("buyL")->setCommitCallback( boost::bind(&LLStatusBar::onClickBuyCurrency, this)); + getChild("goShop")->setCommitCallback(boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); + mBoxBalance = getChild("balance"); mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this ); @@ -345,9 +347,10 @@ void LLStatusBar::setBalance(S32 balance) const S32 HPAD = 24; LLRect balance_rect = mBoxBalance->getTextBoundingRect(); LLRect buy_rect = getChildView("buyL")->getRect(); + LLRect shop_rect = getChildView("goShop")->getRect(); LLView* balance_bg_view = getChildView("balance_bg"); LLRect balance_bg_rect = balance_bg_view->getRect(); - balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + balance_rect.getWidth() + HPAD); + balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); balance_bg_view->setShape(balance_bg_rect); } diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 25f1903131..ab1a8f0990 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -137,6 +137,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png b/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png new file mode 100644 index 0000000000..9fcf46794d Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png differ diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 69029d2ab9..833e8b9f32 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -34,25 +34,13 @@ + shortcut="control|I" + visible="true"> - - - - + + + diff --git a/indra/newview/skins/default/xui/en/floater_critical.xml b/indra/newview/skins/default/xui/en/floater_critical.xml index 05c958e051..13b15bf724 100644 --- a/indra/newview/skins/default/xui/en/floater_critical.xml +++ b/indra/newview/skins/default/xui/en/floater_critical.xml @@ -6,7 +6,7 @@ height="500" layout="topleft" name="modal container" - open_centered="true" + open_positioning="centered" width="600"> + diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml index f017a7ace6..3f5768bc0b 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -1,15 +1,16 @@ - NEARBY VOICE + Nearby voice - Group Call with [GROUP] + Group call with [GROUP] - Conference Call + Conference call diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml index 0eda9ae62a..57d1c92acb 100644 --- a/indra/newview/skins/default/xui/en/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en/floater_web_content.xml @@ -9,7 +9,6 @@ name="floater_web_content" help_topic="floater_web_content" save_rect="true" - auto_tile="true" title="" initial_mime_type="text/html" width="780"> diff --git a/indra/newview/skins/default/xui/en/floater_web_profile.xml b/indra/newview/skins/default/xui/en/floater_web_profile.xml new file mode 100644 index 0000000000..d0225f78a9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_web_profile.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 019e7cd032..4314c8a9e2 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -2,7 +2,7 @@ + top="0"> + + + - - + - - - - - - - - - - - - - - - - + + - + left="0" + follows="all" + height="500" + mouse_opaque="false" + name="login_panel_holder" + width="1024"/> - - - - + width="1024"/> + - - - + - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml index 29eeb93ac1..b452f96e7a 100644 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml @@ -42,6 +42,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml index 65bd2793b6..614dd693c5 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml @@ -52,6 +52,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml index 0634e3bd3b..485a5a658c 100644 --- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml @@ -34,6 +34,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml new file mode 100644 index 0000000000..59912b5503 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 16f48f3a4e..63e50b0b9f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -8,169 +8,178 @@ label="Me" name="Me" tear_off="true"> - - - - - + + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + label="Sit Down" + layout="topleft" + shortcut="alt|shift|S" + name="Sit Down Here"> + + - - - - - - - - - - + label="Fly" + name="Fly" + shortcut="Home"> + + + - - + label="Always Run" + name="Always Run" + shortcut="control|R"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + label="Stop Animating Me" + name="Stop Animating My Avatar"> + + + + + label="Away" + name="Set Away"> + + + + + + + + + + + + + + + + + + + + + + + + function="Floater.Show" + parameter="preferences" /> + + + + + + @@ -219,10 +228,10 @@ use_mac_ctrl="true"> + parameter="chat_bar" /> + parameter="chat_bar" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml new file mode 100644 index 0000000000..355a76e05f --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 1c3e08d59b..3835cd17b6 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -120,33 +120,6 @@ label="Remember password" follows="left|bottom" font="SansSerifSmall" height="15" - left_pad="10" - name="mode_selection_text" - top="20" - width="130"> - Mode: - - - - - - - - - - - + diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index 51ffec4727..7a8e872dc9 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -5,21 +5,21 @@ bg_opaque_color="MouseGray" follows="left|top|right" focus_root="true" - height="60" + height="34" layout="topleft" name="navigation_bar" chrome="true" - width="600"> + width="800"> + + + + width="480"> + width="355"> - - - - - - - - - - - - - - - - - + + + + + + + - - - - + auto_resize="true" + user_resize="true" + min_width="315" + name="favorites_layout_panel" + width="315"> + width="311"> - + + + More ▼ + + + + diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml new file mode 100644 index 0000000000..f766236b2e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -0,0 +1,35 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml index 7daa52b2d9..24046d5cca 100644 --- a/indra/newview/skins/default/xui/en/panel_pick_info.xml +++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml @@ -117,7 +117,7 @@ + top_pad="0" + width="312"> - - Keyboard: + Keyboard: - Mouse: + Mouse: - Single click on land: + Single click on land: - Double click on land: + Double click on land: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 5894abd03b..422bbada7f 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,8 +35,8 @@ + diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml index 2e5ebafe46..adbb183317 100644 --- a/indra/newview/skins/default/xui/en/widgets/floater.xml +++ b/indra/newview/skins/default/xui/en/widgets/floater.xml @@ -1,7 +1,9 @@ - + + + + + diff --git a/indra/newview/skins/minimal/xui/da/floater_camera.xml b/indra/newview/skins/minimal/xui/da/floater_camera.xml deleted file mode 100644 index 5b7ef6db54..0000000000 --- a/indra/newview/skins/minimal/xui/da/floater_camera.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - Roter kamera omkring fokus - - - Zoom kamera mod fokus - - - Flyt kamera op og ned, til venstre og højre - - - Kamera valg - - - Kredsløb zoom panorering - - - Forvalg - - - Se objekt - - - - - - Se forfra - - - - - Se fra siden - - - - - Se bagfra - - - - - - - Se fra objekt - - - - - Førsteperson - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml deleted file mode 100644 index 477f210352..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Loading... - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml b/indra/newview/skins/minimal/xui/en/floater_media_browser.xml deleted file mode 100644 index 4862146c94..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - http://www.secondlife.com - - - http://support.secondlife.com - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml b/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml deleted file mode 100644 index 74ac885202..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml b/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml deleted file mode 100644 index 83b1260620..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_web_content.xml b/indra/newview/skins/minimal/xui/en/floater_web_content.xml deleted file mode 100644 index 1d9a967d5a..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_web_content.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml b/indra/newview/skins/minimal/xui/en/inspect_avatar.xml deleted file mode 100644 index 853d5f8735..0000000000 --- a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -[AGE] - - -[SL_PROFILE] - - - - - - This is my second life description and I really think it is great. But for some reason my description is super extra long because I like to talk a whole lot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml deleted file mode 100644 index abddc59296..0000000000 --- a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From cd13933b0942ef4fdf2d4ec8f558d0ec2312b691 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Oct 2011 14:14:55 -0700 Subject: EXP-1354 : Fixed. Toolbars now saved whenever changing their config and only if initialized correctly. --- indra/newview/lltoolbarview.cpp | 14 +++++++++++++- indra/newview/lltoolbarview.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index affa7241d1..f481455834 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -73,7 +73,8 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) mToolbarRight(NULL), mToolbarBottom(NULL), mDragStarted(false), - mDragToolbarButton(NULL) + mDragToolbarButton(NULL), + mToolbarsLoaded(false) { } @@ -244,6 +245,7 @@ bool LLToolBarView::loadToolbars(bool force_default) } } } + mToolbarsLoaded = true; return true; } @@ -255,6 +257,10 @@ bool LLToolBarView::loadDefaultToolbars() if (gToolBarView) { retval = gToolBarView->loadToolbars(true); + if (retval) + { + gToolBarView->saveToolbars(); + } } return retval; @@ -262,6 +268,9 @@ bool LLToolBarView::loadDefaultToolbars() void LLToolBarView::saveToolbars() const { + if (!mToolbarsLoaded) + return; + // Build the parameter tree from the toolbar data LLToolBarView::ToolbarSet toolbar_set; if (mToolbarLeft) @@ -460,6 +469,9 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t int new_rank = toolbar->getRankFromPosition(x,y); toolbar->addCommand(command_id, new_rank); } + + // Save the new toolbars configuration + gToolBarView->saveToolbars(); } else { diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 8cafbc9308..ea14e471cd 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -100,6 +100,7 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; + bool mToolbarsLoaded; bool mDragStarted; LLToolBarButton* mDragToolbarButton; -- cgit v1.2.3 From a22a2412da437835167e92545c0662f27fb1fb5c Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 26 Oct 2011 16:40:27 -0700 Subject: Disabling display of Received Items panel unless the folder exists --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3c53a9d44c..9f01674efe 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4257,7 +4257,7 @@ Type Boolean Value - 1 + 0 InventoryDisplayOutbox -- cgit v1.2.3 From dbf7bdfe8f266ffb95a6a1def58ccbf46f63eb1c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Oct 2011 14:14:55 -0700 Subject: EXP-1354 : Fixed. Toolbars now saved whenever changing their config and only if initialized correctly. --- indra/newview/lltoolbarview.cpp | 14 +++++++++++++- indra/newview/lltoolbarview.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 619d17efad..5d2cebe031 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -72,7 +72,8 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) mToolbarRight(NULL), mToolbarBottom(NULL), mDragStarted(false), - mDragToolbarButton(NULL) + mDragToolbarButton(NULL), + mToolbarsLoaded(false) { } @@ -240,6 +241,7 @@ bool LLToolBarView::loadToolbars(bool force_default) } } } + mToolbarsLoaded = true; return true; } @@ -251,6 +253,10 @@ bool LLToolBarView::loadDefaultToolbars() if (gToolBarView) { retval = gToolBarView->loadToolbars(true); + if (retval) + { + gToolBarView->saveToolbars(); + } } return retval; @@ -258,6 +264,9 @@ bool LLToolBarView::loadDefaultToolbars() void LLToolBarView::saveToolbars() const { + if (!mToolbarsLoaded) + return; + // Build the parameter tree from the toolbar data LLToolBarView::ToolbarSet toolbar_set; if (mToolbarLeft) @@ -440,6 +449,9 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t int new_rank = toolbar->getRankFromPosition(x,y); toolbar->addCommand(command_id, new_rank); } + + // Save the new toolbars configuration + gToolBarView->saveToolbars(); } else { diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 60ad6316f8..2b26db3802 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -98,6 +98,7 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; + bool mToolbarsLoaded; bool mDragStarted; LLToolBarButton* mDragToolbarButton; -- cgit v1.2.3 From 399de4f345eb0bf43e84bf0a65b3251798f59a13 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 24 Oct 2011 14:28:09 -0700 Subject: EXP-1454 FIX People floater 'cascades' as if opening a new window while looking at group profiles --- indra/llui/llfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 7100ea13a7..2c707afa8f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: case LLFloaterEnums::OPEN_POSITIONING_CASCADING: - if (other != NULL) + if (other != NULL && other != this) { stackWith(*other); } -- cgit v1.2.3 From c6c15aacb394f6ccff77625653591927e450c897 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 24 Oct 2011 14:36:41 -0700 Subject: WIP INTL-78 Turkish translation for FUI --- .../newview/skins/default/xui/tr/floater_about.xml | 5 +- .../skins/default/xui/tr/floater_about_land.xml | 6 +- .../skins/default/xui/tr/floater_avatar.xml | 2 + .../skins/default/xui/tr/floater_camera.xml | 2 +- .../skins/default/xui/tr/floater_chat_bar.xml | 7 + .../skins/default/xui/tr/floater_destinations.xml | 2 + .../skins/default/xui/tr/floater_fast_timers.xml | 10 + .../skins/default/xui/tr/floater_how_to.xml | 2 + indra/newview/skins/default/xui/tr/floater_map.xml | 4 +- .../skins/default/xui/tr/floater_model_preview.xml | 376 +++++++++++---------- .../skins/default/xui/tr/floater_model_wizard.xml | 122 ++----- .../skins/default/xui/tr/floater_moveview.xml | 2 +- .../skins/default/xui/tr/floater_my_appearance.xml | 4 + .../skins/default/xui/tr/floater_my_inventory.xml | 2 + .../default/xui/tr/floater_object_weights.xml | 28 ++ .../default/xui/tr/floater_outfit_save_as.xml | 2 +- .../skins/default/xui/tr/floater_people.xml | 7 + .../newview/skins/default/xui/tr/floater_picks.xml | 2 + .../skins/default/xui/tr/floater_places.xml | 4 + .../skins/default/xui/tr/floater_sound_devices.xml | 2 +- .../newview/skins/default/xui/tr/floater_stats.xml | 12 +- .../newview/skins/default/xui/tr/floater_tools.xml | 11 +- .../skins/default/xui/tr/floater_toybox.xml | 10 + .../default/xui/tr/floater_voice_controls.xml | 8 +- .../skins/default/xui/tr/menu_bottomtray.xml | 2 +- .../skins/default/xui/tr/menu_hide_navbar.xml | 2 +- indra/newview/skins/default/xui/tr/menu_login.xml | 2 +- .../newview/skins/default/xui/tr/menu_toolbars.xml | 6 + indra/newview/skins/default/xui/tr/menu_viewer.xml | 27 +- .../newview/skins/default/xui/tr/notifications.xml | 14 +- .../skins/default/xui/tr/panel_chiclet_bar.xml | 15 + indra/newview/skins/default/xui/tr/panel_me.xml | 5 +- .../skins/default/xui/tr/panel_navigation_bar.xml | 35 +- .../skins/default/xui/tr/panel_nearby_chat.xml | 4 + .../default/xui/tr/panel_preferences_chat.xml | 2 +- .../default/xui/tr/panel_preferences_general.xml | 4 +- .../default/xui/tr/panel_preferences_move.xml | 31 +- .../skins/default/xui/tr/panel_status_bar.xml | 7 +- .../skins/default/xui/tr/sidepanel_inventory.xml | 14 +- indra/newview/skins/default/xui/tr/strings.xml | 189 ++++++++++- 40 files changed, 628 insertions(+), 363 deletions(-) create mode 100644 indra/newview/skins/default/xui/tr/floater_avatar.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_chat_bar.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_destinations.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_fast_timers.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_how_to.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_my_appearance.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_my_inventory.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_object_weights.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_people.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_picks.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_places.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_toybox.xml create mode 100644 indra/newview/skins/default/xui/tr/menu_toolbars.xml create mode 100644 indra/newview/skins/default/xui/tr/panel_chiclet_bar.xml create mode 100644 indra/newview/skins/default/xui/tr/panel_nearby_chat.xml diff --git a/indra/newview/skins/default/xui/tr/floater_about.xml b/indra/newview/skins/default/xui/tr/floater_about.xml index 2fdbafdfb4..998890b85c 100644 --- a/indra/newview/skins/default/xui/tr/floater_about.xml +++ b/indra/newview/skins/default/xui/tr/floater_about.xml @@ -10,7 +10,7 @@ <nolink>[HOSTNAME]</nolink> ([HOSTIP]) üzerinde bulunan [REGION] içerisinde [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] konumundasınız [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [Sürüm Notları]] +[SERVER_RELEASE_NOTES_URL] CPU: [CPU] @@ -37,6 +37,9 @@ Ses Sunucusu Sürümü: [VOICE_VERSION] Kaybolan Paketler: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%) + + Sunucu sürümü notları URL'si alınırken hata oluÅŸtu. + -- cgit v1.2.3 From 56b2e4ac7c7cc4f27f08b4024ecbeace4c3a3e51 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 25 Oct 2011 16:36:27 +0200 Subject: STORM-1577 WIP Indented floater contents. --- .../default/xui/en/floater_translation_settings.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml index 1eb75e40f3..40fdaaed66 100644 --- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -7,7 +7,7 @@ help_topic="environment_editor_floater" save_rect="true" title="CHAT TRANSLATION SETTINGS" - width="480"> + width="485"> Bing appID not verified. Please try again. Google API key not verified. Please try again. @@ -27,7 +27,7 @@ height="20" follows="left|top" layout="topleft" - left="10" + left="40" name="translate_language_label" top_pad="20" width="130"> @@ -118,7 +118,7 @@ follows="top|left|right" height="15" layout="topleft" - left="10" + left="40" name="tip" top_pad="20" width="330" @@ -153,10 +153,10 @@ follows="top|right" height="20" layout="topleft" - left="40" + left="70" name="bing_api_key_label" top_pad="-55" - width="100"> + width="85"> Bing [http://www.bing.com/developers/createapp.aspx AppID]: + width="210" /> + + + + -- cgit v1.2.3 From 95da0d5421b86b3c01fc372db28d7aa568ef0b16 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 26 Oct 2011 18:45:06 -0700 Subject: FIX VWR-27349 Fix incorrect language name vs. native script name formats for Chinese --- .../skins/default/xui/zh/panel_preferences_general.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml index 29f9599c97..6827fab6e6 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml @@ -5,15 +5,15 @@ - - - - - - - - - + + + + + + + + + (須é‡æ–°å•Ÿå‹•ï¼‰ -- cgit v1.2.3 From ad4ae99c30f1293bf8266c1f53ae62161bcb68bb Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 27 Oct 2011 16:34:45 +0200 Subject: EXP-1389 FIXED ("New notifications while offline" notification shown in lower right corner of FUI viewer) - Moved startup toast to the top of the LLScreenChannel --- indra/newview/llscreenchannel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 45cf81751b..15ba5195d9 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -708,6 +708,8 @@ void LLScreenChannel::showToastsTop() //-------------------------------------------------------------------------- void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) { + LLScreenChannelBase::updateRect(); + LLRect toast_rect; LLToast::Params p; p.lifetime_secs = timer; @@ -730,13 +732,10 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) text_box->setValue(text); text_box->setVisible(TRUE); - S32 old_height = text_box->getRect().getHeight(); text_box->reshapeToFitText(); text_box->setOrigin(text_box->getRect().mLeft, (wrapper_panel->getRect().getHeight() - text_box->getRect().getHeight())/2); - S32 new_height = text_box->getRect().getHeight(); - S32 height_delta = new_height - old_height; - toast_rect.setLeftTopAndSize(0, toast_rect.getHeight() + height_delta +gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); + toast_rect.setLeftTopAndSize(0, getRect().getHeight() - gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); mStartUpToastPanel->setRect(toast_rect); addChild(mStartUpToastPanel); -- cgit v1.2.3 From 252f851741a60f8d9c81870e48a6c7016c6db7a0 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 27 Oct 2011 13:36:32 -0400 Subject: STORM-1659 dates reported as "2035" within groups --- doc/contributions.txt | 1 + indra/newview/llpanelgrouplandmoney.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 988410701b..2989f4a5b7 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -581,6 +581,7 @@ Jonathan Yap STORM-1639 STORM-910 STORM-1642 + STORM-1659 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 8477219f87..e66dd5690c 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -1431,7 +1431,7 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, LLSD substitution; // We don't do time zone corrections of the calculated number of seconds // because we don't have a full time stamp, only a date. - substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%m/%d/%Y", start_date); + substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", start_date); LLStringUtil::format (time_str, substitution); text.append(time_str); @@ -1442,7 +1442,7 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, text.append(LLTrans::getString("NextStipendDay")); time_str = date_format_str; - substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%m/%d/%Y", next_stipend_date); + substitution["datetime"] = LLDateUtil::secondsSinceEpochFromString("%Y-%m-%d", next_stipend_date); LLStringUtil::format (time_str, substitution); text.append(time_str); -- cgit v1.2.3 From 0c84957d312bc3dc31fdb5711317157df73b72e6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Oct 2011 14:50:54 -0400 Subject: SH-2606 FIX, SH-2628 FIX - crash on exit in crash logger fixed by LLProxy::cleanupClass() --- indra/linux_crash_logger/llcrashloggerlinux.cpp | 6 ++++++ indra/linux_crash_logger/llcrashloggerlinux.h | 1 + indra/llcrashlogger/llcrashlogger.cpp | 7 +++++++ indra/llcrashlogger/llcrashlogger.h | 3 ++- indra/mac_crash_logger/llcrashloggermac.cpp | 1 + indra/win_crash_logger/llcrashloggerwindows.cpp | 1 + 6 files changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/linux_crash_logger/llcrashloggerlinux.cpp mode change 100644 => 100755 indra/linux_crash_logger/llcrashloggerlinux.h mode change 100644 => 100755 indra/llcrashlogger/llcrashlogger.cpp mode change 100644 => 100755 indra/llcrashlogger/llcrashlogger.h mode change 100644 => 100755 indra/mac_crash_logger/llcrashloggermac.cpp mode change 100644 => 100755 indra/win_crash_logger/llcrashloggerwindows.cpp diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp old mode 100644 new mode 100755 index 7316717193..62465f9937 --- a/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -133,6 +133,12 @@ bool LLCrashLoggerLinux::mainLoop() return true; } +bool LLCrashLoggerLinux::cleanup() +{ + commonCleanup(); + return true; +} + void LLCrashLoggerLinux::updateApplication(const std::string& message) { LLCrashLogger::updateApplication(message); diff --git a/indra/linux_crash_logger/llcrashloggerlinux.h b/indra/linux_crash_logger/llcrashloggerlinux.h old mode 100644 new mode 100755 index 65d5e4e653..dae6c46651 --- a/indra/linux_crash_logger/llcrashloggerlinux.h +++ b/indra/linux_crash_logger/llcrashloggerlinux.h @@ -39,6 +39,7 @@ public: virtual bool mainLoop(); virtual void updateApplication(const std::string& = LLStringUtil::null); virtual void gatherPlatformSpecificFiles(); + virtual bool cleanup(); }; #endif diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp old mode 100644 new mode 100755 index 331a1692ee..3461aa3e6c --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -42,6 +42,7 @@ #include "llpumpio.h" #include "llhttpclient.h" #include "llsdserialize.h" +#include "llproxy.h" LLPumpIO* gServicePump; BOOL gBreak = false; @@ -428,3 +429,9 @@ bool LLCrashLogger::init() return true; } + +// For cleanup code common to all platforms. +void LLCrashLogger::commonCleanup() +{ + LLProxy::cleanupClass(); +} diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h old mode 100644 new mode 100755 index 5d0cb5931c..1510d7e0b3 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -48,7 +48,8 @@ public: virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool init(); virtual bool mainLoop() = 0; - virtual bool cleanup() { return true; } + virtual bool cleanup() = 0; + void commonCleanup(); void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; } S32 getCrashBehavior() { return mCrashBehavior; } bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout); diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp old mode 100644 new mode 100755 index b555e92b96..8f1c1a2dd0 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -249,5 +249,6 @@ void LLCrashLoggerMac::updateApplication(const std::string& message) bool LLCrashLoggerMac::cleanup() { + commonCleanup(); return true; } diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp old mode 100644 new mode 100755 index 170babbb98..36d988ead7 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -370,5 +370,6 @@ bool LLCrashLoggerWindows::cleanup() sleep_and_pump_messages(3); } PostQuitMessage(0); + commonCleanup(); return true; } -- cgit v1.2.3 From 6b397d4910f99ff091d1e14980504a280cc614b2 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 27 Oct 2011 14:56:21 -0400 Subject: Added tag DRTVWR-95_3.2.0-beta1, 3.2.0-beta1 for changeset e440cd1dfbd1 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index f39eadae1b..ecac273651 100644 --- a/.hgtags +++ b/.hgtags @@ -207,3 +207,5 @@ bc01ee26fd0f1866e266429e85f76340523e91f1 3.1.0-beta2 ae2de7b0b33c03dc5bdf3a7bfa54463b512221b2 DRTVWR-92_3.1.0-release ae2de7b0b33c03dc5bdf3a7bfa54463b512221b2 3.1.0-release a8230590e28e4f30f5105549e0e43211d9d55711 3.2.0-start +e440cd1dfbd128d7d5467019e497f7f803640ad6 DRTVWR-95_3.2.0-beta1 +e440cd1dfbd128d7d5467019e497f7f803640ad6 3.2.0-beta1 -- cgit v1.2.3 From d2af1ae8b09d76ee50a9a67a0f42fbfd6657d816 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 27 Oct 2011 14:57:12 -0400 Subject: Added tag DRTVWR-97_3.2.0-beta2, 3.2.0-beta2 for changeset 9bcc2b717663 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index ecac273651..b9cf8d6db2 100644 --- a/.hgtags +++ b/.hgtags @@ -209,3 +209,5 @@ ae2de7b0b33c03dc5bdf3a7bfa54463b512221b2 3.1.0-release a8230590e28e4f30f5105549e0e43211d9d55711 3.2.0-start e440cd1dfbd128d7d5467019e497f7f803640ad6 DRTVWR-95_3.2.0-beta1 e440cd1dfbd128d7d5467019e497f7f803640ad6 3.2.0-beta1 +9bcc2b7176634254e501e3fb4c5b56c1f637852e DRTVWR-97_3.2.0-beta2 +9bcc2b7176634254e501e3fb4c5b56c1f637852e 3.2.0-beta2 -- cgit v1.2.3 From 40dcdac27ae5d11a6e3d6a13b1505e834f672e4d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 27 Oct 2011 13:37:47 -0700 Subject: remove ignore_ui_scale flags and use web content scaling for all web_browser widgets --- indra/newview/llmediactrl.cpp | 52 +++++----------------- indra/newview/llmediactrl.h | 45 +++++++++---------- .../default/xui/en/floater_buy_currency_html.xml | 1 - indra/newview/skins/default/xui/en/panel_login.xml | 3 +- 4 files changed, 32 insertions(+), 69 deletions(-) diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index dd12546bc6..1e92ca25b3 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -68,7 +68,6 @@ static LLDefaultChildRegistry::Register r("web_browser"); LLMediaCtrl::Params::Params() : start_url("start_url"), border_visible("border_visible", true), - ignore_ui_scale("ignore_ui_scale", true), decouple_texture_size("decouple_texture_size", false), texture_width("texture_width", 1024), texture_height("texture_height", 1024), @@ -89,7 +88,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mFrequentUpdates( true ), mForceUpdate( false ), mHomePageUrl( "" ), - mIgnoreUIScale( true ), mAlwaysRefresh( false ), mMediaSource( 0 ), mTakeFocusOnClick( p.focus_on_click ), @@ -112,8 +110,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] ); } - setIgnoreUIScale(p.ignore_ui_scale); - setHomePageUrl(p.start_url, p.initial_mime_type); setBorderVisible(p.border_visible); @@ -124,10 +120,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : if(!getDecoupleTextureSize()) { - S32 screen_width = mIgnoreUIScale ? - llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); - S32 screen_height = mIgnoreUIScale ? - llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight(); + S32 screen_width = llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]); + S32 screen_height = llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]); setTextureSize(screen_width, screen_height); } @@ -471,8 +465,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) { if(!getDecoupleTextureSize()) { - S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::sGLScaleFactor.mV[VX]) : width; - S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::sGLScaleFactor.mV[VY]) : height; + S32 screen_width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); + S32 screen_height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); // when floater is minimized, these sizes are negative if ( screen_height > 0 && screen_width > 0 ) @@ -689,6 +683,8 @@ bool LLMediaCtrl::ensureMediaSourceExists() mMediaSource->addObserver( this ); mMediaSource->setBackgroundColor( getBackgroundColor() ); mMediaSource->setTrustedBrowser(mTrusted); + mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + if(mClearCache) { mMediaSource->clearCache(); @@ -770,27 +766,7 @@ void LLMediaCtrl::draw() { gGL.pushUIMatrix(); { - if (mIgnoreUIScale) - { - gGL.loadUIIdentity(); - // font system stores true screen origin, need to scale this by UI scale factor - // to get render origin for this view (with unit scale) - gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), - floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), - LLFontGL::sCurOrigin.mZ); - } - else - { - // zoom is an expensive operation - only do it if value changes - // TODO: move this logic out to mMediaSource->setPageZoomFactor() ?? - static double prev_ui_scale = 0.0f; - double ui_scale = LLUI::sGLScaleFactor.mV[ VX ]; - if ( ui_scale != prev_ui_scale ) - { - mMediaSource->setPageZoomFactor( ui_scale ); - prev_ui_scale = ui_scale; - } - } + mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); @@ -838,14 +814,6 @@ void LLMediaCtrl::draw() x_offset = (r.getWidth() - width) / 2; y_offset = (r.getHeight() - height) / 2; - if(mIgnoreUIScale) - { - x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]); - y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]); - width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); - height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); - } - // draw the browser gGL.begin( LLRender::QUADS ); if (! media_plugin->getTextureCoordsOpenGL()) @@ -912,14 +880,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); } - x = mIgnoreUIScale ? llround((F32)x * LLUI::sGLScaleFactor.mV[VX]) : x; + x = llround((F32)x * LLUI::sGLScaleFactor.mV[VX]); if ( ! coords_opengl ) { - y = mIgnoreUIScale ? llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]) : y; + y = llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]); } else { - y = mIgnoreUIScale ? llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight() - y; + y = llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]); }; } diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 3c0436e27a..7f2a5e1642 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -51,7 +51,6 @@ public: Optional start_url; Optional border_visible, - ignore_ui_scale, hide_loading, decouple_texture_size, trusted_content, @@ -125,9 +124,6 @@ public: bool getFrequentUpdates() { return mFrequentUpdates; }; void setFrequentUpdates( bool frequentUpdatesIn ) { mFrequentUpdates = frequentUpdatesIn; }; - void setIgnoreUIScale(bool ignore) { mIgnoreUIScale = ignore; } - bool getIgnoreUIScale() { return mIgnoreUIScale; } - void setAlwaysRefresh(bool refresh) { mAlwaysRefresh = refresh; } bool getAlwaysRefresh() { return mAlwaysRefresh; } @@ -181,28 +177,29 @@ public: const S32 mTextureDepthBytes; LLUUID mMediaTextureID; LLViewBorder* mBorder; - bool mFrequentUpdates; - bool mForceUpdate; - bool mTrusted; - std::string mHomePageUrl; - std::string mHomePageMimeType; - std::string mCurrentNavUrl; - std::string mErrorPageURL; - std::string mTarget; - bool mIgnoreUIScale; - bool mAlwaysRefresh; + bool mFrequentUpdates, + mForceUpdate, + mTrusted, + mAlwaysRefresh, + mTakeFocusOnClick, + mStretchToFill, + mMaintainAspectRatio, + mHideLoading, + mHidingInitialLoad, + mClearCache, + mHoverTextChanged, + mDecoupleTextureSize; + + std::string mHomePageUrl, + mHomePageMimeType, + mCurrentNavUrl, + mErrorPageURL, + mTarget; viewer_media_t mMediaSource; - bool mTakeFocusOnClick; - bool mStretchToFill; - bool mMaintainAspectRatio; - bool mHideLoading; - bool mHidingInitialLoad; - bool mDecoupleTextureSize; - S32 mTextureWidth; - S32 mTextureHeight; - bool mClearCache; + S32 mTextureWidth, + mTextureHeight; + class LLWindowShade* mWindowShade; - bool mHoverTextChanged; LLContextMenu* mContextMenu; }; diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml index b9c415633f..0637eedfb2 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml @@ -23,6 +23,5 @@ right="-1" top="1" bottom="-1" - ignore_ui_scale="false" name="browser"/> diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 090c4e0d61..e8f63afe1d 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -32,8 +32,7 @@ top="600" start_url="" top="0" height="600" - width="980" - ignore_ui_scale="false"/> + width="980"/> Date: Thu, 27 Oct 2011 13:39:19 -0700 Subject: moved zoom factor management to llviewermediaimpl --- indra/newview/llviewermedia.cpp | 6 ++++-- indra/newview/llviewermedia.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index fdb281b7f1..dfad871dd7 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1715,7 +1715,8 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mNavigateSuspended(false), mNavigateSuspendedDeferred(false), mIsUpdated(false), - mTrustedBrowser(false) + mTrustedBrowser(false), + mZoomFactor(1.0) { // Set up the mute list observer if it hasn't been set up already. @@ -2305,8 +2306,9 @@ void LLViewerMediaImpl::clearCache() ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::setPageZoomFactor( double factor ) { - if(mMediaSource) + if(mMediaSource && factor != mZoomFactor) { + mZoomFactor = factor; mMediaSource->set_page_zoom_factor( factor ); } } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index a475d03542..3db9f0b4e0 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -417,6 +417,7 @@ private: private: // a single media url with some data and an impl. LLPluginClassMedia* mMediaSource; + F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; std::string mMediaURL; // The last media url set with NavigateTo -- cgit v1.2.3 From 5c868a90f2e30245771aa1ef402645d6d3f12ab1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Oct 2011 17:39:07 -0400 Subject: SH-2635 FIX - always send crash report if previous session froze --- indra/newview/llappviewer.cpp | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) mode change 100644 => 100755 indra/newview/llappviewer.cpp diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp old mode 100644 new mode 100755 index ecfd101eeb..dc88c81d6a --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2825,48 +2825,15 @@ void LLAppViewer::initUpdater() void LLAppViewer::checkForCrash(void) { - #if LL_SEND_CRASH_REPORTS if (gLastExecEvent == LAST_EXEC_FROZE) { - llinfos << "Last execution froze, requesting to send crash report." << llendl; - // - // Pop up a freeze or crash warning dialog - // - S32 choice; - const S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); - if(cb == CRASH_BEHAVIOR_ASK) - { - std::ostringstream msg; - msg << LLTrans::getString("MBFrozenCrashed"); - std::string alert = LLTrans::getString("APP_NAME") + " " + LLTrans::getString("MBAlert"); - choice = OSMessageBox(msg.str(), - alert, - OSMB_YESNO); - } - else if(cb == CRASH_BEHAVIOR_NEVER_SEND) - { - choice = OSBTN_NO; - } - else - { - choice = OSBTN_YES; - } - - if (OSBTN_YES == choice) - { - llinfos << "Sending crash report." << llendl; + llinfos << "Last execution froze, sending a crash report." << llendl; - bool report_freeze = true; - handleCrashReporting(report_freeze); - } - else - { - llinfos << "Not sending crash report." << llendl; - } + bool report_freeze = true; + handleCrashReporting(report_freeze); } #endif // LL_SEND_CRASH_REPORTS - } // -- cgit v1.2.3 From 988278d236d789f490eed24a662a6ffe2be6455a Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 27 Oct 2011 16:13:27 -0700 Subject: EXP-1475 Tongue out of position when incoming/outgoing call dialog shown for first time when speak button is left toolbar --- indra/llui/lldockablefloater.cpp | 8 ++++---- indra/newview/skins/default/textures/textures.xml | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 0fcd937361..3396213f1c 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -82,7 +82,7 @@ BOOL LLDockableFloater::postBuild() mForceDocking = true; } - mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + mDockTongue = LLUI::getUIImage("Flyout_Pointer"); LLFloater::setDocked(true); return LLView::postBuild(); } @@ -244,13 +244,13 @@ const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_s switch(dock_side) { case LLDockControl::LEFT: - mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png"); + mDockTongue = LLUI::getUIImage("Flyout_Left"); break; case LLDockControl::RIGHT: - mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png"); + mDockTongue = LLUI::getUIImage("Flyout_Right"); break; default: - mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + mDockTongue = LLUI::getUIImage("Flyout_Pointer"); break; } diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index bb91d32c6c..0f3769f0f8 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -190,6 +190,10 @@ with the same filename but different name + + + + -- cgit v1.2.3 From e86adb53f4df0cb0b9d8ea9b6cc805782d9fcf71 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 27 Oct 2011 17:20:12 -0700 Subject: EXP-1479 FIX Chat history does not open when selecting toggle on chat floater and issue with minimizing and opening chat floater --- indra/newview/skins/default/xui/en/floater_chat_bar.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml index e7eb7652c7..87606c1a2a 100644 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -24,7 +24,7 @@ follow="all" width="380" height="0" - visible="true" + visible="false" filename="panel_nearby_chat.xml" name="nearby_chat" /> Date: Thu, 27 Oct 2011 19:31:11 -0700 Subject: fixed build --- indra/llui/lluictrlfactory.h | 6 +-- indra/llxuixml/llinitparam.h | 95 +------------------------------------------- 2 files changed, 4 insertions(+), 97 deletions(-) diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 71c38237c1..d612ad5005 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -125,12 +125,12 @@ private: // base case for recursion, there are NO base classes of LLInitParam::BaseBlock template - class ParamDefaults : public LLSingleton > + class ParamDefaults : public LLSingleton > { public: - const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; } + const LLInitParam::BaseBlock& get() { return mBaseBlock; } private: - LLInitParam::BaseBlockWithFlags mBaseBlock; + LLInitParam::BaseBlock mBaseBlock; }; public: diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 8f43cfb94f..183472450d 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -511,92 +511,6 @@ namespace LLInitParam const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; - class BaseBlockWithFlags : public BaseBlock - { - public: - class FlagBase : public Param - { - public: - typedef FlagBase self_t; - - FlagBase(const char* name, BaseBlock* enclosing_block) : Param(enclosing_block) - { - if (LL_UNLIKELY(enclosing_block->mostDerivedBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - enclosing_block->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - NULL, - &inspectParam, - 0, 1)); - BaseBlock::addParam(enclosing_block->mostDerivedBlockDescriptor(), param_descriptor, name); - } - } - - bool isProvided() const { return anyProvided(); } - - private: - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (src_typed_param.isProvided() - && (overwrite || !dst_typed_param.isProvided())) - { - dst.setProvided(true); - return true; - } - return false; - } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) - { - self_t& typed_param = static_cast(param); - - // no further names in stack, parse value now - if (name_stack.first == name_stack.second) - { - typed_param.setProvided(true); - typed_param.enclosingBlock().paramChanged(param, true); - return true; - } - - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - const self_t* typed_diff_param = static_cast(diff_param); - - if (!typed_param.isProvided()) return; - - if (!name_stack.empty()) - { - name_stack.back().second = parser.newParseGeneration(); - } - - // then try to serialize value directly - if (!typed_diff_param || !typed_diff_param->isProvided()) - { - if (!parser.writeValue(NoParamValue(), name_stack)) - { - return; - } - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); - } - }; - }; - // these templates allow us to distinguish between template parameters // that derive from BaseBlock and those that don't template @@ -1537,7 +1451,7 @@ namespace LLInitParam } }; - template + template class Block : public BASE_BLOCK { @@ -1633,13 +1547,6 @@ namespace LLInitParam }; - class Flag : public BaseBlockWithFlags::FlagBase - { - public: - Flag(const char* name) : FlagBase(name, DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) - {} - }; - template > class Multiple : public TypedParam { -- cgit v1.2.3 From 8b0d63f343c4c77910c3d5e5516673bb9b76a35a Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 28 Oct 2011 07:27:54 -0400 Subject: STORM-1105 "Traffic: 0" shown for two cases (traffic actually 0, and waiting for data) --- doc/contributions.txt | 1 + indra/newview/llfloaterland.cpp | 13 +++++++++---- indra/newview/llviewerparcelmgr.cpp | 8 ++++---- indra/newview/llviewerparcelmgr.h | 2 ++ indra/newview/skins/default/xui/en/floater_about_land.xml | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 988410701b..8d57c28149 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -581,6 +581,7 @@ Jonathan Yap STORM-1639 STORM-910 STORM-1642 + STORM-1105 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 4746f93009..2bb1075ec4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -433,7 +433,6 @@ BOOL LLPanelLandGeneral::postBuild() mTextDwell = getChild("DwellText"); - mBtnBuyLand = getChild("Buy Land..."); mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND); @@ -696,20 +695,26 @@ void LLPanelLandGeneral::refresh() S32 area; S32 claim_price; S32 rent_price; - F32 dwell; + F32 dwell = DWELL_NAN; LLViewerParcelMgr::getInstance()->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell); - // Area LLUIString price = getString("area_size_text"); price.setArg("[AREA]", llformat("%d",area)); mTextPriceLabel->setText(getString("area_text")); mTextPrice->setText(price.getString()); - mTextDwell->setText(llformat("%.0f", dwell)); + if (dwell == DWELL_NAN) + { + mTextDwell->setText(LLTrans::getString("LoadingData")); + } + else + { + mTextDwell->setText(llformat("%.0f", dwell)); + } if (for_sale) { diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 8db72da1ee..d6002e7320 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -113,7 +113,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() mRequestResult(0), mWestSouth(), mEastNorth(), - mSelectedDwell(0.f), + mSelectedDwell(DWELL_NAN), mAgentParcelSequenceID(-1), mHoverRequestResult(0), mHoverWestSouth(), @@ -233,7 +233,7 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out, S32 price = 0; S32 rent = 0; BOOL for_sale = FALSE; - F32 dwell = 0.f; + F32 dwell = DWELL_NAN; if (mSelected) { @@ -579,7 +579,7 @@ void LLViewerParcelMgr::deselectLand() mCurrentParcel->mBanList.clear(); //mCurrentParcel->mRenterList.reset(); - mSelectedDwell = 0.f; + mSelectedDwell = DWELL_NAN; // invalidate parcel selection so that existing users of this selection can clean up mCurrentParcelSelection->setParcel(NULL); @@ -1663,7 +1663,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use LLViewerParcelMgr::getInstance()->requestParcelMediaURLFilter(); // Request dwell for this land, if it's not public land. - LLViewerParcelMgr::getInstance()->mSelectedDwell = 0.f; + LLViewerParcelMgr::getInstance()->mSelectedDwell = DWELL_NAN; if (0 != local_id) { LLViewerParcelMgr::getInstance()->sendParcelDwellRequest(); diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 68d8978ea8..cac8d8391c 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -43,6 +43,8 @@ class LLParcel; class LLViewerTexture; class LLViewerRegion; +const F32 DWELL_NAN = -1.0f; // A dwell having this value will be displayed as Loading... + // Constants for sendLandOwner //const U32 NO_NEIGHBOR_JOIN = 0x0; //const U32 ALL_NEIGHBOR_JOIN = U32( NORTH_MASK diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index eaffbf5fa6..1c7b354221 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -487,7 +487,7 @@ name="DwellText" top_delta="0" width="186"> - 0 + Loading... \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c4031de0f8..24cec13c4c 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2183,6 +2183,8 @@ Returns a string with the requested data about the region Stomach Left Pec Right Pec + Neck + Avatar Center Invalid Attachment Point @@ -3529,6 +3531,10 @@ Try enclosing path to the editor with double quotes. Error parsing the external editor command. External editor failed to run. + + Translation failed: [REASON] + Error parsing translation response. + Esc Space diff --git a/indra/newview/skins/default/xui/pl/floater_about.xml b/indra/newview/skins/default/xui/pl/floater_about.xml index 637325ddd0..409429ffaa 100644 --- a/indra/newview/skins/default/xui/pl/floater_about.xml +++ b/indra/newview/skins/default/xui/pl/floater_about.xml @@ -10,7 +10,7 @@ PoÅ‚ożenie [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] w [REGION] zlokalizowanym w <nolink>[HOSTNAME]</nolink> ([HOSTIP]) [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]] +[SERVER_RELEASE_NOTES_URL] Procesor: [CPU] diff --git a/indra/newview/skins/default/xui/ru/strings.xml b/indra/newview/skins/default/xui/ru/strings.xml index d52cee6b0d..0134298166 100644 --- a/indra/newview/skins/default/xui/ru/strings.xml +++ b/indra/newview/skins/default/xui/ru/strings.xml @@ -4252,7 +4252,7 @@ support@secondlife.com. Женщина – ух Ñ‚Ñ‹! - /поклонитьÑÑ + /поклон /хлопнуть diff --git a/indra/newview/skins/default/xui/zh/floater_about.xml b/indra/newview/skins/default/xui/zh/floater_about.xml index 0ac85d399e..7e19c124a1 100644 --- a/indra/newview/skins/default/xui/zh/floater_about.xml +++ b/indra/newview/skins/default/xui/zh/floater_about.xml @@ -10,7 +10,7 @@ You are at [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] in [REGION] located at <nolink>[HOSTNAME]</nolink> ([HOSTIP]) [SERVER_VERSION] -[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]] +[SERVER_RELEASE_NOTES_URL] CPU:[CPU] -- cgit v1.2.3 From 73044f3869576c67e878edf8b9803ab3d24eb1e4 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Fri, 28 Oct 2011 20:13:16 -0400 Subject: Added tag DRTVWR-98_3.2.0-beta3, 3.2.0-beta3 for changeset 2a13d30ee50c --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index b9cf8d6db2..94c1b79417 100644 --- a/.hgtags +++ b/.hgtags @@ -211,3 +211,5 @@ e440cd1dfbd128d7d5467019e497f7f803640ad6 DRTVWR-95_3.2.0-beta1 e440cd1dfbd128d7d5467019e497f7f803640ad6 3.2.0-beta1 9bcc2b7176634254e501e3fb4c5b56c1f637852e DRTVWR-97_3.2.0-beta2 9bcc2b7176634254e501e3fb4c5b56c1f637852e 3.2.0-beta2 +2a13d30ee50ccfed50268238e36bb90d738ccc9e DRTVWR-98_3.2.0-beta3 +2a13d30ee50ccfed50268238e36bb90d738ccc9e 3.2.0-beta3 -- cgit v1.2.3 From 403cdb863d8ebc4ba059ebb07e689e16f963b443 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 28 Oct 2011 22:04:20 -0400 Subject: =?UTF-8?q?STORM-1222=20System=20message=20when=20trying=20to=20te?= =?UTF-8?q?leport=20back=20to=20Welcome=20Island=20isn=C2=B4t=20localized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/contributions.txt | 1 + indra/newview/skins/default/xui/da/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/de/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/en/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/es/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/fr/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/it/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/ja/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/pl/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/pt/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/ru/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/tr/teleport_strings.xml | 4 ++++ indra/newview/skins/default/xui/zh/teleport_strings.xml | 4 ++++ 13 files changed, 49 insertions(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index d719f64baf..725baa496a 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -582,6 +582,7 @@ Jonathan Yap STORM-1639 STORM-910 STORM-1642 + STORM-1222 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/skins/default/xui/da/teleport_strings.xml b/indra/newview/skins/default/xui/da/teleport_strings.xml index 071aab46f4..0d89fae986 100644 --- a/indra/newview/skins/default/xui/da/teleport_strings.xml +++ b/indra/newview/skins/default/xui/da/teleport_strings.xml @@ -19,6 +19,10 @@ Hvis du stadig ikke kan teleporte, prøv venligst at logge ud og ligge ind for a Beklager, systemet kunne ikke fuldføre teleport forbindelse. Prøv igen om lidt. + + + Du kan ikke teleportere tilbage til Welcome Island. +GÃ¥ til 'Welcome Island Puclic' for at prøve tutorial igen. Beklager, du har ikke adgang til denne teleport destination. diff --git a/indra/newview/skins/default/xui/de/teleport_strings.xml b/indra/newview/skins/default/xui/de/teleport_strings.xml index 69c952c532..bbfc830688 100644 --- a/indra/newview/skins/default/xui/de/teleport_strings.xml +++ b/indra/newview/skins/default/xui/de/teleport_strings.xml @@ -19,6 +19,10 @@ Wenn der Teleport dann immer noch nicht funktioniert, melden Sie sich bitte ab u Das System konnte keine Teleport-Verbindung herstellen. Versuchen Sie es später noch einmal. + + + Sie können nicht zurück nach Welcome Island teleportieren. +Gehen Sie zu „Welcome Island Public“ und wiederholen sie das Tutorial. Sie haben leider keinen Zugang zu diesem Teleport-Ziel. diff --git a/indra/newview/skins/default/xui/en/teleport_strings.xml b/indra/newview/skins/default/xui/en/teleport_strings.xml index bae821d3b5..dce6b8dd6d 100644 --- a/indra/newview/skins/default/xui/en/teleport_strings.xml +++ b/indra/newview/skins/default/xui/en/teleport_strings.xml @@ -19,6 +19,10 @@ If you still cannot teleport, please log out and log back in to resolve the prob Sorry, but system was unable to complete the teleport connection. Try again in a moment. + + +You cannot teleport back to Welcome Island. +Go to 'Welcome Island Public' to repeat the tutorial. Sorry, you do not have access to that teleport destination. diff --git a/indra/newview/skins/default/xui/es/teleport_strings.xml b/indra/newview/skins/default/xui/es/teleport_strings.xml index e0e0061729..e785a7ac40 100644 --- a/indra/newview/skins/default/xui/es/teleport_strings.xml +++ b/indra/newview/skins/default/xui/es/teleport_strings.xml @@ -18,6 +18,10 @@ Si sigues recibiendo este mensaje, por favor, acude al [SUPPORT_SITE]. Lo sentimos, pero el sistema no ha podido completar el teleporte. Vuelva a intentarlo en un momento. + + + No puede teleportarse de vuelta a la Welcome Island ('Isla de Ayuda'). +Vaya a la 'Welcome Island Public' ('Isla Pública de Ayuda') para repetir el tutorial. Lo sentimos, pero no tienes acceso al destino de este teleporte. diff --git a/indra/newview/skins/default/xui/fr/teleport_strings.xml b/indra/newview/skins/default/xui/fr/teleport_strings.xml index 7c291c0984..401b272c81 100644 --- a/indra/newview/skins/default/xui/fr/teleport_strings.xml +++ b/indra/newview/skins/default/xui/fr/teleport_strings.xml @@ -19,6 +19,10 @@ Si vous ne parvenez toujours pas à être téléporté, déconnectez-vous puis r Désolé, la connexion vers votre lieu de téléportation n'a pas abouti. Veuillez réessayer dans un moment. + + + Vous ne pouvez pas retourner sur Welcome Island. +Pour répéter le didacticiel, veuillez aller sur Welcome Island Public. Désolé, vous n'avez pas accès à cette destination. diff --git a/indra/newview/skins/default/xui/it/teleport_strings.xml b/indra/newview/skins/default/xui/it/teleport_strings.xml index 7a1046abd3..a0b324d8fb 100644 --- a/indra/newview/skins/default/xui/it/teleport_strings.xml +++ b/indra/newview/skins/default/xui/it/teleport_strings.xml @@ -18,6 +18,10 @@ Se si continua a visualizzare questo messaggio, consulta la pagina [SUPPORT_SITE Spiacenti, il sistema non riesce a completare il teletrasporto. Riprova tra un attimo. + + Non è possibile per te ritornare all'Welcome Island. +Vai alla 'Welcome Island Public' per ripetere il tutorial. + Spiacenti, ma non hai accesso nel luogo di destinazione richiesto. diff --git a/indra/newview/skins/default/xui/ja/teleport_strings.xml b/indra/newview/skins/default/xui/ja/teleport_strings.xml index 2f67d43707..04ea1c2438 100644 --- a/indra/newview/skins/default/xui/ja/teleport_strings.xml +++ b/indra/newview/skins/default/xui/ja/teleport_strings.xml @@ -19,6 +19,10 @@ 申ã—訳ã”ã–ã„ã¾ã›ã‚“ãŒã€ã‚·ã‚¹ãƒ†ãƒ ã¯ãƒ†ãƒ¬ãƒãƒ¼ãƒˆã®æŽ¥ç¶šã‚’完了ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ ã‚‚ã†å°‘ã—後ã§ã‚„ã‚Šç›´ã—ã¦ãã ã•ã„。 + + + Welcome Islandã«ã¯æˆ»ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“。 +「Welcome Island Publicã€ã«è¡Œã〠残念ãªãŒã‚‰ã€ãã®ãƒ†ãƒ¬ãƒãƒ¼ãƒˆç›®çš„地ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒã‚ã‚Šã¾ã›ã‚“。 diff --git a/indra/newview/skins/default/xui/pl/teleport_strings.xml b/indra/newview/skins/default/xui/pl/teleport_strings.xml index 57fb55bf4c..0366c3fdbc 100644 --- a/indra/newview/skins/default/xui/pl/teleport_strings.xml +++ b/indra/newview/skins/default/xui/pl/teleport_strings.xml @@ -19,6 +19,10 @@ JeÅ›li nadal nie możesz siÄ™ teleportować wyloguj siÄ™ i ponownie zaloguj. Przepraszamy, ale nie udaÅ‚o siÄ™ przeprowadzić teleportacji. Spróbuj jeszcze raz. + + Brak możliwoÅ›ci ponownej teleportacji do Welcome Island. +Odwiedź 'Welcome Island Public' by powtórzyć szkolenie. + Przepraszamy, ale nie masz dostÄ™pu do miejsca docelowego. diff --git a/indra/newview/skins/default/xui/pt/teleport_strings.xml b/indra/newview/skins/default/xui/pt/teleport_strings.xml index 11ea0f4195..f8ded1ce69 100644 --- a/indra/newview/skins/default/xui/pt/teleport_strings.xml +++ b/indra/newview/skins/default/xui/pt/teleport_strings.xml @@ -18,6 +18,10 @@ Se você continuar a receber esta mensagem, por favor consulte o [SUPPORT_SITE]. Desculpe, não foi possível para o sistema executar o teletransporte. Tente novamente dentro de alguns instantes. + + Você não pode se tele-transportar de volta à Ilha de Welcome. +Vá para a Ilha de Welcome Pública para repetir este tutorial. + Desculpe, você não tem acesso ao destino deste teletransporte. diff --git a/indra/newview/skins/default/xui/ru/teleport_strings.xml b/indra/newview/skins/default/xui/ru/teleport_strings.xml index 6a7a181046..296562e6f1 100644 --- a/indra/newview/skins/default/xui/ru/teleport_strings.xml +++ b/indra/newview/skins/default/xui/ru/teleport_strings.xml @@ -19,6 +19,10 @@ СиÑтеме не удалоÑÑŒ выполнить подключение телепорта. Повторите попытку позже. + + + Ð’Ñ‹ не можете телепортироватьÑÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð¾ на ОÑтров Помощи. +ТелепортируйтеÑÑŒ на ОбщеÑтвенный ОÑтров Помощи, чтобы повторить обучение У Ð²Ð°Ñ Ð½ÐµÑ‚ доÑтупа к точке Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñтого телепорта. diff --git a/indra/newview/skins/default/xui/tr/teleport_strings.xml b/indra/newview/skins/default/xui/tr/teleport_strings.xml index c0c4be1393..c506bb8a58 100644 --- a/indra/newview/skins/default/xui/tr/teleport_strings.xml +++ b/indra/newview/skins/default/xui/tr/teleport_strings.xml @@ -19,6 +19,10 @@ Hala ışınlanamıyorsanız, sorunu çözmek için lütfen çıkış yapıp otu Ãœzgünüz fakat sistem ışınlama baÄŸlantısını tamamlayamadı. Bir dakika sonra tekrar deneyin. + + +You cannot teleport back to Welcome Island. +Go to 'Welcome Island Public' to repeat the tutorial. Ãœzgünüz, bu ışınlanma hedef konumuna eriÅŸim hakkına sahip deÄŸilsiniz. diff --git a/indra/newview/skins/default/xui/zh/teleport_strings.xml b/indra/newview/skins/default/xui/zh/teleport_strings.xml index ffb4c903bb..bfdb107810 100644 --- a/indra/newview/skins/default/xui/zh/teleport_strings.xml +++ b/indra/newview/skins/default/xui/zh/teleport_strings.xml @@ -19,6 +19,10 @@ 抱歉,ä¸éŽç³»çµ±ç„¡æ³•å®Œæˆçž¬é–“傳é€çš„è¯æŽ¥ã€‚ è«‹ç¨å¾Œå†è©¦ã€‚ + + + 您ä¸èƒ½çž¬é—´è½¬ç§»å›žâ€œæ´åŠ©å²›â€ã€‚ +去“公共æ´åŠ©å²›â€é‡å¤æ‚¨çš„教程。 抱歉,你並沒有權é™é€²å…¥è¦çž¬é–“傳é€çš„目的地。 -- cgit v1.2.3 From 526f71053a9fb18e95993343a0fd826023bda683 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 29 Oct 2011 05:01:23 -0400 Subject: STORM-591 Comment out debugging llinfos lines --- indra/newview/llvieweraudio.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 8fd1ca3807..10ba54356c 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -65,12 +65,12 @@ void LLViewerAudio::registerIdleListener() void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) { - llinfos << "DBG streamURI: " << streamURI << llendl; +/* llinfos << "DBG streamURI: " << streamURI << llendl; llinfos << "DBG mNextStreamURI: " << mNextStreamURI << llendl; if (mFadeState == FADE_OUT) {llinfos << "DBG mFadeState: FADE_OUT " << llendl;} if (mFadeState == FADE_IN) {llinfos << "DBG mFadeState: FADE_IN " << llendl;} if (mFadeState == FADE_IDLE) {llinfos << "DBG mFadeState: FADE_IDLE " << llendl;} - +*/ // Old and new stream are identical if (mNextStreamURI == streamURI) { @@ -86,13 +86,13 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) if (!gAudiop->getInternetStreamURL().empty()) { mFadeState = FADE_OUT; -llinfos << "DBG new mFadeState: OUT" << llendl; +//llinfos << "DBG new mFadeState: OUT" << llendl; } // Otherwise the new stream can be faded in else { mFadeState = FADE_IN; -llinfos << "DBG new mFadeState: IN" << llendl; +//llinfos << "DBG new mFadeState: IN" << llendl; gAudiop->startInternetStream(mNextStreamURI); startFading(); @@ -123,10 +123,10 @@ bool LLViewerAudio::onIdleUpdate() { if (mDone) { - if (mFadeState == FADE_OUT) {llinfos << "DBG mFadeState: FADE_OUT " << llendl;} +/* if (mFadeState == FADE_OUT) {llinfos << "DBG mFadeState: FADE_OUT " << llendl;} if (mFadeState == FADE_IN) {llinfos << "DBG mFadeState: FADE_IN " << llendl;} if (mFadeState == FADE_IDLE) {llinfos << "DBG mFadeState: FADE_IDLE " << llendl;} - +*/ // This should be a rare or never occurring state. if (mFadeState == FADE_IDLE) { @@ -144,7 +144,7 @@ bool LLViewerAudio::onIdleUpdate() if (!mNextStreamURI.empty()) { mFadeState = FADE_IN; -llinfos << "DBG new mFadeState: IN" << llendl; +//llinfos << "DBG new mFadeState: IN" << llendl; gAudiop->startInternetStream(mNextStreamURI); startFading(); return false; @@ -152,7 +152,7 @@ llinfos << "DBG new mFadeState: IN" << llendl; else { mFadeState = FADE_IDLE; -llinfos << "DBG new mFadeState: IDLE" << llendl; +//llinfos << "DBG new mFadeState: IDLE" << llendl; deregisterIdleListener(); return true; // Stop calling onIdleUpdate } @@ -164,12 +164,12 @@ llinfos << "DBG new mFadeState: IDLE" << llendl; mFadeState = FADE_OUT; startFading(); return false; -llinfos << "DBG new mFadeState: OUT" << llendl; +//llinfos << "DBG new mFadeState: OUT" << llendl; } else { mFadeState = FADE_IDLE; -llinfos << "DBG new mFadeState: IDLE" << llendl; +//llinfos << "DBG new mFadeState: IDLE" << llendl; deregisterIdleListener(); return true; // Stop calling onIdleUpdate } @@ -181,12 +181,12 @@ llinfos << "DBG new mFadeState: IDLE" << llendl; void LLViewerAudio::stopInternetStreamWithAutoFade() { -llinfos << "DBG stopping stream" << llendl; +//llinfos << "DBG stopping stream" << llendl; mFadeState = FADE_IDLE; -llinfos << "DBG new mFadeState: IDLE" << llendl; +//llinfos << "DBG new mFadeState: IDLE" << llendl; mNextStreamURI = LLStringUtil::null; mDone = true; -llinfos << "DBG mDone: true" << llendl; +//llinfos << "DBG mDone: true" << llendl; gAudiop->startInternetStream(LLStringUtil::null); gAudiop->stopInternetStream(); @@ -194,7 +194,7 @@ llinfos << "DBG mDone: true" << llendl; void LLViewerAudio::startFading() { -llinfos << "DBG startFading" << llendl; +//llinfos << "DBG startFading" << llendl; if(mDone) { @@ -208,7 +208,7 @@ llinfos << "DBG startFading" << llendl; stream_fade_timer.reset(); stream_fade_timer.setTimerExpirySec(mFadeTime); mDone = false; -llinfos << "DBG mDone: false" << llendl; +//llinfos << "DBG mDone: false" << llendl; } } @@ -349,7 +349,7 @@ void audio_update_volume(bool force_update) F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); -llinfos << "DBG fade_volume:" << fade_volume << llendl; +//llinfos << "DBG fade_volume:" << fade_volume << llendl; music_volume = mute_volume * master_volume * music_volume * fade_volume; gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume); -- cgit v1.2.3 From bc65e929fc32950a42d58931694961263db9c8ed Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 31 Oct 2011 11:29:32 -0500 Subject: SH-2240 Fix for heap corruption under debugger when starting viewer with basic shaders disabled. --- indra/llwindow/llwindowwin32.cpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index bac23279cc..e46fcea692 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1381,29 +1381,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhRC = 0; if (wglCreateContextAttribsARB) - { //attempt to create a non-compatibility profile context + { //attempt to create a specific versioned context S32 attribs[] = - { + { //start at 4.2 WGL_CONTEXT_MAJOR_VERSION_ARB, 4, - WGL_CONTEXT_MINOR_VERSION_ARB, 0, + WGL_CONTEXT_MINOR_VERSION_ARB, 2, WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0, 0 }; - mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - - if (!mhRC) + bool done = false; + while (!done) { - attribs[1] = 3; - attribs[3] = 3; - mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs); - } - if (mhRC) - { //success, disable fixed function calls - LLGLSLShader::sNoFixedFunction = true; + if (!mhRC) + { + if (attribs[3] > 0) + { //decrement minor version + attribs[3]--; + } + else if (attribs[1] > 3) + { //decrement major version and start minor version over at 3 + attribs[1]--; + attribs[3] = 3; + } + else + { //we reached 3.0 and still failed, bail out + done = true; + } + } + else + { + llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl; + done = true; + } } } -- cgit v1.2.3 From 716c2ed53cb94053f762666470efcb3d28a24218 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 31 Oct 2011 11:33:22 -0700 Subject: Point to new version of LLQtWebKit for Mac/Windows (Rolls in some debugging graphics and Roxie's Mac / SSL changes) --- autobuild.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 347ef419ed..49031b9f17 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1206,9 +1206,9 @@ archive hash - 9cd66e879908f047d9af665b92946ecc + 7108c2443dbcf4c032305814ce65ebb7 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/239803/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20110830.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111028.tar.bz2 name darwin @@ -1230,9 +1230,9 @@ archive hash - ab9393795515cbbe9526bde33b41bf2a + 24048a31d7b852774dc3117acbd4a86a url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/239670/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20110829.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111028.tar.bz2 name windows -- cgit v1.2.3 From 9399b66dc4e59bdbf2a3f551def06f4562ac9957 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 31 Oct 2011 11:33:41 -0700 Subject: Tie debugging/loading overlay to media debugging flag --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index d35d202e99..5098f3cea5 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -323,7 +323,11 @@ private: LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled ); // turn on/off Javascript based on what host app tells us +#if LLQTWEBKIT_API_VERSION >= 11 LLQtWebKit::getInstance()->enableJavaScript( mJavascriptEnabled ); +#else + LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); +#endif std::stringstream str; str << "Cookies enabled = " << mCookiesEnabled << ", plugins enabled = " << mPluginsEnabled << ", Javascript enabled = " << mJavascriptEnabled; @@ -374,7 +378,14 @@ private: url << "%22%3E%3C/body%3E%3C/html%3E"; //lldebugs << "data url is: " << url.str() << llendl; - + + // loading overlay debug screen follows media debugging flag from client for now. + LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, mEnableMediaPluginDebugging); + + str.clear(); + str << "Loading overlay enabled = " << mEnableMediaPluginDebugging << " for mBrowserWindowId = " << mBrowserWindowId; + postDebugMessage( str.str() ); + LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, url.str() ); // LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" ); @@ -1210,7 +1221,6 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) { mEnableMediaPluginDebugging = message_in.getValueBoolean( "enable" ); } - else if(message_name == "js_enable_object") { -- cgit v1.2.3 From 130d017085a4fa609970245a49b6d1a97de404b2 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 31 Oct 2011 12:01:10 -0700 Subject: * Updated inventory code to handle creation of the "Received Items" panel when the sim notifies the viewer that the folder is created. Unfortunately, the sim is not yet doing this so a relog is required to properly get this working. --- indra/newview/llinventorymodel.cpp | 10 +++++----- indra/newview/llsidepanelinventory.cpp | 21 ++++++--------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index fb02fe0ff7..dc25689fa3 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2528,9 +2528,9 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { LLPointer tfolder = new LLViewerInventoryCategory(gAgent.getID()); tfolder->unpackMessage(msg, _PREHASH_FolderData, i); - //llinfos << "unpaked folder '" << tfolder->getName() << "' (" - // << tfolder->getUUID() << ") in " << tfolder->getParentUUID() - // << llendl; + llinfos << "unpacked folder '" << tfolder->getName() << "' (" + << tfolder->getUUID() << ") in " << tfolder->getParentUUID() + << llendl; if(tfolder->getUUID().notNull()) { folders.push_back(tfolder); @@ -2570,8 +2570,8 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { LLPointer titem = new LLViewerInventoryItem; titem->unpackMessage(msg, _PREHASH_ItemData, i); - //llinfos << "unpaked item '" << titem->getName() << "' in " - // << titem->getParentUUID() << llendl; + llinfos << "unpaked item '" << titem->getName() << "' in " + << titem->getParentUUID() << llendl; U32 callback_id; msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id); if(titem->getUUID().notNull()) diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index a24f6b24f0..91f8035556 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -113,21 +113,13 @@ public: switch (added_category_type) { case LLFolderType::FT_INBOX: + mSidepanelInventory->enableInbox(true); mSidepanelInventory->observeInboxModifications(added_category->getUUID()); break; case LLFolderType::FT_OUTBOX: + mSidepanelInventory->enableOutbox(true); mSidepanelInventory->observeOutboxModifications(added_category->getUUID()); break; - case LLFolderType::FT_NONE: - // HACK until sim update to properly create folder with system type - if (added_category->getName() == "Received Items") - { - mSidepanelInventory->observeInboxModifications(added_category->getUUID()); - } - else if (added_category->getName() == "Merchant Outbox") - { - mSidepanelInventory->observeOutboxModifications(added_category->getUUID()); - } default: break; } @@ -288,7 +280,6 @@ BOOL LLSidepanelInventory::postBuild() gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); - updateInboxOutbox(); // Update the verbs buttons state. updateVerbs(); @@ -316,20 +307,20 @@ void LLSidepanelInventory::updateInboxOutbox() // Set up observer for inbox changes, if we have an inbox already if (!inbox_id.isNull()) { - observeInboxModifications(inbox_id); - // Enable the display of the inbox if it exists enableInbox(true); + + observeInboxModifications(inbox_id); } #if ENABLE_MERCHANT_OUTBOX_PANEL // Set up observer for outbox changes, if we have an outbox already if (!outbox_id.isNull()) { - observeOutboxModifications(outbox_id); - // Enable the display of the outbox if it exists enableOutbox(true); + + observeOutboxModifications(outbox_id); } #endif } -- cgit v1.2.3 From 948b56e7c288471ce87838d12cb17b3f34885274 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 31 Oct 2011 12:05:56 -0700 Subject: * Added "clear all" button to the toybox floater with corresponding functions added to LLToolBarView to perform the action. * Updated toybox to new height size per XD. --- indra/newview/llfloatertoybox.cpp | 21 +++++++++++++++ indra/newview/llfloatertoybox.h | 1 + indra/newview/lltoolbarview.cpp | 30 ++++++++++++++++++++++ indra/newview/lltoolbarview.h | 4 +++ .../skins/default/xui/en/floater_toybox.xml | 24 ++++++++++++----- .../newview/skins/default/xui/en/notifications.xml | 18 +++++++++++-- 6 files changed, 90 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index f527937e8f..324afe661f 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -42,6 +42,7 @@ LLFloaterToybox::LLFloaterToybox(const LLSD& key) , mToolBar(NULL) { mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this)); + mCommitCallbackRegistrar.add("Toybox.ClearAll", boost::bind(&LLFloaterToybox::onBtnClearAll, this)); } LLFloaterToybox::~LLFloaterToybox() @@ -121,15 +122,35 @@ static bool finish_restore_toybox(const LLSD& notification, const LLSD& response { LLToolBarView::loadDefaultToolbars(); } + return false; } + +static bool finish_clear_all_toybox(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 0) + { + LLToolBarView::clearAllToolbars(); + } + + return false; +} + static LLNotificationFunctorRegistration finish_restore_toybox_reg("ConfirmRestoreToybox", finish_restore_toybox); +static LLNotificationFunctorRegistration finish_clear_all_toybox_reg("ConfirmClearAllToybox", finish_clear_all_toybox); void LLFloaterToybox::onBtnRestoreDefaults() { LLNotificationsUtil::add("ConfirmRestoreToybox"); } +void LLFloaterToybox::onBtnClearAll() +{ + LLNotificationsUtil::add("ConfirmClearAllToybox"); +} + BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index 6f0275b8fe..10aee0e6f5 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -50,6 +50,7 @@ public: std::string& tooltip_msg); protected: + void onBtnClearAll(); void onBtnRestoreDefaults(); void onToolBarButtonEnter(LLView* button); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index ed1dfbb8cd..5ff0ccfeb2 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -315,6 +315,19 @@ bool LLToolBarView::loadToolbars(bool force_default) return true; } +bool LLToolBarView::clearToolbars() +{ + for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++) + { + if (mToolbars[i]) + { + mToolbars[i]->clearCommandsList(); + } + } + + return true; +} + //static bool LLToolBarView::loadDefaultToolbars() { @@ -332,6 +345,23 @@ bool LLToolBarView::loadDefaultToolbars() return retval; } +//static +bool LLToolBarView::clearAllToolbars() +{ + bool retval = false; + + if (gToolBarView) + { + retval = gToolBarView->clearToolbars(); + if (retval) + { + gToolBarView->saveToolbars(); + } + } + + return retval; +} + void LLToolBarView::saveToolbars() const { if (!mToolbarsLoaded) diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 4307d10258..f871d522a2 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -93,10 +93,14 @@ public: // Loads the toolbars from the existing user or default settings bool loadToolbars(bool force_default = false); // return false if load fails + + // Clears all buttons off the toolbars + bool clearToolbars(); void setToolBarsVisible(bool visible); static bool loadDefaultToolbars(); + static bool clearAllToolbars(); static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton); static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index ef3951a1cd..493d44a9cf 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -5,7 +5,7 @@ can_minimize="false" can_resize="false" default_tab_group="1" - height="460" + height="330" help_topic="toybox" layout="topleft" legacy_header_height="18" @@ -46,7 +46,7 @@ Buttons will appear as shown or as icon-only depending on each toolbar's settings. + top="266" /> + diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ed8c30ca8..e4458f33b1 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4636,7 +4636,21 @@ Are you sure you want to quit? name="ConfirmRestoreToybox" type="alertmodal"> -Are you sure you want to restore your default buttons and toolbars? +This action will restore your default buttons and toolbars. + +You cannot undo this action. + + + + + +This action will return all buttons to the toolbox and your toolbars will be empty. You cannot undo this action. - + Date: Mon, 31 Oct 2011 12:49:57 -0700 Subject: EXP-1487 FIX -- Minimum window size on mac --- indra/llwindow/llwindowmacosx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 4dd11541b9..8057506736 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -2545,8 +2545,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e { // This is where we would constrain move/resize to a particular screen - const S32 MIN_WIDTH = 320; - const S32 MIN_HEIGHT = 240; + const S32 MIN_WIDTH = 1024; + const S32 MIN_HEIGHT = 768; Rect currentBounds; Rect previousBounds; -- cgit v1.2.3 From f6e3d0e5812b144cf476e8ea54f89739e5126bde Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 31 Oct 2011 13:27:25 -0700 Subject: EXP-1486 FIX -- Minimum window size on windows Reviewed by Callum. --- indra/llwindow/llwindowwin32.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 121c7880df..6ef49a9a9c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2354,6 +2354,14 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ return 0; } + case WM_GETMINMAXINFO: + { + LPMINMAXINFO min_max = (LPMINMAXINFO)l_param; + min_max->ptMinTrackSize.x = 1024; + min_max->ptMinTrackSize.y = 768; + return 0; + } + case WM_SIZE: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE"); -- cgit v1.2.3 From d86def6f03acc3b4a07a30a2f7912e6dc35edf27 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 31 Oct 2011 14:59:10 -0700 Subject: * Added support for items at the top level of "Received Items" instead of just folders. Top-level inbox items are counted both in the total item count and in the fresh item count. --- indra/newview/llfolderviewitem.h | 4 + indra/newview/llpanelmarketplaceinbox.cpp | 15 +++ indra/newview/llpanelmarketplaceinboxinventory.cpp | 107 +++++++++++++++++---- indra/newview/llpanelmarketplaceinboxinventory.h | 36 +++++-- .../xui/en/widgets/inbox_folder_view_item.xml | 19 ++++ 5 files changed, 154 insertions(+), 27 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 676eaf825d..a26515821d 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -556,6 +556,10 @@ public: folders_t::const_iterator getFoldersBegin() const { return mFolders.begin(); } folders_t::const_iterator getFoldersEnd() const { return mFolders.end(); } folders_t::size_type getFoldersCount() const { return mFolders.size(); } + + items_t::const_iterator getItemsBegin() const { return mItems.begin(); } + items_t::const_iterator getItemsEnd() const { return mItems.end(); } + items_t::size_type getItemsCount() const { return mItems.size(); } }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index ac528947a4..7cb4bbf891 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -151,6 +151,20 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const fresh_item_count++; } } + + LLFolderViewFolder::items_t::const_iterator items_it = inbox_folder->getItemsBegin(); + LLFolderViewFolder::items_t::const_iterator items_end = inbox_folder->getItemsEnd(); + + for (; items_it != items_end; ++items_it) + { + const LLFolderViewItem * item_view = *items_it; + const LLInboxFolderViewItem * inbox_item_view = dynamic_cast(item_view); + + if (inbox_item_view && inbox_item_view->isFresh()) + { + fresh_item_count++; + } + } } } @@ -171,6 +185,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const if (inbox_folder) { item_count += inbox_folder->getFoldersCount(); + item_count += inbox_folder->getItemsCount(); } } diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index 2e4bf55d51..b9fb5b8c55 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -45,6 +45,7 @@ static LLDefaultChildRegistry::Register r1("inbox_inventory_panel"); static LLDefaultChildRegistry::Register r2("inbox_folder_view_folder"); +static LLDefaultChildRegistry::Register r3("inbox_folder_view_item"); // @@ -137,7 +138,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge) { - LLFolderViewItem::Params params; + LLInboxFolderViewItem::Params params; params.name = bridge->getDisplayName(); params.icon = bridge->getIcon(); @@ -171,10 +172,6 @@ LLInboxFolderViewFolder::LLInboxFolderViewFolder(const Params& p) #endif } -LLInboxFolderViewFolder::~LLInboxFolderViewFolder() -{ -} - // virtual void LLInboxFolderViewFolder::draw() { @@ -190,6 +187,20 @@ void LLInboxFolderViewFolder::draw() LLFolderViewFolder::draw(); } +void LLInboxFolderViewFolder::selectItem() +{ + LLFolderViewFolder::selectItem(); + + deFreshify(); +} + +void LLInboxFolderViewFolder::toggleOpen() +{ + LLFolderViewFolder::toggleOpen(); + + deFreshify(); +} + void LLInboxFolderViewFolder::computeFreshness() { const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity"); @@ -218,20 +229,6 @@ void LLInboxFolderViewFolder::deFreshify() gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } -void LLInboxFolderViewFolder::selectItem() -{ - LLFolderViewFolder::selectItem(); - - deFreshify(); -} - -void LLInboxFolderViewFolder::toggleOpen() -{ - LLFolderViewFolder::toggleOpen(); - - deFreshify(); -} - void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; @@ -246,9 +243,81 @@ void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) // LLInboxFolderViewItem Implementation // +LLInboxFolderViewItem::LLInboxFolderViewItem(const Params& p) + : LLFolderViewItem(p) + , LLBadgeOwner(getHandle()) + , mFresh(false) +{ +#if SUPPORTING_FRESH_ITEM_COUNT + computeFreshness(); + + initBadgeParams(p.new_badge()); +#endif +} + BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) { return TRUE; } +// virtual +void LLInboxFolderViewItem::draw() +{ +#if SUPPORTING_FRESH_ITEM_COUNT + if (!badgeHasParent()) + { + addBadgeToParentPanel(); + } + + setBadgeVisibility(mFresh); +#endif + + LLFolderViewItem::draw(); +} + +void LLInboxFolderViewItem::selectItem() +{ + LLFolderViewItem::selectItem(); + + deFreshify(); +} + +void LLInboxFolderViewItem::computeFreshness() +{ + const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity"); + + if (last_expansion_utc > 0) + { + mFresh = (mCreationDate > last_expansion_utc); + +#if DEBUGGING_FRESHNESS + if (mFresh) + { + llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << llendl; + } +#endif + } + else + { + mFresh = true; + } +} + +void LLInboxFolderViewItem::deFreshify() +{ + mFresh = false; + + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); +} + +void LLInboxFolderViewItem::setCreationDate(time_t creation_date_utc) +{ + mCreationDate = creation_date_utc; + + if (mParentFolder == mRoot) + { + computeFreshness(); + } +} + // eof diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h index 46eeb9ea7f..09b14ec547 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.h +++ b/indra/newview/llpanelmarketplaceinboxinventory.h @@ -69,16 +69,15 @@ public: }; LLInboxFolderViewFolder(const Params& p); - ~LLInboxFolderViewFolder(); void draw(); - void computeFreshness(); - void deFreshify(); - void selectItem(); void toggleOpen(); + void computeFreshness(); + void deFreshify(); + bool isFresh() const { return mFresh; } protected: @@ -88,15 +87,36 @@ protected: }; -class LLInboxFolderViewItem : public LLFolderViewItem +class LLInboxFolderViewItem : public LLFolderViewItem, public LLBadgeOwner { public: - LLInboxFolderViewItem(const Params& p) - : LLFolderViewItem(p) + struct Params : public LLInitParam::Block { - } + Optional new_badge; + + Params() + : new_badge("new_badge") + { + } + }; + + LLInboxFolderViewItem(const Params& p); BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + + void draw(); + + void selectItem(); + + void computeFreshness(); + void deFreshify(); + + bool isFresh() const { return mFresh; } + +protected: + void setCreationDate(time_t creation_date_utc); + + bool mFresh; }; #endif //LL_INBOXINVENTORYPANEL_H diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml new file mode 100644 index 0000000000..7a7a6e9a09 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml @@ -0,0 +1,19 @@ + + + + -- cgit v1.2.3 From 5406ebad3e2073a860ced69094bbfb76880ce999 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 31 Oct 2011 17:20:44 -0500 Subject: SH-2521 Put back "high detail" terrain render when basic shaders disabled (still broken). --- indra/newview/lldrawpoolterrain.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index d61df9c048..3e9d30283a 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -198,7 +198,7 @@ void LLDrawPoolTerrain::render(S32 pass) return; } // Render simplified land if video card can't do sufficient multitexturing - if (!LLGLSLShader::sNoFixedFunction || !gGLManager.mHasARBEnvCombine || (gGLManager.mNumTextureUnits < 2)) + if (!gGLManager.mHasARBEnvCombine || (gGLManager.mNumTextureUnits < 2)) { renderSimple(); // Render without multitexture return; @@ -223,11 +223,16 @@ void LLDrawPoolTerrain::render(S32 pass) { gPipeline.enableLightsStatic(); - if (sDetailMode == 0){ + if (sDetailMode == 0) + { renderSimple(); - } else if (gGLManager.mNumTextureUnits < 4){ + } + else if (gGLManager.mNumTextureUnits < 4) + { renderFull2TU(); - } else { + } + else + { renderFull4TU(); } } -- cgit v1.2.3 From 2777ddd0607caeeee16deae79ca8284bdaccd261 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 31 Oct 2011 15:35:04 -0700 Subject: Added more logging and elapsed time counter to log message. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 5098f3cea5..c7c66e5895 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -25,12 +25,11 @@ * $/LicenseInfo$ * @endcond */ - #include "llqtwebkit.h" - #include "linden_common.h" #include "indra_constants.h" // for indra keyboard codes +#include "lltimer.h" #include "llgl.h" #include "llplugininstance.h" @@ -117,15 +116,19 @@ private: F32 mBackgroundG; F32 mBackgroundB; std::string mTarget; - + LLTimer mElapsedTime; + VolumeCatcher mVolumeCatcher; void postDebugMessage( const std::string& msg ) { if ( mEnableMediaPluginDebugging ) { + std::stringstream str; + str << "@Media Msg> " << "[" << (double)mElapsedTime.getElapsedTimeF32() << "] -- " << msg; + LLPluginMessage debug_message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "debug_message"); - debug_message.setValue("message_text", "Media> " + msg); + debug_message.setValue("message_text", str.str()); debug_message.setValue("message_level", "info"); sendMessage(debug_message); } @@ -594,6 +597,10 @@ private: // These could be passed through as well, but aren't really needed. // message.setValue("uri", event.getEventUri()); // message.setValueBoolean("dead", (event.getIntValue() != 0)) + + // debug spam + postDebugMessage( "Sending cookie_set message from plugin: " + event.getStringValue() ); + sendMessage(message); } @@ -874,6 +881,8 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction host_ mPluginsEnabled = true; // default to on mEnableMediaPluginDebugging = false; mUserAgent = "LLPluginMedia Web Browser"; + + mElapsedTime.reset(); } MediaPluginWebKit::~MediaPluginWebKit() @@ -1343,6 +1352,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) else if(message_name == "set_cookies") { LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies")); + + // debug spam + postDebugMessage( "Plugin setting cookie: " + message_in.getValue("cookies") ); } else if(message_name == "proxy_setup") { -- cgit v1.2.3 From b403a9da23a2df73a657bfa835a3706a261af2fb Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 31 Oct 2011 15:45:13 -0700 Subject: Enabling outbox --- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/llsidepanelinventory.cpp | 2 +- indra/newview/llviewermedia.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0e27bd81be..0e1e6265aa 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -71,7 +71,7 @@ #include "llwearablelist.h" // Marketplace outbox current disabled -#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 0 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_PANEL +#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_PANEL typedef std::pair two_uuids_t; typedef std::list two_uuids_list_t; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 91f8035556..03d9f9817d 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -69,7 +69,7 @@ static LLRegisterPanelClassWrapper t_inventory("sidepanel_ #define AUTO_EXPAND_INBOX 0 // Temporarily disabling the outbox until we straighten out the API -#define ENABLE_MERCHANT_OUTBOX_PANEL 0 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU +#define ENABLE_MERCHANT_OUTBOX_PANEL 1 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU static const char * const INBOX_BUTTON_NAME = "inbox_btn"; static const char * const OUTBOX_BUTTON_NAME = "outbox_btn"; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 41b4dc01e8..d81bed0f12 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1368,7 +1368,7 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom // This is defined in two files but I don't want to create a dependence between this and llsidepanelinventory // just to be able to temporarily disable the outbox. -#define ENABLE_INVENTORY_DISPLAY_OUTBOX 0 // keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU +#define ENABLE_INVENTORY_DISPLAY_OUTBOX 1 // keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU class LLInventoryUserStatusResponder : public LLHTTPClient::Responder { -- cgit v1.2.3 From 0f79a053c329e9b3206527badfc66e02605506d6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 31 Oct 2011 16:08:21 -0700 Subject: Added tag 3.2.1-start for changeset c4911ec8cd81 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 94c1b79417..d735100657 100644 --- a/.hgtags +++ b/.hgtags @@ -213,3 +213,4 @@ e440cd1dfbd128d7d5467019e497f7f803640ad6 3.2.0-beta1 9bcc2b7176634254e501e3fb4c5b56c1f637852e 3.2.0-beta2 2a13d30ee50ccfed50268238e36bb90d738ccc9e DRTVWR-98_3.2.0-beta3 2a13d30ee50ccfed50268238e36bb90d738ccc9e 3.2.0-beta3 +c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start -- cgit v1.2.3 From 8f47f2222c207938c8fc55158a6fff64ccf1e781 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 31 Oct 2011 16:08:55 -0700 Subject: increment viewer version to 3.2.1 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index aa37a03ef8..fc1c1449da 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_PATCH = 2; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From f76143a74ebbd9faf84fdcdee7fbf81a4090aafc Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 31 Oct 2011 16:25:34 -0700 Subject: sync with viewer-development --- .../skins/default/xui/en/floater_chat_bar.xml | 97 ++++++++++++---------- .../skins/default/xui/en/floater_outgoing_call.xml | 1 + .../skins/default/xui/en/floater_toybox.xml | 2 +- .../default/xui/en/floater_voice_controls.xml | 2 +- .../newview/skins/default/xui/en/menu_toolbars.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 11 ++- .../skins/default/xui/en/panel_status_bar.xml | 7 +- .../skins/default/xui/en/panel_topinfo_bar.xml | 2 +- indra/newview/skins/default/xui/en/strings.xml | 6 +- .../skins/default/xui/en/widgets/toolbar.xml | 4 + 10 files changed, 78 insertions(+), 56 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml index 989b4a0580..87606c1a2a 100644 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -15,6 +15,7 @@ min_height="60" min_width="150" can_resize="true" + default_tab_group="1" name="chat_bar" width="380"> - - - - + + + + diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml index 9db6568ee3..ffbb6aa28b 100644 --- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml +++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml @@ -8,6 +8,7 @@ layout="topleft" name="outgoing call" help_topic="outgoing_call" + save_dock_state="true" title="CALLING" width="410"> - + - + + + + name="balance_bg"> [mthnum,datetime,utc]/[day,datetime,utc]/[year,datetime,utc] - + Balance Credits Debits @@ -3711,6 +3711,10 @@ Try enclosing path to the editor with double quotes. Changing camera angle Volume controls for calls and people near you in world + currently in your bottom toolbar + currently in your left toolbar + currently in your right toolbar + Retain% Detail diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 7e7a9c61cf..0aa478ace9 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -30,6 +30,8 @@ image_overlay_alignment="left" use_ellipses="true" auto_resize="true" + button_flash_count="99999" + button_flash_rate="1.0" flash_color="EmphasisColor"/> -- cgit v1.2.3 From 26b6dd4cf568b345f2350053b840adb8ed6203de Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 1 Nov 2011 16:04:07 +0200 Subject: STORM-1677 FIXED Fixed gcc 4.5 build. --- indra/llui/llkeywords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index d050cd7d7c..ac34015393 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -51,7 +51,7 @@ public: * - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with. * - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close. */ - typedef enum TOKEN_TYPE + enum TOKEN_TYPE { WORD, LINE, -- cgit v1.2.3 From b4edfb1c1dea7940d10c7fd9a699f49562f3096e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 1 Nov 2011 16:32:00 +0200 Subject: STORM-1676 FIXED Removed "Powered by Google" label from the nearby chat floater. --- indra/newview/skins/default/xui/da/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/da/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/de/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/de/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/de/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/en/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/es/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/es/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/es/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/fr/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/fr/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/fr/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/it/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/it/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/it/panel_preferences_chat.xml | 4 ++-- indra/newview/skins/default/xui/ja/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/ja/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/ja/panel_preferences_chat.xml | 4 ++-- indra/newview/skins/default/xui/pl/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/pl/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/pt/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/pt/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/pt/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/ru/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/ru/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/ru/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/tr/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/tr/panel_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/tr/panel_preferences_chat.xml | 2 +- indra/newview/skins/default/xui/zh/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/zh/panel_preferences_chat.xml | 2 +- 31 files changed, 33 insertions(+), 33 deletions(-) diff --git a/indra/newview/skins/default/xui/da/floater_nearby_chat.xml b/indra/newview/skins/default/xui/da/floater_nearby_chat.xml index bd17224259..76bc40edac 100644 --- a/indra/newview/skins/default/xui/da/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/da/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/da/panel_preferences_chat.xml b/indra/newview/skins/default/xui/da/panel_preferences_chat.xml index f0f6242fff..890a3038ef 100644 --- a/indra/newview/skins/default/xui/da/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/da/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Benyt maskinel oversættelse ved chat (hÃ¥ndteret af Google) + Benyt maskinel oversættelse ved chat Oversæt chat til : diff --git a/indra/newview/skins/default/xui/de/floater_nearby_chat.xml b/indra/newview/skins/default/xui/de/floater_nearby_chat.xml index bbb4114200..2aabbb18f2 100644 --- a/indra/newview/skins/default/xui/de/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/de/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/de/panel_nearby_chat.xml b/indra/newview/skins/default/xui/de/panel_nearby_chat.xml index c3ce42efa1..2068c39024 100644 --- a/indra/newview/skins/default/xui/de/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/de/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml index 104f89b80c..04f6c27330 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Beim Chatten Maschinenübersetzung verwenden (von Google bereitgestellt) + Beim Chatten Maschinenübersetzung verwenden Chat übersetzen in: diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml index f766236b2e..d492f9bd68 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -11,7 +11,7 @@ control_name="TranslateChat" enabled="true" height="16" - label="Translate chat (powered by Google)" + label="Translate chat" layout="topleft" left="5" name="translate_chat_checkbox" diff --git a/indra/newview/skins/default/xui/es/floater_nearby_chat.xml b/indra/newview/skins/default/xui/es/floater_nearby_chat.xml index 1fee9ab056..b3b8cdcfff 100644 --- a/indra/newview/skins/default/xui/es/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/es/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml index 95ce14c9a7..5a852a6711 100644 --- a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml index 4625075aa5..e822585566 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Usar en el chat el traductor automático de Google + Usar en el chat el traductor automático Traducir el chat al: diff --git a/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml b/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml index 9b1b21c434..8bbd34baae 100644 --- a/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml index 98eddf196b..31cb3308e3 100644 --- a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml index 646f53704c..fa026d8106 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Utiliser la traduction automatique lors des chats (fournie par Google) + Utiliser la traduction automatique lors des chats Traduire le chat en : diff --git a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml index 4c41df8a62..9e81899880 100644 --- a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml index 7afc3cd7e7..1b529e2737 100644 --- a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml index 72e687b6d1..1a0a1d8434 100644 --- a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml @@ -29,9 +29,9 @@ - + - Usa la traduzione meccanica durante le chat (tecnologia Google) + Usa la traduzione meccanica durante le chat Traduci chat in: diff --git a/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml b/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml index a29c6a0630..bcddcc6907 100644 --- a/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml index 4334659557..aca055bb43 100644 --- a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml index c8584ccaae..1502442a06 100644 --- a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml @@ -29,9 +29,9 @@ - + - ãƒãƒ£ãƒƒãƒˆä¸­ã«å†…容を機械翻訳ã™ã‚‹ï¼ˆGoogle翻訳) + ãƒãƒ£ãƒƒãƒˆä¸­ã«å†…容を機械翻訳ã™ã‚‹ 翻訳ã™ã‚‹è¨€èªžï¼š diff --git a/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml b/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml index 7dc3e1f22e..214d465f1c 100644 --- a/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml index be730eb73f..7fd1029e6a 100644 --- a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Użyj translatora podczas rozmowy (wspierany przez Google) + Użyj translatora podczas rozmowy PrzetÅ‚umacz czat na: diff --git a/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml b/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml index 60edfa505f..653861f7d8 100644 --- a/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml index 9d44c7f62d..15470dc94a 100644 --- a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml index e5aa42aae0..f98659aa73 100644 --- a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Traduzir bate-papo automaticamente (via Google) + Traduzir bate-papo automaticamente Traduzir bate-papo para: diff --git a/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml b/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml index fd3c9f3512..184c753e40 100644 --- a/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml index a371040b74..1d26eecf87 100644 --- a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml index 5e4130667f..f1095065a5 100644 --- a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - ИÑпользовать машинный перевод во Ð²Ñ€ÐµÐ¼Ñ Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ (иÑпользуетÑÑ Google) + ИÑпользовать машинный перевод во Ð²Ñ€ÐµÐ¼Ñ Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ ÐŸÐµÑ€ÐµÐ²Ð¾Ð´Ð¸Ñ‚ÑŒ чат на: diff --git a/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml b/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml index 6570c4379c..6b12ad0ef5 100644 --- a/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml index 73da726cb2..c405105e00 100644 --- a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml index aeef737420..9c9e960715 100644 --- a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - Sohbet ederken makine çevirisi kullanılsın (Google tarafından desteklenir) + Sohbet ederken makine çevirisi kullanılsın Sohbeti ÅŸu dile çevir: diff --git a/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml b/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml index f0c34acb06..38a5dab523 100644 --- a/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml b/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml index fc326c2ce2..738c77fd08 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - èŠå¤©æ™‚使用機器自動進行翻譯(由 Google 所æ供) + èŠå¤©æ™‚使用機器自動進行翻譯 èŠå¤©ç¿»è­¯ç‚ºï¼š -- cgit v1.2.3 From 5b1f9f3c5e9176a971c942da7688d8b194b12ed3 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 1 Nov 2011 18:11:21 +0200 Subject: EXP-1489 FIXED (Cannot build notifications not being shown when chat floater closed with chat log toggled open) - Need to check visibility of the floater itself, not only chat panel in it. So I added this check. --- indra/newview/llnotificationtiphandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 2a08a29842..aa009a76fa 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -29,6 +29,7 @@ #include "llfloaterreg.h" #include "llnearbychat.h" +#include "llnearbychatbar.h" #include "llnotificationhandler.h" #include "llnotifications.h" #include "lltoastnotifypanel.h" @@ -93,7 +94,8 @@ bool LLTipHandler::processNotification(const LLSD& notify) // don't show toast if Nearby Chat is opened LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if (nearby_chat->getVisible()) + LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); + if (nearby_chat_bar->getVisible() && nearby_chat->getVisible()) { return false; } -- cgit v1.2.3 From ba2fa73aaab5415c38fd9f489c590d8cba05e24f Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 1 Nov 2011 18:54:21 +0200 Subject: EXP-1472 FIXED (More spillover list scrolls up after selecting any content menu item) - Saving last scroll position of menu --- indra/llui/llmenugl.cpp | 5 +++-- indra/llui/llmenugl.h | 4 ++++ indra/newview/llfavoritesbar.cpp | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 3ef8d8ff35..cb237fca7c 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1686,7 +1686,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mSpilloverMenu(NULL), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), - mNeedsArrange(FALSE), + mNeedsArrange(FALSE), + mResetScrollPositionOnShow(true), mShortcutPad(p.shortcut_pad) { typedef boost::tokenizer > tokenizer; @@ -3043,7 +3044,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) S32 mouse_x, mouse_y; // Resetting scrolling position - if (menu->isScrollable()) + if (menu->isScrollable() && menu->isScrollPositionOnShowReset()) { menu->mFirstVisibleItem = NULL; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 77db588390..bdae899933 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -516,6 +516,9 @@ public: static class LLMenuHolderGL* sMenuContainer; + void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; } + bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; } + protected: void createSpilloverBranch(); void cleanupSpilloverBranch(); @@ -565,6 +568,7 @@ private: KEY mJumpKey; BOOL mCreateJumpKeys; S32 mShortcutPad; + bool mResetScrollPositionOnShow; }; // end class LLMenuGL diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 6c9058caf1..1f269fb666 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1197,7 +1197,9 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) LLToggleableMenu* menu = (LLToggleableMenu*) mOverflowMenuHandle.get(); if (mRestoreOverflowMenu && menu && !menu->getVisible()) { + menu->resetScrollPositionOnShow(false); showDropDownMenu(); + menu->resetScrollPositionOnShow(true); } } -- cgit v1.2.3 From 3ae3d04e7e73f414a2e17c1be7cf7cca4f894c72 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 1 Nov 2011 19:23:32 +0200 Subject: EXP-1452 FIXED (minimum height of NEARBY CHAT window can be circumvented by minimizing it.) Reason: visibility state of chat was always set to true when floater unminimized Solution: save visibility state of the chat to restore it after floater unminimized --- indra/newview/llnearbychatbar.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 4674c85324..6e22c7fea0 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -403,8 +403,16 @@ void LLNearbyChatBar::setMinimized(BOOL b) { if (b != LLFloater::isMinimized()) { + LLView* nearby_chat = getChildView("nearby_chat"); + + static bool is_visible = nearby_chat->getVisible(); + if (b) + { + is_visible = nearby_chat->getVisible(); + } + + nearby_chat->setVisible(b ? false : is_visible); LLFloater::setMinimized(b); - getChildView("nearby_chat")->setVisible(!b); } } -- cgit v1.2.3 From 74fcb62b3dc0084c61cdf611b2b95ab3b03203bd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 1 Nov 2011 12:33:59 -0500 Subject: SH-2546 Fix for black avatars and terrain on GF Go 7800 (use vec3 instead of float on varying parameters). --- .../app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl | 2 +- .../app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index e8e56e12c1..765b0927c3 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -26,7 +26,7 @@ VARYING vec3 vary_SunlitColor; VARYING vec3 vary_AdditiveColor; -VARYING float vary_AtmosAttenuation; +VARYING vec3 vary_AtmosAttenuation; vec3 getSunlitColor() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index ba2ed6b1ce..99dbee15ee 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -25,7 +25,7 @@ VARYING vec3 vary_AdditiveColor; -VARYING float vary_AtmosAttenuation; +VARYING vec3 vary_AtmosAttenuation; vec3 additive_color; vec3 atmos_attenuation; @@ -80,5 +80,5 @@ void setAdditiveColor(vec3 v) void setAtmosAttenuation(vec3 v) { atmos_attenuation = v; - vary_AtmosAttenuation = v.r; + vary_AtmosAttenuation = v; } -- cgit v1.2.3 From 108cdf58c2def80cf6c88e35c85b6da1c3709b76 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 1 Nov 2011 12:47:06 -0500 Subject: SH-2620 Force FXAA shader to off on OSX --- indra/newview/pipeline.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 76ad7fd83e..85a7691ead 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6405,6 +6405,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) bool multisample = RenderFSAASamples > 1; +#if LL_DARWIN //force FXAA to off on OSX (SH-2620) + multisample = false; +#endif + if (multisample) { //bake out texture2D with RGBL for FXAA shader -- cgit v1.2.3 From b58229a64e2a5c8178f3ac05f944b6cfecc5466b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 1 Nov 2011 14:33:20 -0500 Subject: SH-1427 Fix for sunlight color getting clobbered for non-deferred atmospheric shaders. --- indra/llrender/llshadermgr.cpp | 2 +- .../app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 326c938e8e..810afe210d 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -974,7 +974,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("cloude_noise_texture"); mReservedUniforms.push_back("fullbright"); mReservedUniforms.push_back("lightnorm"); - mReservedUniforms.push_back("sunlight_color"); + mReservedUniforms.push_back("sunlight_color_copy"); mReservedUniforms.push_back("ambient"); mReservedUniforms.push_back("blue_horizon"); mReservedUniforms.push_back("blue_density"); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 89b6a52909..4fe0ef9caf 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -23,7 +23,7 @@ * $/LicenseInfo$ */ -uniform vec4 sunlight_color; +uniform vec4 sunlight_color_copy; uniform vec4 light_ambient; vec3 atmosAmbient(vec3 light) @@ -33,7 +33,7 @@ vec3 atmosAmbient(vec3 light) vec3 atmosAffectDirectionalLight(float lightIntensity) { - return sunlight_color.rgb * lightIntensity; + return sunlight_color_copy.rgb * lightIntensity; } vec3 atmosGetDiffuseSunlightColor() -- cgit v1.2.3 From b6b463dd3927148d1bb20f0bb9aa624ddaed15c4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Nov 2011 15:30:54 -0700 Subject: EXP-1452 FIX minimum height of NEARBY CHAT window can be circumvented by minimizing it. --- indra/newview/llnearbychat.cpp | 25 +++++++++++++------------ indra/newview/llnearbychat.h | 6 +++--- indra/newview/llnearbychatbar.cpp | 9 ++++++--- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 3418462192..a7303ad035 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -60,13 +60,9 @@ static const S32 RESIZE_BAR_THICKNESS = 3; static LLRegisterPanelClassWrapper t_panel_nearby_chat("panel_nearby_chat"); -LLNearbyChat::LLNearbyChat() - : LLPanel() - ,mChatHistory(NULL) -{ -} - -LLNearbyChat::~LLNearbyChat() +LLNearbyChat::LLNearbyChat(const LLNearbyChat::Params& p) +: LLPanel(p), + mChatHistory(NULL) { } @@ -178,15 +174,20 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata) return false; } +void LLNearbyChat::removeScreenChat() +{ + LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))); + if(chat_channel) + { + chat_channel->removeToastsFromChannel(); + } +} + void LLNearbyChat::setVisible(BOOL visible) { if(visible) { - LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))); - if(chat_channel) - { - chat_channel->removeToastsFromChannel(); - } + removeScreenChat(); } LLPanel::setVisible(visible); diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 5ef584c8ff..7c5975cbc5 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -37,8 +37,7 @@ class LLChatHistory; class LLNearbyChat: public LLPanel { public: - LLNearbyChat(); - ~LLNearbyChat(); + LLNearbyChat(const Params& p = LLPanel::getDefaultParams()); BOOL postBuild (); @@ -63,13 +62,14 @@ public: void loadHistory(); static LLNearbyChat* getInstance(); + void removeScreenChat(); private: void getAllowedRect (LLRect& rect); void onNearbySpeakers (); - + private: LLHandle mPopupMenuHandle; diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 4674c85324..c612b14256 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -47,6 +47,7 @@ #include "llviewerwindow.h" #include "llrootview.h" #include "llviewerchat.h" +#include "llnearbychat.h" #include "llresizehandle.h" @@ -401,11 +402,13 @@ void LLNearbyChatBar::onToggleNearbyChatPanel() void LLNearbyChatBar::setMinimized(BOOL b) { - if (b != LLFloater::isMinimized()) + LLNearbyChat* nearby_chat = getChild("nearby_chat"); + // when unminimizing with nearby chat visible, go ahead and kill off screen chats + if (!b && nearby_chat->getVisible()) { - LLFloater::setMinimized(b); - getChildView("nearby_chat")->setVisible(!b); + nearby_chat->removeScreenChat(); } + LLFloater::setMinimized(b); } void LLNearbyChatBar::onChatBoxCommit() -- cgit v1.2.3 From e3287fbe4cbb3ababe9b1d1be691ff4b90b45dd8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 1 Nov 2011 15:51:33 -0700 Subject: EXP-1500 : Hide the toolbars whenever the login box is shown. Also clean up some old FUI debug that is not necessary anymore --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llstartup.cpp | 8 +++++++- indra/newview/llviewerwindow.cpp | 18 +++++++----------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3771222455..8f660008e5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2630,17 +2630,6 @@ Value -1 - DebugToolbarFUI - - Comment - Turn on the FUI Toolbars - Persist - 1 - Type - Boolean - Value - 1 - DebugViews Comment diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e62227fa3c..9d8d1be0f5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -190,6 +190,7 @@ #include "lllogin.h" #include "llevents.h" #include "llstartuplistener.h" +#include "lltoolbarview.h" #if LL_WINDOWS #include "lldxhardware.h" @@ -2091,7 +2092,12 @@ void login_show() #else BOOL bUseDebugLogin = TRUE; #endif - + // Hide the toolbars: may happen to come back here if login fails after login agent but before login in region + if (gToolBarView) + { + gToolBarView->setVisible(FALSE); + } + LLPanelLogin::show( gViewerWindow->getWindowRectScaled(), bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"), login_callback, NULL ); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6fcbc401af..e23ba0faf7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1789,17 +1789,13 @@ void LLViewerWindow::initBase() mLoginPanelHolder = main_view->getChild("login_panel_holder")->getHandle(); // Create the toolbar view - // *TODO: Eventually, suppress the existence of this debug setting and turn toolbar FUI on permanently - if (gSavedSettings.getBOOL("DebugToolbarFUI")) - { - // Get a pointer to the toolbar view holder - LLPanel* panel_holder = main_view->getChild("toolbar_view_holder"); - // Load the toolbar view from file - gToolBarView = LLUICtrlFactory::getInstance()->createFromFile("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance()); - gToolBarView->setShape(panel_holder->getLocalRect()); - // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) - gToolBarView->setVisible(FALSE); - } + // Get a pointer to the toolbar view holder + LLPanel* panel_holder = main_view->getChild("toolbar_view_holder"); + // Load the toolbar view from file + gToolBarView = LLUICtrlFactory::getInstance()->createFromFile("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance()); + gToolBarView->setShape(panel_holder->getLocalRect()); + // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) + gToolBarView->setVisible(FALSE); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild("Floater View"); -- cgit v1.2.3 From 3ad6b8829bd45960d7f8d460a74d13d7d1562ef4 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 1 Nov 2011 16:24:13 -0700 Subject: EXP-1480 FIX --- indra/newview/app_settings/settings_per_account.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 6ed4480cb1..8cdd8ed838 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -36,7 +36,7 @@ DisplayDestinationsOnInitialRun Comment - Display the destinations guide when a user first launches FUI. + Display the destinations guide when a user first launches Second Life. Persist 1 Type -- cgit v1.2.3 From ce693aa79a682ead8a78e2d241137c65db99f40a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Nov 2011 18:26:50 -0700 Subject: cleaned up and commented some code --- indra/llui/lltoolbar.h | 85 ++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index f10f39adc3..8c25c43f1a 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -66,6 +66,7 @@ public: void reshape(S32 width, S32 height, BOOL called_from_parent = true); void setEnabled(BOOL enabled); void setCommandId(const LLCommandId& id) { mId = id; } + LLCommandId getCommandId() { return mId; } void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } @@ -164,7 +165,8 @@ public: pad_bottom, pad_between, min_girth; - // get rid of this + + // default command set Multiple commands; Optional button_panel; @@ -175,8 +177,6 @@ public: // virtuals void draw(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - int getRankFromPosition(S32 x, S32 y); - int getRankFromPosition(const LLCommandId& id); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -185,15 +185,14 @@ public: std::string& tooltip_msg); static const int RANK_NONE = -1; - bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE); int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found - bool hasCommand(const LLCommandId& commandId) const; - bool enableCommand(const LLCommandId& commandId, bool enabled); - bool stopCommandInProgress(const LLCommandId& commandId); - bool flashCommand(const LLCommandId& commandId, bool flash); + bool hasCommand(const LLCommandId& commandId) const; // is this command bound to a button in this toolbar + bool enableCommand(const LLCommandId& commandId, bool enabled); // enable/disable button bound to the specified command, if it exists in this toolbar + bool stopCommandInProgress(const LLCommandId& commandId); // stop command if it is currently active + bool flashCommand(const LLCommandId& commandId, bool flash); // flash button associated with given command, if in this toolbar - void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } // connects drag and drop behavior to external logic void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } bool isReadOnly() const { return mReadOnly; } @@ -206,35 +205,28 @@ public: boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb); boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb); - void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } + // append the specified string to end of tooltip + void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } LLToolBarEnums::SideType getSideType() const { return mSideType; } bool hasButtons() const { return !mButtons.empty(); } bool isModified() const { return mModified; } -protected: - friend class LLUICtrlFactory; - LLToolBar(const Params&); - ~LLToolBar(); - - void initFromParams(const Params&); - tool_startdrag_callback_t mStartDragItemCallback; - tool_handledrag_callback_t mHandleDragItemCallback; - tool_handledrop_callback_t mHandleDropCallback; - bool mDragAndDropTarget; - int mDragRank; - S32 mDragx, - mDragy, - mDragGirth; + int getRankFromPosition(S32 x, S32 y); + int getRankFromPosition(const LLCommandId& id); -public: // Methods used in loading and saving toolbar settings void setButtonType(LLToolBarEnums::ButtonType button_type); LLToolBarEnums::ButtonType getButtonType() { return mButtonType; } command_id_list_t& getCommandsList() { return mButtonCommands; } void clearCommandsList(); - + private: + friend class LLUICtrlFactory; + LLToolBar(const Params&); + ~LLToolBar(); + + void initFromParams(const Params&); void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); @@ -242,33 +234,44 @@ private: BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); +private: + // static layout state const bool mReadOnly; + const LLToolBarEnums::SideType mSideType; + const bool mWrap; + const S32 mPadLeft, + mPadRight, + mPadTop, + mPadBottom, + mPadBetween, + mMinGirth; + + // drag and drop state + tool_startdrag_callback_t mStartDragItemCallback; + tool_handledrag_callback_t mHandleDragItemCallback; + tool_handledrop_callback_t mHandleDropCallback; + bool mDragAndDropTarget; + int mDragRank; + S32 mDragx, + mDragy, + mDragGirth; typedef std::list toolbar_button_list; + typedef std::map command_id_map; toolbar_button_list mButtons; command_id_list_t mButtonCommands; - typedef std::map command_id_map; command_id_map mButtonMap; LLToolBarEnums::ButtonType mButtonType; + LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; + + // related widgets LLLayoutStack* mCenteringStack; - LLLayoutStack* mWrapStack; LLPanel* mButtonPanel; - LLToolBarEnums::SideType mSideType; - - bool mWrap; + LLHandle mPopupMenuHandle; + bool mNeedsLayout; bool mModified; - S32 mPadLeft, - mPadRight, - mPadTop, - mPadBottom, - mPadBetween, - mMinGirth; - - LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; - - LLHandle mPopupMenuHandle; button_signal_t* mButtonAddSignal; button_signal_t* mButtonEnterSignal; -- cgit v1.2.3 From 1bea08335b6c2fa31f414db2fe7316a118b2ec18 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 2 Nov 2011 10:55:12 -0500 Subject: SH-2648 Fix for flickering shadows on 40% transparent objects. --- indra/newview/pipeline.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 85a7691ead..fe29333ab2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8149,10 +8149,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { LLFastTimer ftm(FTM_SHADOW_ALPHA); gDeferredShadowAlphaMaskProgram.bind(); - gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f); + gDeferredShadowAlphaMaskProgram.setAlphaRange(0.598f, 1.f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); gDeferredTreeShadowProgram.bind(); - gDeferredTreeShadowProgram.setAlphaRange(0.6f, 1.f); + gDeferredTreeShadowProgram.setAlphaRange(0.598f, 1.f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } -- cgit v1.2.3 From 65e144d9fec4bb441050e73136ed95b48e6e363c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 2 Nov 2011 19:05:13 +0200 Subject: STORM-1580 WIP Initial commit for PO review. --- indra/newview/CMakeLists.txt | 15 +- indra/newview/app_settings/settings.xml | 44 +- indra/newview/llfloaterpostcard.cpp | 384 --------- indra/newview/llfloaterpostcard.h | 79 -- indra/newview/llfloatersnapshot.cpp | 870 ++++++++++++++------- indra/newview/llfloatersnapshot.h | 29 +- indra/newview/llpanelpostprogress.cpp | 59 ++ indra/newview/llpanelpostresult.cpp | 90 +++ indra/newview/llpanelsnapshot.cpp | 109 +++ indra/newview/llpanelsnapshot.h | 58 ++ indra/newview/llpanelsnapshotinventory.cpp | 152 ++++ indra/newview/llpanelsnapshotlocal.cpp | 209 +++++ indra/newview/llpanelsnapshotoptions.cpp | 94 +++ indra/newview/llpanelsnapshotpostcard.cpp | 336 ++++++++ indra/newview/llpanelsnapshotprofile.cpp | 162 ++++ indra/newview/llpostcard.cpp | 160 ++++ indra/newview/llpostcard.h | 48 ++ indra/newview/llsidetraypanelcontainer.cpp | 7 + indra/newview/llsidetraypanelcontainer.h | 5 + indra/newview/llviewerfloaterreg.cpp | 2 - indra/newview/llviewermedia.cpp | 7 + indra/newview/llviewermenufile.cpp | 18 +- indra/newview/llviewermessage.cpp | 4 +- indra/newview/llviewerwindow.cpp | 6 +- indra/newview/llviewerwindow.h | 2 +- indra/newview/llwebprofile.cpp | 297 +++++++ indra/newview/llwebprofile.h | 69 ++ .../skins/default/textures/snapshot_download.png | Bin 0 -> 1621 bytes .../skins/default/textures/snapshot_email.png | Bin 0 -> 1391 bytes .../skins/default/textures/snapshot_inventory.png | Bin 0 -> 1371 bytes .../skins/default/textures/snapshot_profile.png | Bin 0 -> 1479 bytes indra/newview/skins/default/textures/textures.xml | 4 + .../skins/default/xui/en/floater_postcard.xml | 149 ---- .../skins/default/xui/en/floater_snapshot.xml | 602 ++++++-------- .../skins/default/xui/en/panel_post_progress.xml | 55 ++ .../skins/default/xui/en/panel_post_result.xml | 78 ++ .../default/xui/en/panel_postcard_message.xml | 137 ++++ .../default/xui/en/panel_postcard_settings.xml | 102 +++ .../default/xui/en/panel_snapshot_inventory.xml | 146 ++++ .../skins/default/xui/en/panel_snapshot_local.xml | 191 +++++ .../default/xui/en/panel_snapshot_options.xml | 80 ++ .../default/xui/en/panel_snapshot_postcard.xml | 107 +++ .../default/xui/en/panel_snapshot_profile.xml | 165 ++++ indra/newview/skins/default/xui/en/strings.xml | 8 + 44 files changed, 3811 insertions(+), 1328 deletions(-) delete mode 100644 indra/newview/llfloaterpostcard.cpp delete mode 100644 indra/newview/llfloaterpostcard.h create mode 100644 indra/newview/llpanelpostprogress.cpp create mode 100644 indra/newview/llpanelpostresult.cpp create mode 100644 indra/newview/llpanelsnapshot.cpp create mode 100644 indra/newview/llpanelsnapshot.h create mode 100644 indra/newview/llpanelsnapshotinventory.cpp create mode 100644 indra/newview/llpanelsnapshotlocal.cpp create mode 100644 indra/newview/llpanelsnapshotoptions.cpp create mode 100644 indra/newview/llpanelsnapshotpostcard.cpp create mode 100644 indra/newview/llpanelsnapshotprofile.cpp create mode 100644 indra/newview/llpostcard.cpp create mode 100644 indra/newview/llpostcard.h create mode 100644 indra/newview/llwebprofile.cpp create mode 100644 indra/newview/llwebprofile.h create mode 100644 indra/newview/skins/default/textures/snapshot_download.png create mode 100644 indra/newview/skins/default/textures/snapshot_email.png create mode 100644 indra/newview/skins/default/textures/snapshot_inventory.png create mode 100644 indra/newview/skins/default/textures/snapshot_profile.png delete mode 100644 indra/newview/skins/default/xui/en/floater_postcard.xml create mode 100644 indra/newview/skins/default/xui/en/panel_post_progress.xml create mode 100644 indra/newview/skins/default/xui/en/panel_post_result.xml create mode 100644 indra/newview/skins/default/xui/en/panel_postcard_message.xml create mode 100644 indra/newview/skins/default/xui/en/panel_postcard_settings.xml create mode 100644 indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml create mode 100644 indra/newview/skins/default/xui/en/panel_snapshot_local.xml create mode 100644 indra/newview/skins/default/xui/en/panel_snapshot_options.xml create mode 100644 indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml create mode 100644 indra/newview/skins/default/xui/en/panel_snapshot_profile.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index bef775cdb8..63b05f5a1d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -219,7 +219,6 @@ set(viewer_SOURCE_FILES llfloateropenobject.cpp llfloaterpay.cpp llfloaterperms.cpp - llfloaterpostcard.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp llfloaterproperties.cpp @@ -393,9 +392,17 @@ set(viewer_SOURCE_FILES llpanelplaceprofile.cpp llpanelplaces.cpp llpanelplacestab.cpp + llpanelpostprogress.cpp + llpanelpostresult.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp llpanelprofileview.cpp + llpanelsnapshot.cpp + llpanelsnapshotinventory.cpp + llpanelsnapshotlocal.cpp + llpanelsnapshotoptions.cpp + llpanelsnapshotpostcard.cpp + llpanelsnapshotprofile.cpp llpanelteleporthistory.cpp llpaneltiptoast.cpp llpanelvoiceeffect.cpp @@ -414,6 +421,7 @@ set(viewer_SOURCE_FILES llpopupview.cpp llpolymesh.cpp llpolymorph.cpp + llpostcard.cpp llpreview.cpp llpreviewanim.cpp llpreviewgesture.cpp @@ -603,6 +611,7 @@ set(viewer_SOURCE_FILES llwearablelist.cpp llwearabletype.cpp llweb.cpp + llwebprofile.cpp llwebsharing.cpp llwind.cpp llwindowlistener.cpp @@ -786,7 +795,6 @@ set(viewer_HEADER_FILES llfloateropenobject.h llfloaterpay.h llfloaterperms.h - llfloaterpostcard.h llfloaterpostprocess.h llfloaterpreference.h llfloaterproperties.h @@ -957,6 +965,7 @@ set(viewer_HEADER_FILES llpanelprimmediacontrols.h llpanelprofile.h llpanelprofileview.h + llpanelsnapshot.h llpanelteleporthistory.h llpaneltiptoast.h llpanelvoicedevicesettings.h @@ -975,6 +984,7 @@ set(viewer_HEADER_FILES llpolymesh.h llpolymorph.h llpopupview.h + llpostcard.h llpreview.h llpreviewanim.h llpreviewgesture.h @@ -1164,6 +1174,7 @@ set(viewer_HEADER_FILES llwearablelist.h llwearabletype.h llweb.h + llwebprofile.h llwebsharing.h llwind.h llwindowlistener.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5c0ea2f774..9812b2868f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4667,6 +4667,17 @@ 0.0.0 + LastSnapshotToProfileHeight + + Comment + The height of the last profile snapshot, in px + Persist + 1 + Type + S32 + Value + 768 + LastSnapshotToEmailHeight Comment @@ -4678,6 +4689,17 @@ Value 768 + LastSnapshotToProfileWidth + + Comment + The width of the last profile snapshot, in px + Persist + 1 + Type + S32 + Value + 1024 + LastSnapshotToEmailWidth Comment @@ -4733,17 +4755,6 @@ Value 512 - LastSnapshotType - - Comment - Select this as next type of snapshot to take (0 = postcard, 1 = texture, 2 = local image) - Persist - 1 - Type - S32 - Value - 0 - LeftClickShowMenu Comment @@ -10608,6 +10619,17 @@ Value 0 + SnapshotProfileLastResolution + + Comment + Take next profile snapshot at this resolution + Persist + 1 + Type + S32 + Value + 0 + SnapshotPostcardLastResolution Comment diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp deleted file mode 100644 index 3bcbb987f7..0000000000 --- a/indra/newview/llfloaterpostcard.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/** - * @file llfloaterpostcard.cpp - * @brief Postcard send floater, allows setting name, e-mail address, etc. - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterpostcard.h" - -#include "llfontgl.h" -#include "llsys.h" -#include "llgl.h" -#include "v3dmath.h" -#include "lldir.h" - -#include "llagent.h" -#include "llui.h" -#include "lllineeditor.h" -#include "llbutton.h" -#include "lltexteditor.h" -#include "llfloaterreg.h" -#include "llnotificationsutil.h" -#include "llviewercontrol.h" -#include "llviewernetwork.h" -#include "lluictrlfactory.h" -#include "lluploaddialog.h" -#include "llviewerstats.h" -#include "llviewerwindow.h" -#include "llstatusbar.h" -#include "llviewerregion.h" -#include "lleconomy.h" -#include "message.h" - -#include "llimagejpeg.h" -#include "llimagej2c.h" -#include "llvfile.h" -#include "llvfs.h" -#include "llviewertexture.h" -#include "llassetuploadresponders.h" -#include "llagentui.h" - -#include //boost.regex lib - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -///---------------------------------------------------------------------------- -/// Class LLFloaterPostcard -///---------------------------------------------------------------------------- - -LLFloaterPostcard::LLFloaterPostcard(const LLSD& key) -: LLFloater(key), - mJPEGImage(NULL), - mViewerImage(NULL), - mHasFirstMsgFocus(false) -{ -} - -// Destroys the object -LLFloaterPostcard::~LLFloaterPostcard() -{ - mJPEGImage = NULL; // deletes image -} - -BOOL LLFloaterPostcard::postBuild() -{ - // pick up the user's up-to-date email address - gAgent.sendAgentUserInfoRequest(); - - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("send_btn", onClickSend, this); - - getChildView("from_form")->setEnabled(FALSE); - - std::string name_string; - LLAgentUI::buildFullname(name_string); - getChild("name_form")->setValue(LLSD(name_string)); - - // For the first time a user focusess to .the msg box, all text will be selected. - getChild("msg_form")->setFocusChangedCallback(boost::bind(onMsgFormFocusRecieved, _1, this)); - - getChild("to_form")->setFocus(TRUE); - - return TRUE; -} - -// static -LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global) -{ - // Take the images from the caller - // It's now our job to clean them up - LLFloaterPostcard* instance = LLFloaterReg::showTypedInstance("postcard", LLSD(img->getID())); - - if (instance) // may be 0 if we're in mouselook mode - { - instance->mJPEGImage = jpeg; - instance->mViewerImage = img; - instance->mImageScale = image_scale; - instance->mPosTakenGlobal = pos_taken_global; - } - - return instance; -} - -void LLFloaterPostcard::draw() -{ - LLGLSUIDefault gls_ui; - LLFloater::draw(); - - if(!isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull()) - { - // Force the texture to be 100% opaque when the floater is focused. - F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLRect rect(getRect()); - - // first set the max extents of our preview - rect.translate(-rect.mLeft, -rect.mBottom); - rect.mLeft += 320; - rect.mRight -= 10; - rect.mTop -= 27; - rect.mBottom = rect.mTop - 130; - - // then fix the aspect ratio - F32 ratio = (F32)mJPEGImage->getWidth() / (F32)mJPEGImage->getHeight(); - if ((F32)rect.getWidth() / (F32)rect.getHeight() >= ratio) - { - rect.mRight = LLRect::tCoordType((F32)rect.mLeft + ((F32)rect.getHeight() * ratio)); - } - else - { - rect.mBottom = LLRect::tCoordType((F32)rect.mTop - ((F32)rect.getWidth() / ratio)); - } - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(rect, LLColor4(0.f, 0.f, 0.f, 1.f) % alpha); - rect.stretch(-1); - } - { - - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - { - glScalef(mImageScale.mV[VX], mImageScale.mV[VY], 1.f); - glMatrixMode(GL_MODELVIEW); - gl_draw_scaled_image(rect.mLeft, - rect.mBottom, - rect.getWidth(), - rect.getHeight(), - mViewerImage.get(), - LLColor4::white % alpha); - } - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - } - } -} - -// static -void LLFloaterPostcard::onClickCancel(void* data) -{ - if (data) - { - LLFloaterPostcard *self = (LLFloaterPostcard *)data; - - self->closeFloater(false); - } -} - -class LLSendPostcardResponder : public LLAssetUploadResponder -{ -public: - LLSendPostcardResponder(const LLSD &post_data, - const LLUUID& vfile_id, - LLAssetType::EType asset_type): - LLAssetUploadResponder(post_data, vfile_id, asset_type) - { - } - // *TODO define custom uploadFailed here so it's not such a generic message - void uploadComplete(const LLSD& content) - { - // we don't care about what the server returns from this post, just clean up the UI - LLUploadDialog::modalUploadFinished(); - } -}; - -// static -void LLFloaterPostcard::onClickSend(void* data) -{ - if (data) - { - LLFloaterPostcard *self = (LLFloaterPostcard *)data; - - std::string from(self->getChild("from_form")->getValue().asString()); - std::string to(self->getChild("to_form")->getValue().asString()); - - boost::regex emailFormat("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*"); - - if (to.empty() || !boost::regex_match(to, emailFormat)) - { - LLNotificationsUtil::add("PromptRecipientEmail"); - return; - } - - if (from.empty() || !boost::regex_match(from, emailFormat)) - { - LLNotificationsUtil::add("PromptSelfEmail"); - return; - } - - std::string subject(self->getChild("subject_form")->getValue().asString()); - if(subject.empty() || !self->mHasFirstMsgFocus) - { - LLNotificationsUtil::add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLFloaterPostcard::missingSubjMsgAlertCallback, self, _1, _2)); - return; - } - - if (self->mJPEGImage.notNull()) - { - self->sendPostcard(); - } - else - { - LLNotificationsUtil::add("ErrorProcessingSnapshot"); - } - } -} - -// static -void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLFloaterPostcard *self = (LLFloaterPostcard *)user_data; - - LLUploadDialog::modalUploadFinished(); - - if (result) - { - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); - LLNotificationsUtil::add("ErrorUploadingPostcard", args); - } - else - { - // only create the postcard once the upload succeeds - - // request the postcard - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("SendPostcard"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->addUUID("AssetID", self->mAssetID); - msg->addVector3d("PosGlobal", self->mPosTakenGlobal); - msg->addString("To", self->getChild("to_form")->getValue().asString()); - msg->addString("From", self->getChild("from_form")->getValue().asString()); - msg->addString("Name", self->getChild("name_form")->getValue().asString()); - msg->addString("Subject", self->getChild("subject_form")->getValue().asString()); - msg->addString("Msg", self->getChild("msg_form")->getValue().asString()); - msg->addBOOL("AllowPublish", FALSE); - msg->addBOOL("MaturePublish", FALSE); - gAgent.sendReliableMessage(); - } - - self->closeFloater(); -} - -// static -void LLFloaterPostcard::updateUserInfo(const std::string& email) -{ - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("postcard"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) - { - LLFloater* instance = *iter; - const std::string& text = instance->getChild("from_form")->getValue().asString(); - if (text.empty()) - { - // there's no text in this field yet, pre-populate - instance->getChild("from_form")->setValue(LLSD(email)); - } - } -} - -void LLFloaterPostcard::onMsgFormFocusRecieved(LLFocusableElement* receiver, void* data) -{ - LLFloaterPostcard* self = (LLFloaterPostcard *)data; - if(self) - { - LLTextEditor* msgForm = self->getChild("msg_form"); - if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus)) - { - self->mHasFirstMsgFocus = true; - msgForm->setText(LLStringUtil::null); - } - } -} - -bool LLFloaterPostcard::missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if(0 == option) - { - // User clicked OK - if((getChild("subject_form")->getValue().asString()).empty()) - { - // Stuff the subject back into the form. - getChild("subject_form")->setValue(getString("default_subject")); - } - - if(!mHasFirstMsgFocus) - { - // The user never switched focus to the messagee window. - // Using the default string. - getChild("msg_form")->setValue(getString("default_message")); - } - - sendPostcard(); - } - return false; -} - -void LLFloaterPostcard::sendPostcard() -{ - mTransactionID.generate(); - mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); - LLVFile::writeFile(mJPEGImage->getData(), mJPEGImage->getDataSize(), gVFS, mAssetID, LLAssetType::AT_IMAGE_JPEG); - - // upload the image - std::string url = gAgent.getRegion()->getCapability("SendPostcard"); - if(!url.empty()) - { - llinfos << "Send Postcard via capability" << llendl; - LLSD body = LLSD::emptyMap(); - // the capability already encodes: agent ID, region ID - body["pos-global"] = mPosTakenGlobal.getValue(); - body["to"] = getChild("to_form")->getValue().asString(); - body["from"] = getChild("from_form")->getValue().asString(); - body["name"] = getChild("name_form")->getValue().asString(); - body["subject"] = getChild("subject_form")->getValue().asString(); - body["msg"] = getChild("msg_form")->getValue().asString(); - LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG)); - } - else - { - gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE); - } - - // give user feedback of the event - gViewerWindow->playSnapshotAnimAndSound(); - LLUploadDialog::modalUploadDialog(getString("upload_message")); - - // don't destroy the window until the upload is done - // this way we keep the information in the form - setVisible(FALSE); - - // also remove any dependency on another floater - // so that we can be sure to outlive it while we - // need to. - LLFloater* dependee = getDependee(); - if (dependee) - dependee->removeDependentFloater(this); -} diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h deleted file mode 100644 index 472592154f..0000000000 --- a/indra/newview/llfloaterpostcard.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file llfloaterpostcard.h - * @brief Postcard send floater, allows setting name, e-mail address, etc. - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERPOSTCARD_H -#define LL_LLFLOATERPOSTCARD_H - -#include "llfloater.h" -#include "llcheckboxctrl.h" - -#include "llpointer.h" - -class LLTextEditor; -class LLLineEditor; -class LLButton; -class LLViewerTexture; -class LLImageJPEG; - -class LLFloaterPostcard -: public LLFloater -{ -public: - LLFloaterPostcard(const LLSD& key); - virtual ~LLFloaterPostcard(); - - virtual BOOL postBuild(); - virtual void draw(); - - static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); - - static void onClickCancel(void* data); - static void onClickSend(void* data); - - static void uploadCallback(const LLUUID& asset_id, - void *user_data, - S32 result, LLExtStat ext_status); - - static void updateUserInfo(const std::string& email); - - static void onMsgFormFocusRecieved(LLFocusableElement* receiver, void* data); - bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); - - void sendPostcard(); - -private: - - LLPointer mJPEGImage; - LLPointer mViewerImage; - LLTransactionID mTransactionID; - LLAssetID mAssetID; - LLVector2 mImageScale; - LLVector3d mPosTakenGlobal; - bool mHasFirstMsgFocus; -}; - - -#endif // LL_LLFLOATERPOSTCARD_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 8105844b0d..c8c66931a1 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -42,6 +42,8 @@ #include "llcombobox.h" #include "lleconomy.h" #include "lllandmarkactions.h" +#include "llpanelsnapshot.h" +#include "llsidetraypanelcontainer.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llviewercontrol.h" @@ -50,9 +52,7 @@ #include "llviewercamera.h" #include "llviewerwindow.h" #include "llviewermenufile.h" // upload_new_resource() -#include "llfloaterpostcard.h" #include "llcheckboxctrl.h" -#include "llradiogroup.h" #include "llslurl.h" #include "lltoolfocus.h" #include "lltoolmgr.h" @@ -76,18 +76,17 @@ #include "llimagej2c.h" #include "lllocalcliprect.h" #include "llnotificationsutil.h" +#include "llpostcard.h" #include "llresmgr.h" // LLLocale #include "llvfile.h" #include "llvfs.h" +#include "llwebprofile.h" #include "llwindow.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -S32 LLFloaterSnapshot::sUIWinHeightLong = 530 ; -S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 240 ; -S32 LLFloaterSnapshot::sUIWinWidth = 215 ; - +LLRect LLFloaterSnapshot::sThumbnailPlaceholderRect; LLSnapshotFloaterView* gSnapshotFloaterView = NULL; const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; @@ -101,6 +100,9 @@ S32 BORDER_WIDTH = 6; const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +static std::string lastSnapshotWidthName(S32 shot_type); +static std::string lastSnapshotHeightName(S32 shot_type); + static LLDefaultChildRegistry::Register r("snapshot_floater_view"); ///---------------------------------------------------------------------------- @@ -108,6 +110,7 @@ static LLDefaultChildRegistry::Register r("snapshot_float ///---------------------------------------------------------------------------- class LLSnapshotLivePreview : public LLView { + LOG_CLASS(LLSnapshotLivePreview); public: enum ESnapshotType { @@ -154,6 +157,7 @@ public: F32 getAspect() ; LLRect getImageRect(); BOOL isImageScaled(); + const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; } void setSnapshotType(ESnapshotType type) { mSnapshotType = type; } void setSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat type) { mSnapshotFormat = type; } @@ -161,10 +165,12 @@ public: void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; } void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f); void saveWeb(); - LLFloaterPostcard* savePostcard(); void saveTexture(); BOOL saveLocal(); + LLPointer getFormattedImage() const { return mFormattedImage; } + LLPointer getEncodedImage() const { return mPreviewImageEncoded; } + BOOL setThumbnailImageSize() ; void generateThumbnailImage(BOOL force_update = FALSE) ; void resetThumbnailImage() { mThumbnailImage = NULL ; } @@ -327,7 +333,8 @@ BOOL LLSnapshotLivePreview::isImageScaled() } void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) -{ +{ + lldebugs << "updateSnapshot: mSnapshotUpToDate = " << mSnapshotUpToDate << llendl; if (mSnapshotUpToDate) { S32 old_image_index = mCurImageIndex; @@ -367,6 +374,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail { mSnapshotDelayTimer.start(); mSnapshotDelayTimer.setTimerExpirySec(delay); + LLFloaterSnapshot::preUpdate(); } if(new_thumbnail) { @@ -629,8 +637,10 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height); // UI size for thumbnail - S32 max_width = LLFloaterSnapshot::getUIWinWidth() - 20; - S32 max_height = 90; + // *FIXME: the rect does not change, so maybe there's no need to recalculate max w/h. + const LLRect& thumbnail_rect = LLFloaterSnapshot::getThumbnailPlaceholderRect(); + S32 max_width = thumbnail_rect.getWidth(); + S32 max_height = thumbnail_rect.getHeight(); if (window_aspect_ratio > (F32)max_width / max_height) { @@ -746,7 +756,15 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) //static BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; + +#if 1 // XXX tmp + if (previewp->mWidth[previewp->mCurImageIndex] == 0 || previewp->mHeight[previewp->mCurImageIndex] == 0) + { + llwarns << "Incorrect dimensions: " << previewp->mWidth[previewp->mCurImageIndex] << "x" << previewp->mHeight[previewp->mCurImageIndex] << llendl; + return FALSE; + } +#endif LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin(); LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion(); @@ -774,6 +792,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) // time to produce a snapshot + lldebugs << "producing snapshot" << llendl; if (!previewp->mPreviewImage) { previewp->mPreviewImage = new LLImageRaw; @@ -809,6 +828,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) if(previewp->getSnapshotType() == SNAPSHOT_TEXTURE) { + lldebugs << "Encoding new image of format J2C" << llendl; LLPointer formatted = new LLImageJ2C; LLPointer scaled = new LLImageRaw( previewp->mPreviewImage->getData(), @@ -841,6 +861,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { format = previewp->getSnapshotFormat(); } + lldebugs << "Encoding new image of format " << format << llendl; switch(format) { @@ -920,12 +941,15 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { previewp->generateThumbnailImage() ; } + lldebugs << "done creating snapshot" << llendl; + LLFloaterSnapshot::postUpdate(); return TRUE; } void LLSnapshotLivePreview::setSize(S32 w, S32 h) { + lldebugs << "setSize(" << w << ", " << h << ")" << llendl; mWidth[mCurImageIndex] = w; mHeight[mCurImageIndex] = h; } @@ -936,40 +960,9 @@ void LLSnapshotLivePreview::getSize(S32& w, S32& h) const h = mHeight[mCurImageIndex]; } -LLFloaterPostcard* LLSnapshotLivePreview::savePostcard() -{ - if(mViewerImage[mCurImageIndex].isNull()) - { - //this should never happen!! - llwarns << "The snapshot image has not been generated!" << llendl ; - return NULL ; - } - - // calculate and pass in image scale in case image data only use portion - // of viewerimage buffer - LLVector2 image_scale(1.f, 1.f); - if (!isImageScaled()) - { - image_scale.setVec(llmin(1.f, (F32)mWidth[mCurImageIndex] / (F32)getCurrentImage()->getWidth()), llmin(1.f, (F32)mHeight[mCurImageIndex] / (F32)getCurrentImage()->getHeight())); - } - - LLImageJPEG* jpg = dynamic_cast(mFormattedImage.get()); - if(!jpg) - { - llwarns << "Formatted image not a JPEG" << llendl; - return NULL; - } - LLFloaterPostcard* floater = LLFloaterPostcard::showFromSnapshot(jpg, mViewerImage[mCurImageIndex], image_scale, mPosTakenGlobal); - // relinquish lifetime of jpeg image to postcard floater - mFormattedImage = NULL; - mDataSize = 0; - updateSnapshot(FALSE, FALSE); - - return floater; -} - void LLSnapshotLivePreview::saveTexture() { + lldebugs << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << llendl; // gen a new uuid for this asset LLTransactionID tid; tid.generate(); @@ -982,6 +975,7 @@ void LLSnapshotLivePreview::saveTexture() mPreviewImage->getComponents()); scaled->biasedScaleToPowerOfTwo(512); + lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl; if (formatted->encode(scaled, 0.0f)) { @@ -1020,9 +1014,10 @@ void LLSnapshotLivePreview::saveTexture() BOOL LLSnapshotLivePreview::saveLocal() { - BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage); + BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage, true); // Relinquish image memory. Save button will be disabled as a side-effect. + lldebugs << "resetting formatted image after saving to disk" << llendl; mFormattedImage = NULL; mDataSize = 0; updateSnapshot(FALSE, FALSE); @@ -1080,29 +1075,40 @@ public: mAvatarPauseHandles.clear(); } - static void onClickDiscard(void* data); - static void onClickKeep(void* data); - static void onCommitSave(LLUICtrl* ctrl, void* data); static void onClickNewSnapshot(void* data); static void onClickAutoSnap(LLUICtrl *ctrl, void* data); //static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data); - static void onClickLess(void* data) ; static void onClickMore(void* data) ; static void onClickUICheck(LLUICtrl *ctrl, void* data); static void onClickHUDCheck(LLUICtrl *ctrl, void* data); static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data); +#if 0 static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); - static void onCommitQuality(LLUICtrl* ctrl, void* data); +#endif + static void applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked); static void onCommitResolution(LLUICtrl* ctrl, void* data) { updateResolution(ctrl, data); } static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); + static void onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val); + static void onImageFormatChange(LLFloaterSnapshot* view); +#if 0 static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); - static void onCommitSnapshotFormat(LLUICtrl* ctrl, void* data); static void onCommitCustomResolution(LLUICtrl *ctrl, void* data); +#endif + static void applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h); + static void onSnapshotUploadFinished(LLSideTrayPanelContainer* panel_container, bool status); + static void onSendingPostcardFinished(LLSideTrayPanelContainer* panel_container, bool status); static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ; static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); + static LLPanelSnapshot* getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found = true); + static LLSnapshotLivePreview::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater); + static LLFloaterSnapshot::ESnapshotFormat getImageFormat(LLFloaterSnapshot* floater); + static LLSpinCtrl* getWidthSpinner(LLFloaterSnapshot* floater); + static LLSpinCtrl* getHeightSpinner(LLFloaterSnapshot* floater); + static void enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable); + static LLSnapshotLivePreview* getPreviewView(LLFloaterSnapshot *floater); static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname); static void updateControls(LLFloaterSnapshot* floater); @@ -1110,9 +1116,8 @@ public: static void updateResolutionTextEntry(LLFloaterSnapshot* floater); private: - static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); + static LLSnapshotLivePreview::ESnapshotType getTypeIndex(const std::string& id); static LLSD getTypeName(LLSnapshotLivePreview::ESnapshotType index); - static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater); static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname); static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); @@ -1126,6 +1131,77 @@ public: bool mAspectRatioCheckOff ; }; +// static +LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found) +{ + LLSideTrayPanelContainer* panel_container = floater->getChild("panel_container"); + LLPanelSnapshot* active_panel = dynamic_cast(panel_container->getCurrentPanel()); + if (!ok_if_not_found) + { + llassert_always(active_panel != NULL); + } + return active_panel; +} + +// static +LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getActiveSnapshotType(LLFloaterSnapshot* floater) +{ + LLSnapshotLivePreview::ESnapshotType type = LLSnapshotLivePreview::SNAPSHOT_WEB; + std::string name; + LLPanelSnapshot* spanel = getActivePanel(floater); + + if (spanel) + { + name = spanel->getName(); + } + + if (name == "panel_snapshot_postcard") + { + type = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; + } + else if (name == "panel_snapshot_inventory") + { + type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; + } + else if (name == "panel_snapshot_local") + { + type = LLSnapshotLivePreview::SNAPSHOT_LOCAL; + } + + return type; +} + +// static +LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshot* floater) +{ + LLPanelSnapshot* active_panel = getActivePanel(floater); + return active_panel ? active_panel->getImageFormat() : LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; +} + +// static +LLSpinCtrl* LLFloaterSnapshot::Impl::getWidthSpinner(LLFloaterSnapshot* floater) +{ + LLPanelSnapshot* active_panel = getActivePanel(floater); + return active_panel ? active_panel->getWidthSpinner() : floater->getChild("snapshot_width"); +} + +// static +LLSpinCtrl* LLFloaterSnapshot::Impl::getHeightSpinner(LLFloaterSnapshot* floater) +{ + LLPanelSnapshot* active_panel = getActivePanel(floater); + return active_panel ? active_panel->getHeightSpinner() : floater->getChild("snapshot_height"); +} + +// static +void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable) +{ + LLPanelSnapshot* active_panel = getActivePanel(floater); + if (active_panel) + { + active_panel->enableAspectRatioCheckbox(enable); + } +} + // static LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) { @@ -1134,12 +1210,10 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot } // static -LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) +LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(const std::string& id) { LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; - LLSD value = floater->getChild("snapshot_type_radio")->getValue(); - const std::string id = value.asString(); if (id == "postcard") { index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; @@ -1183,26 +1257,6 @@ LLSD LLFloaterSnapshot::Impl::getTypeName(LLSnapshotLivePreview::ESnapshotType i return LLSD(id); } -// static -LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) -{ - ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; - if(floater->hasChild("local_format_combo")) - { - LLComboBox* local_format_combo = floater->findChild("local_format_combo"); - const std::string id = local_format_combo->getSelectedItemLabel(); - if (id == "PNG") - index = SNAPSHOT_FORMAT_PNG; - else if (id == "JPEG") - index = SNAPSHOT_FORMAT_JPEG; - else if (id == "BMP") - index = SNAPSHOT_FORMAT_BMP; - } - return index; -} - - - // static LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) { @@ -1229,12 +1283,27 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) { LLSnapshotLivePreview* previewp = getPreviewView(floaterp); - S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ; + bool advanced = gSavedSettings.getBOOL("AdvanceSnapshot"); + + // Show/hide advanced options. + LLPanel* advanced_options_panel = floaterp->getChild("advanced_options_panel"); + floaterp->getChild("advanced_options_btn")->setToggleState(advanced); + if (advanced != advanced_options_panel->getVisible()) + { + S32 panel_width = advanced_options_panel->getRect().getWidth(); + floaterp->getChild("advanced_options_panel")->setVisible(advanced); + S32 floater_width = floaterp->getRect().getWidth(); + floater_width += (advanced ? panel_width : -panel_width); + floaterp->reshape(floater_width, floaterp->getRect().getHeight()); + } - if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution + if(!advanced) //set to original window resolution { previewp->mKeepAspectRatio = TRUE; + floaterp->getChild("profile_size_combo")->setCurrentByIndex(0); + gSavedSettings.setS32("SnapshotProfileLastResolution", 0); + floaterp->getChild("postcard_size_combo")->setCurrentByIndex(0); gSavedSettings.setS32("SnapshotPostcardLastResolution", 0); @@ -1256,7 +1325,8 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) floaterp->getParent()->setMouseOpaque(TRUE); // shrink to smaller layout - floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height); + // *TODO: unneeded? + floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight()); // can see and interact with fullscreen preview now if (previewp) @@ -1286,7 +1356,8 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) else // turning off freeze frame mode { floaterp->getParent()->setMouseOpaque(FALSE); - floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height); + // *TODO: unneeded? + floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight()); if (previewp) { previewp->setVisible(FALSE); @@ -1315,43 +1386,39 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) // static void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) { - LLRadioGroup* snapshot_type_radio = floater->getChild("snapshot_type_radio"); - LLSnapshotLivePreview::ESnapshotType shot_type = (LLSnapshotLivePreview::ESnapshotType)gSavedSettings.getS32("LastSnapshotType"); - snapshot_type_radio->setSelectedByValue(getTypeName(shot_type), true); - + LLSnapshotLivePreview::ESnapshotType shot_type = getActiveSnapshotType(floater); ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); +#if 0 floater->getChildView("share_to_web")->setVisible( gSavedSettings.getBOOL("SnapshotSharingEnabled")); +#endif +#if 0 floater->getChildView("postcard_size_combo")->setVisible( FALSE); floater->getChildView("texture_size_combo")->setVisible( FALSE); floater->getChildView("local_size_combo")->setVisible( FALSE); +#endif + floater->getChild("profile_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotProfileLastResolution")); floater->getChild("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); floater->getChild("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); floater->getChild("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); +#if 0 floater->getChild("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); +#endif // *TODO: Separate settings for Web images from postcards - floater->getChildView("send_btn")->setVisible( shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD || - shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB); - floater->getChildView("upload_btn")->setVisible(shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); - floater->getChildView("save_btn")->setVisible( shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); - floater->getChildView("keep_aspect_check")->setEnabled(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); + enableAspectRatioCheckbox(floater, shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); +#if 0 BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot"); BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL; BOOL show_slider = (shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD || shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB || (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG)); - floater->getChildView("more_btn")->setVisible( !is_advance); // the only item hidden in advanced mode - floater->getChildView("less_btn")->setVisible( is_advance); - floater->getChildView("type_label2")->setVisible( is_advance); - floater->getChildView("format_label")->setVisible( is_advance && is_local); - floater->getChildView("local_format_combo")->setVisible( is_advance && is_local); floater->getChildView("layer_types")->setVisible( is_advance); floater->getChildView("layer_type_label")->setVisible( is_advance); floater->getChildView("snapshot_width")->setVisible( is_advance); @@ -1363,47 +1430,59 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->getChildView("freeze_frame_check")->setVisible( is_advance); floater->getChildView("auto_snapshot_check")->setVisible( is_advance); floater->getChildView("image_quality_slider")->setVisible( is_advance && show_slider); +#endif + + LLPanelSnapshot* active_panel = getActivePanel(floater); + if (active_panel) + { + LLSpinCtrl* width_ctrl = getWidthSpinner(floater); + LLSpinCtrl* height_ctrl = getHeightSpinner(floater); - if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) - { //clamp snapshot resolution to window size when showing UI or HUD in snapshot + // Initialize spinners. + if (width_ctrl->getValue().asInteger() == 0) + { + S32 w = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); + lldebugs << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << llendl; + width_ctrl->setValue(w); + } + if (height_ctrl->getValue().asInteger() == 0) + { + S32 h = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); + lldebugs << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << llendl; + height_ctrl->setValue(h); + } - LLSpinCtrl* width_ctrl = floater->getChild("snapshot_width"); - LLSpinCtrl* height_ctrl = floater->getChild("snapshot_height"); + if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) + { //clamp snapshot resolution to window size when showing UI or HUD in snapshot + S32 width = gViewerWindow->getWindowWidthRaw(); + S32 height = gViewerWindow->getWindowHeightRaw(); - S32 width = gViewerWindow->getWindowWidthRaw(); - S32 height = gViewerWindow->getWindowHeightRaw(); + width_ctrl->setMaxValue(width); - width_ctrl->setMaxValue(width); - - height_ctrl->setMaxValue(height); + height_ctrl->setMaxValue(height); - if (width_ctrl->getValue().asInteger() > width) - { - width_ctrl->forceSetValue(width); + if (width_ctrl->getValue().asInteger() > width) + { + width_ctrl->forceSetValue(width); + } + if (height_ctrl->getValue().asInteger() > height) + { + height_ctrl->forceSetValue(height); + } } - if (height_ctrl->getValue().asInteger() > height) + else { - height_ctrl->forceSetValue(height); + width_ctrl->setMaxValue(6016); + height_ctrl->setMaxValue(6016); } } - else - { - LLSpinCtrl* width = floater->getChild("snapshot_width"); - width->setMaxValue(6016); - LLSpinCtrl* height = floater->getChild("snapshot_height"); - height->setMaxValue(6016); - } LLSnapshotLivePreview* previewp = getPreviewView(floater); BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards - floater->getChildView("send_btn")->setEnabled((shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD || - shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB) && - got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE); - floater->getChildView("upload_btn")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_snap); - floater->getChildView("save_btn")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_snap); + //lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; @@ -1411,9 +1490,25 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) { LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); } + + // FIXME: move this to the panel code S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - floater->getChild("texture")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost)); - floater->getChild("upload_btn")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost)); + floater->getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost)); + + // Update displayed image resolution. + LLTextBox* image_res_tb = floater->getChild("image_res_text"); + image_res_tb->setVisible(got_snap); + if (got_snap) + { +#if 1 + LLPointer img = previewp->getEncodedImage(); +#else + LLPointer fimg = previewp->getFormattedImage(); +#endif + image_res_tb->setTextArg("[WIDTH]", llformat("%d", img->getWidth())); + image_res_tb->setTextArg("[HEIGHT]", llformat("%d", img->getHeight())); + } + floater->getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); floater->getChild("file_size_label")->setColor( shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD @@ -1422,29 +1517,23 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) switch(shot_type) { - // *TODO: Separate settings for Web images from postcards case LLSnapshotLivePreview::SNAPSHOT_WEB: + layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; + floater->getChild("layer_types")->setValue("colors"); + setResolution(floater, "profile_size_combo"); + break; case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; floater->getChild("layer_types")->setValue("colors"); - if(is_advance) - { - setResolution(floater, "postcard_size_combo"); - } + setResolution(floater, "postcard_size_combo"); break; case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; floater->getChild("layer_types")->setValue("colors"); - if(is_advance) - { - setResolution(floater, "texture_size_combo"); - } + setResolution(floater, "texture_size_combo"); break; case LLSnapshotLivePreview::SNAPSHOT_LOCAL: - if(is_advance) - { - setResolution(floater, "local_size_combo"); - } + setResolution(floater, "local_size_combo"); break; default: break; @@ -1458,15 +1547,23 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) previewp->setSnapshotFormat(shot_format); previewp->setSnapshotBufferType(layer_type); } + + LLPanelSnapshot* current_panel = Impl::getActivePanel(floater); + if (current_panel) + { + LLSD info; + info["have-snapshot"] = got_snap; + current_panel->updateControls(info); + } } // static void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater) { - LLSpinCtrl* width_spinner = floater->getChild("snapshot_width"); - LLSpinCtrl* height_spinner = floater->getChild("snapshot_height"); + LLSpinCtrl* width_spinner = getWidthSpinner(floater); + LLSpinCtrl* height_spinner = getHeightSpinner(floater); - if(getTypeIndex(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) { width_spinner->setAllowEdit(FALSE); height_spinner->setAllowEdit(FALSE); @@ -1488,81 +1585,6 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, } } -// static -void LLFloaterSnapshot::Impl::onClickDiscard(void* data) -{ - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - - if (view) - { - view->closeFloater(); - } -} - - -// static -void LLFloaterSnapshot::Impl::onCommitSave(LLUICtrl* ctrl, void* data) -{ - if (ctrl->getValue().asString() == "save as") - { - gViewerWindow->resetSnapshotLoc(); - } - onClickKeep(data); -} - -// static -void LLFloaterSnapshot::Impl::onClickKeep(void* data) -{ - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - LLSnapshotLivePreview* previewp = getPreviewView(view); - - if (previewp) - { - switch (previewp->getSnapshotType()) - { - case LLSnapshotLivePreview::SNAPSHOT_WEB: - previewp->saveWeb(); - break; - - case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: - { - LLFloaterPostcard* floater = previewp->savePostcard(); - // if still in snapshot mode, put postcard floater in snapshot floaterview - // and link it to snapshot floater - if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep")) - { - gFloaterView->removeChild(floater); - gSnapshotFloaterView->addChild(floater); - view->addDependentFloater(floater, FALSE); - } - } - break; - - case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: - previewp->saveTexture(); - break; - - case LLSnapshotLivePreview::SNAPSHOT_LOCAL: - previewp->saveLocal(); - break; - - default: - break; - } - - if (gSavedSettings.getBOOL("CloseSnapshotOnKeep")) - { - view->closeFloater(); - } - else - { - checkAutoSnapshot(previewp); - } - - updateControls(view); - } -} - // static void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) { @@ -1590,32 +1612,19 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data) void LLFloaterSnapshot::Impl::onClickMore(void* data) { - gSavedSettings.setBOOL( "AdvanceSnapshot", TRUE ); + BOOL visible = gSavedSettings.getBOOL("AdvanceSnapshot"); - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; if (view) { + gSavedSettings.setBOOL("AdvanceSnapshot", !visible); +#if 0 view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong()); +#endif updateControls(view) ; updateLayout(view) ; - if(getPreviewView(view)) - { - getPreviewView(view)->setThumbnailImageSize() ; - } - } -} -void LLFloaterSnapshot::Impl::onClickLess(void* data) -{ - gSavedSettings.setBOOL( "AdvanceSnapshot", FALSE ); - - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - if (view) - { - view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() ); - view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort()); - updateControls(view) ; - updateLayout(view) ; + // *TODO: redundant? if(getPreviewView(view)) { getPreviewView(view)->setThumbnailImageSize() ; @@ -1655,17 +1664,24 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) void LLFloaterSnapshot::Impl::onClickKeepOpenCheck(LLUICtrl* ctrl, void* data) { LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - gSavedSettings.setBOOL( "CloseSnapshotOnKeep", !check->get() ); } +#if 0 // static void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) { LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - gSavedSettings.setBOOL( "KeepAspectForSnapshot", check->get() ); - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + applyKeepAspectCheck(view, check->get()); +} +#endif + +// static +void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked) +{ + gSavedSettings.setBOOL("KeepAspectForSnapshot", checked); + if (view) { LLSnapshotLivePreview* previewp = getPreviewView(view) ; @@ -1687,20 +1703,6 @@ void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) } } -// static -void LLFloaterSnapshot::Impl::onCommitQuality(LLUICtrl* ctrl, void* data) -{ - LLSliderCtrl* slider = (LLSliderCtrl*)ctrl; - S32 quality_val = llfloor((F32)slider->getValue().asReal()); - - LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterSnapshot *)data); - if (previewp) - { - previewp->setSnapshotQuality(quality_val); - } - checkAutoSnapshot(previewp, TRUE); -} - // static void LLFloaterSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* data) { @@ -1723,18 +1725,16 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde LLSnapshotLivePreview *previewp = getPreviewView(view) ; // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here -#if 0 - if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == getTypeIndex(view)) + if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == getActiveSnapshotType(view)) { previewp->mKeepAspectRatio = FALSE ; return ; } -#endif if(0 == index) //current window size { view->impl.mAspectRatioCheckOff = true ; - view->getChildView("keep_aspect_check")->setEnabled(FALSE) ; + enableAspectRatioCheckbox(view, FALSE); if(previewp) { @@ -1744,9 +1744,11 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde else if(-1 == index) //custom { view->impl.mAspectRatioCheckOff = false ; +#if 0 //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) +#endif { - view->getChildView("keep_aspect_check")->setEnabled(TRUE) ; + enableAspectRatioCheckbox(view, TRUE); if(previewp) { @@ -1757,7 +1759,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde else { view->impl.mAspectRatioCheckOff = true ; - view->getChildView("keep_aspect_check")->setEnabled(FALSE) ; + enableAspectRatioCheckbox(view, FALSE); if(previewp) { @@ -1768,23 +1770,21 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde return ; } -static std::string lastSnapshotWidthName() +static std::string lastSnapshotWidthName(S32 shot_type) { - switch(gSavedSettings.getS32("LastSnapshotType")) + switch (shot_type) { - // *TODO: Separate settings for Web snapshots and postcards - case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToEmailWidth"; + case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToProfileWidth"; case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth"; case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth"; default: return "LastSnapshotToDiskWidth"; } } -static std::string lastSnapshotHeightName() +static std::string lastSnapshotHeightName(S32 shot_type) { - switch(gSavedSettings.getS32("LastSnapshotType")) + switch (shot_type) { - // *TODO: Separate settings for Web snapshots and postcards - case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToEmailHeight"; + case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToProfileHeight"; case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight"; case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight"; default: return "LastSnapshotToDiskHeight"; @@ -1799,10 +1799,12 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL if (!view || !combobox) { + llassert(view && combobox); return; } // save off all selected resolution values + gSavedSettings.setS32("SnapshotProfileLastResolution", view->getChild("profile_size_combo")->getCurrentIndex()); gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild("postcard_size_combo")->getCurrentIndex()); gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild("texture_size_combo")->getCurrentIndex()); gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild("local_size_combo")->getCurrentIndex()); @@ -1824,16 +1826,44 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL if (width == 0 || height == 0) { // take resolution from current window size + lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); } else if (width == -1 || height == -1) { // load last custom value - previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); +#if 1 + LLPanelSnapshot* spanel = getActivePanel(view); + if (spanel) + { + lldebugs << "Loading typed res from panel " << spanel->getName() << llendl; + width = spanel->getTypedPreviewWidth(); + height = spanel->getTypedPreviewWidth(); + } + else + { + const S32 shot_type = getActiveSnapshotType(view); + lldebugs << "Loading saved res for shot_type " << shot_type << llendl; + width = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); + height = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); + } + + llassert(width > 0 && height > 0); + previewp->setSize(width, height); +#else + LLPanelSnapshot* spanel = getActivePanel(view); + if (spanel) + { + lldebugs << "Setting custom preview res : " << spanel->getTypedPreviewWidth() << "x" << spanel->getTypedPreviewHeight() << llendl; + previewp->setSize(spanel->getTypedPreviewWidth(), spanel->getTypedPreviewHeight()); + } + //previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); +#endif } else { // use the resolution from the selected pre-canned drop-down choice + lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; previewp->setSize(width, height); } @@ -1853,10 +1883,10 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL resetSnapshotSizeOnUI(view, width, height) ; } - if(view->getChild("snapshot_width")->getValue().asInteger() != width || view->getChild("snapshot_height")->getValue().asInteger() != height) + if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height) { - view->getChild("snapshot_width")->setValue(width); - view->getChild("snapshot_height")->setValue(height); + getWidthSpinner(view)->setValue(width); + getHeightSpinner(view)->setValue(height); } if(original_width != width || original_height != height) @@ -1892,6 +1922,29 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data) } } +// static +void LLFloaterSnapshot::Impl::onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val) +{ + LLSnapshotLivePreview* previewp = getPreviewView(view); + if (previewp) + { + previewp->setSnapshotQuality(quality_val); + } + checkAutoSnapshot(previewp, TRUE); +} + +// static +void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshot* view) +{ + if (view) + { + gSavedSettings.setS32("SnapshotFormat", getImageFormat(view)); + getPreviewView(view)->updateSnapshot(TRUE); + updateControls(view); + } +} + +#if 0 //static void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data) { @@ -1903,9 +1956,10 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data) updateControls(view); } } +#endif - -//static +#if 0 +//static. void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) { LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; @@ -1916,8 +1970,7 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) updateControls(view); } } - - +#endif // Sets the named size combo to "custom" mode. // static @@ -1931,6 +1984,10 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s { gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); } + else if(comboname == "profile_size_combo") + { + gSavedSettings.setS32("SnapshotProfileLastResolution", combo->getCurrentIndex()); + } else if(comboname == "texture_size_combo") { gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); @@ -2027,21 +2084,29 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 //static void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) { - view->getChild("snapshot_width")->forceSetValue(width); - view->getChild("snapshot_height")->forceSetValue(height); - gSavedSettings.setS32(lastSnapshotWidthName(), width); - gSavedSettings.setS32(lastSnapshotHeightName(), height); + getWidthSpinner(view)->forceSetValue(width); + getHeightSpinner(view)->forceSetValue(height); + gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), width); + gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), height); } +#if 0 //static void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* data) { - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + S32 w = llfloor((F32)getWidthSpinner(view)->getValue().asReal()); + S32 h = llfloor((F32)getHeightSpinner(view)->getValue().asReal()); + applyCustomResolution(view, w, h); +} +#endif + +// static +void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h) +{ + lldebugs << "applyCustomResolution(" << w << ", " << h << ")" << llendl; if (view) { - S32 w = llfloor((F32)view->getChild("snapshot_width")->getValue().asReal()); - S32 h = llfloor((F32)view->getChild("snapshot_height")->getValue().asReal()); - LLSnapshotLivePreview* previewp = getPreviewView(view); if (previewp) { @@ -2073,7 +2138,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat } } #endif - previewp->setMaxImageSize((S32)((LLSpinCtrl *)ctrl)->getMaxValue()) ; + previewp->setMaxImageSize(getWidthSpinner(view)->getMaxValue()) ; // Check image size changes the value of height and width if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize()) @@ -2085,19 +2150,33 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat previewp->setSize(w,h); checkAutoSnapshot(previewp, FALSE); previewp->updateSnapshot(FALSE, TRUE); + comboSetCustom(view, "profile_size_combo"); comboSetCustom(view, "postcard_size_combo"); comboSetCustom(view, "texture_size_combo"); comboSetCustom(view, "local_size_combo"); } } - gSavedSettings.setS32(lastSnapshotWidthName(), w); - gSavedSettings.setS32(lastSnapshotHeightName(), h); + gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), w); + gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), h); updateControls(view); } } +// static +void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(LLSideTrayPanelContainer* panel_container, bool status) +{ + panel_container->openPanel("panel_post_result", LLSD().with("post-result", status).with("post-type", "profile")); +} + + +// static +void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLSideTrayPanelContainer* panel_container, bool status) +{ + panel_container->openPanel("panel_post_result", LLSD().with("post-result", status).with("post-type", "postcard")); +} + ///---------------------------------------------------------------------------- /// Class LLFloaterSnapshot ///---------------------------------------------------------------------------- @@ -2134,24 +2213,19 @@ BOOL LLFloaterSnapshot::postBuild() LLWebSharing::instance().init(); } +#if 0 childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this); +#endif childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); - childSetAction("more_btn", Impl::onClickMore, this); - childSetAction("less_btn", Impl::onClickLess, this); - - childSetAction("upload_btn", Impl::onClickKeep, this); - childSetAction("send_btn", Impl::onClickKeep, this); - childSetCommitCallback("save_btn", Impl::onCommitSave, this); - childSetAction("discard_btn", Impl::onClickDiscard, this); - - childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this); - getChild("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality")); + childSetAction("advanced_options_btn", Impl::onClickMore, this); +#if 0 childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this); childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this); +#endif childSetCommitCallback("ui_check", Impl::onClickUICheck, this); getChild("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot")); @@ -2162,15 +2236,19 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("keep_open_check", Impl::onClickKeepOpenCheck, this); getChild("keep_open_check")->setValue(!gSavedSettings.getBOOL("CloseSnapshotOnKeep")); +#if 0 childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this); - getChild("keep_aspect_check")->setValue(gSavedSettings.getBOOL("KeepAspectForSnapshot")); +#endif + impl.enableAspectRatioCheckbox(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); getChild("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(FALSE); - getChild("snapshot_width")->setValue(gSavedSettings.getS32(lastSnapshotWidthName())); - getChild("snapshot_height")->setValue(gSavedSettings.getS32(lastSnapshotHeightName())); +#if 0 // leads to crash later if one of the settings values is 0 + impl.getWidthSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotWidthName())); + impl.getHeightSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotHeightName())); +#endif getChild("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); @@ -2178,10 +2256,18 @@ BOOL LLFloaterSnapshot::postBuild() getChild("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); + childSetCommitCallback("profile_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); + LLSideTrayPanelContainer* panel_container = getChild("panel_container"); + LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, panel_container, _1)); + LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, panel_container, _1)); + + // remember preview rect + sThumbnailPlaceholderRect = getChild("thumbnail_placeholder")->getRect(); + // create preview window LLRect full_screen_rect = getRootView()->getRect(); LLSnapshotLivePreview::Params p; @@ -2221,9 +2307,8 @@ void LLFloaterSnapshot::draw() { if(previewp->getThumbnailImage()) { - LLRect thumbnail_rect = getChild("thumbnail_placeholder")->getRect(); - - S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ; + LLRect& thumbnail_rect = sThumbnailPlaceholderRect; + S32 offset_x = thumbnail_rect.mLeft + (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 ; S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; glMatrixMode(GL_MODELVIEW); @@ -2256,6 +2341,44 @@ void LLFloaterSnapshot::onClose(bool app_quitting) getParent()->setMouseOpaque(FALSE); } +// virtual +S32 LLFloaterSnapshot::notify(const LLSD& info) +{ + // A child panel wants to change snapshot resolution. + if (info.has("combo-res-change")) + { + std::string combo_name = info["combo-res-change"]["control-name"].asString(); + impl.updateResolution(getChild(combo_name), this); + return 1; + } + + if (info.has("custom-res-change")) + { + LLSD res = info["custom-res-change"]; + impl.applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger()); + return 1; + } + + if (info.has("keep-aspect-change")) + { + impl.applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean()); + return 1; + } + + if (info.has("image-quality-change")) + { + impl.onImageQualityChange(this, info["image-quality-change"].asInteger()); + return 1; + } + + if (info.has("image-format-change")) + { + impl.onImageFormatChange(this); + return 1; + } + + return 0; +} //static void LLFloaterSnapshot::update() @@ -2276,6 +2399,159 @@ void LLFloaterSnapshot::update() } } +// static +LLFloaterSnapshot* LLFloaterSnapshot::getInstance() +{ + return LLFloaterReg::getTypedInstance("snapshot"); +} + +// static +void LLFloaterSnapshot::saveTexture() +{ + lldebugs << "saveTexture" << llendl; + + // FIXME: duplicated code + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (!instance) + { + llassert(instance != NULL); + return; + } + LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); + if (!previewp) + { + llassert(previewp != NULL); + return; + } + + previewp->saveTexture(); + instance->postSave(); +} + +// static +void LLFloaterSnapshot::saveLocal() +{ + lldebugs << "saveLocal" << llendl; + // FIXME: duplicated code + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (!instance) + { + llassert(instance != NULL); + return; + } + LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); + if (!previewp) + { + llassert(previewp != NULL); + return; + } + + previewp->saveLocal(); + instance->postSave(); +} + +// static +void LLFloaterSnapshot::preUpdate() +{ + // FIXME: duplicated code + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (instance) + { + instance->getChildView("refresh_icon")->setVisible(TRUE); // indicate refresh + } +} + +// static +void LLFloaterSnapshot::postUpdate() +{ + // FIXME: duplicated code + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (instance) + { + instance->getChildView("refresh_icon")->setVisible(FALSE); + } +} + +// static +void LLFloaterSnapshot::postSave() +{ + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (!instance) + { + llassert(instance != NULL); + return; + } + + instance->impl.updateControls(instance); +} + +// static +void LLFloaterSnapshot::postPanelSwitch() +{ + LLFloaterSnapshot* instance = getInstance(); + instance->impl.updateControls(instance); +} + +// static +LLPointer LLFloaterSnapshot::getImageData() +{ + // FIXME: May not work for textures. + + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (!instance) + { + llassert(instance != NULL); + return NULL; + } + + LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); + if (!previewp) + { + llassert(previewp != NULL); + return NULL; + } + + LLPointer img = previewp->getFormattedImage(); + if (!img.get()) + { + llwarns << "Empty snapshot image data" << llendl; + llassert(img.get() != NULL); + } + + return img; +} + +// static +const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal() +{ + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (!instance) + { + llassert(instance != NULL); + return LLVector3d::zero; + } + + LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); + if (!previewp) + { + llassert(previewp != NULL); + return LLVector3d::zero; + } + + return previewp->getPosTakenGlobal(); +} + +// static +void LLFloaterSnapshot::setAgentEmail(const std::string& email) +{ + LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); + if (instance) + { + LLSideTrayPanelContainer* panel_container = instance->getChild("panel_container"); + LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard"); + postcard_panel->notify(LLSD().with("agent-email", email)); + } +} ///---------------------------------------------------------------------------- /// Class LLSnapshotFloaterView diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index c92d9efde5..de69824ad0 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -27,11 +27,15 @@ #ifndef LL_LLFLOATERSNAPSHOT_H #define LL_LLFLOATERSNAPSHOT_H +#include "llimage.h" #include "llfloater.h" +class LLSpinCtrl; class LLFloaterSnapshot : public LLFloater { + LOG_CLASS(LLFloaterSnapshot); + public: typedef enum e_snapshot_format { @@ -47,20 +51,29 @@ public: /*virtual*/ void draw(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ S32 notify(const LLSD& info); static void update(); - - static S32 getUIWinHeightLong() {return sUIWinHeightLong ;} - static S32 getUIWinHeightShort() {return sUIWinHeightShort ;} - static S32 getUIWinWidth() {return sUIWinWidth ;} + + // TODO: create a snapshot model instead + static LLFloaterSnapshot* getInstance(); + static void saveTexture(); + static void saveLocal(); + static void preUpdate(); + static void postUpdate(); + static void postSave(); + static void postPanelSwitch(); + static LLPointer getImageData(); + static const LLVector3d& getPosTakenGlobal(); + static void setAgentEmail(const std::string& email); + + static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholderRect; } private: + static LLRect sThumbnailPlaceholderRect; + class Impl; Impl& impl; - - static S32 sUIWinHeightLong ; - static S32 sUIWinHeightShort ; - static S32 sUIWinWidth ; }; class LLSnapshotFloaterView : public LLFloaterView diff --git a/indra/newview/llpanelpostprogress.cpp b/indra/newview/llpanelpostprogress.cpp new file mode 100644 index 0000000000..9b7de2cb23 --- /dev/null +++ b/indra/newview/llpanelpostprogress.cpp @@ -0,0 +1,59 @@ +/** + * @file llpanelpostprogress.cpp + * @brief Displays progress of publishing a snapshot. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the termsllpanelpostprogress of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "llpanel.h" +#include "llsidetraypanelcontainer.h" + +/** + * Displays progress of publishing a snapshot. + */ +class LLPanelPostProgress +: public LLPanel +{ + LOG_CLASS(LLPanelPostProgress); + +public: + /*virtual*/ void onOpen(const LLSD& key); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelpostprogress"); + +// virtual +void LLPanelPostProgress::onOpen(const LLSD& key) +{ + if (key.has("post-type")) + { + std::string progress_text = getString(key["post-type"].asString() + "_" + "progress_str"); + getChild("progress_lbl")->setText(progress_text); + } + else + { + llwarns << "Invalid key" << llendl; + } +} diff --git a/indra/newview/llpanelpostresult.cpp b/indra/newview/llpanelpostresult.cpp new file mode 100644 index 0000000000..2b937d83b9 --- /dev/null +++ b/indra/newview/llpanelpostresult.cpp @@ -0,0 +1,90 @@ +/** + * @file llpanelpostresult.cpp + * @brief Result of publishing a snapshot (success/failure). + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "llpanel.h" +#include "llsidetraypanelcontainer.h" + +/** + * Displays snapshot publishing result. + */ +class LLPanelPostResult +: public LLPanel +{ + LOG_CLASS(LLPanelPostResult); + +public: + LLPanelPostResult(); + + /*virtual*/ void onOpen(const LLSD& key); +private: + void onBack(); + void onClose(); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelpostresult"); + +LLPanelPostResult::LLPanelPostResult() +{ + mCommitCallbackRegistrar.add("Snapshot.Result.Back", boost::bind(&LLPanelPostResult::onBack, this)); + mCommitCallbackRegistrar.add("Snapshot.Result.Close", boost::bind(&LLPanelPostResult::onClose, this)); +} + + +// virtual +void LLPanelPostResult::onOpen(const LLSD& key) +{ + if (key.isMap() && key.has("post-result") && key.has("post-type")) + { + bool ok = key["post-result"].asBoolean(); + std::string type = key["post-type"].asString(); + std::string result_text = getString(type + "_" + (ok ? "succeeded_str" : "failed_str")); + getChild("result_lbl")->setText(result_text); + } + else + { + llwarns << "Invalid key" << llendl; + } +} + +void LLPanelPostResult::onBack() +{ + LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->openPreviousPanel(); +} + +void LLPanelPostResult::onClose() +{ + LLFloaterReg::hideInstance("snapshot"); +} diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp new file mode 100644 index 0000000000..e89e62c750 --- /dev/null +++ b/indra/newview/llpanelsnapshot.cpp @@ -0,0 +1,109 @@ +/** + * @file llpanelsnapshot.cpp + * @brief Snapshot panel base class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llpanelsnapshot.h" + +// libs +#include "llsliderctrl.h" +#include "llspinctrl.h" +#include "lltrans.h" + +// newview +#include "llsidetraypanelcontainer.h" + +LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshot::getImageFormat() const +{ + return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; +} + +LLSpinCtrl* LLPanelSnapshot::getWidthSpinner() +{ + return getChild(getWidthSpinnerName()); +} + +LLSpinCtrl* LLPanelSnapshot::getHeightSpinner() +{ + return getChild(getHeightSpinnerName()); +} + +S32 LLPanelSnapshot::getTypedPreviewWidth() const +{ + return getChild(getWidthSpinnerName())->getValue().asInteger(); +} + +S32 LLPanelSnapshot::getTypedPreviewHeight() const +{ + return getChild(getHeightSpinnerName())->getValue().asInteger(); +} + +void LLPanelSnapshot::enableAspectRatioCheckbox(BOOL enable) +{ + getChild(getAspectRatioCBName())->setEnabled(enable); +} + +LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer() +{ + LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return NULL; + } + + return parent; +} + +void LLPanelSnapshot::updateImageQualityLevel() +{ + LLSliderCtrl* quality_slider = getChild("image_quality_slider"); + S32 quality_val = llfloor((F32) quality_slider->getValue().asReal()); + + std::string quality_lvl; + + if (quality_val < 20) + { + quality_lvl = LLTrans::getString("snapshot_quality_very_low"); + } + else if (quality_val < 40) + { + quality_lvl = LLTrans::getString("snapshot_quality_low"); + } + else if (quality_val < 60) + { + quality_lvl = LLTrans::getString("snapshot_quality_medium"); + } + else if (quality_val < 80) + { + quality_lvl = LLTrans::getString("snapshot_quality_high"); + } + else + { + quality_lvl = LLTrans::getString("snapshot_quality_very_high"); + } + + getChild("image_quality_level")->setTextArg("[QLVL]", quality_lvl); +} diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h new file mode 100644 index 0000000000..a227317d2f --- /dev/null +++ b/indra/newview/llpanelsnapshot.h @@ -0,0 +1,58 @@ +/** + * @file llpanelsnapshot.h + * @brief Snapshot panel base class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELSNAPSHOT_H +#define LL_LLPANELSNAPSHOT_H + +#include "llfloatersnapshot.h" + +class LLSideTrayPanelContainer; + +/** + * Snapshot panel base class. + */ +class LLPanelSnapshot: public LLPanel +{ +public: + virtual std::string getWidthSpinnerName() const = 0; + virtual std::string getHeightSpinnerName() const = 0; + virtual std::string getAspectRatioCBName() const = 0; + virtual std::string getImageSizeComboName() const = 0; + + virtual S32 getTypedPreviewWidth() const; + virtual S32 getTypedPreviewHeight() const; + virtual LLSpinCtrl* getWidthSpinner(); + virtual LLSpinCtrl* getHeightSpinner(); + virtual void enableAspectRatioCheckbox(BOOL enable); + virtual LLFloaterSnapshot::ESnapshotFormat getImageFormat() const; + virtual void updateControls(const LLSD& info) {} ///< Update controls from saved settings + +protected: + LLSideTrayPanelContainer* getParentContainer(); + void updateImageQualityLevel(); +}; + +#endif // LL_LLPANELSNAPSHOT_H diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp new file mode 100644 index 0000000000..6419c37494 --- /dev/null +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -0,0 +1,152 @@ +/** + * @file llpanelsnapshotinventory.cpp + * @brief The panel provides UI for saving snapshot as an inventory texture. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llcombobox.h" +#include "llsidetraypanelcontainer.h" +#include "llspinctrl.h" + +#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model +#include "llpanelsnapshot.h" +#include "llviewercontrol.h" // gSavedSettings + +/** + * The panel provides UI for saving snapshot as an inventory texture. + */ +class LLPanelSnapshotInventory +: public LLPanelSnapshot +{ + LOG_CLASS(LLPanelSnapshotInventory); + +public: + LLPanelSnapshotInventory(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + void updateCustomResControls(); ///< Show/hide custom resolution controls (spinners and checkbox) + + /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; } + /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; } + /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; } + /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; } + /*virtual*/ void updateControls(const LLSD& info); + + void onResolutionComboCommit(LLUICtrl* ctrl); + void onCustomResolutionCommit(LLUICtrl* ctrl); + void onKeepAspectRatioCommit(LLUICtrl* ctrl); + void onSend(); + void onCancel(); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotinventory"); + +LLPanelSnapshotInventory::LLPanelSnapshotInventory() +{ + mCommitCallbackRegistrar.add("Inventory.Save", boost::bind(&LLPanelSnapshotInventory::onSend, this)); + mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::onCancel, this)); +} + +// virtual +BOOL LLPanelSnapshotInventory::postBuild() +{ + getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionComboCommit, this, _1)); + getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); + getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); + getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onKeepAspectRatioCommit, this, _1)); + return TRUE; +} + +// virtual +void LLPanelSnapshotInventory::onOpen(const LLSD& key) +{ +#if 0 + getChild(getImageSizeComboName())->selectNthItem(0); // FIXME? has no effect +#endif + updateCustomResControls(); +} + +void LLPanelSnapshotInventory::updateCustomResControls() +{ + LLComboBox* combo = getChild(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + bool show = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild(getWidthSpinnerName())->setVisible(show); + getChild(getHeightSpinnerName())->setVisible(show); + getChild(getAspectRatioCBName())->setVisible(show); +} + +// virtual +void LLPanelSnapshotInventory::updateControls(const LLSD& info) +{ + const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; + getChild("save_btn")->setEnabled(have_snapshot); +} + +void LLPanelSnapshotInventory::onResolutionComboCommit(LLUICtrl* ctrl) +{ + updateCustomResControls(); + + LLSD info; + info["combo-res-change"]["control-name"] = ctrl->getName(); + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshotInventory::onCustomResolutionCommit(LLUICtrl* ctrl) +{ + LLSD info; + info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger();; + info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger();; + LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); +} + +void LLPanelSnapshotInventory::onKeepAspectRatioCommit(LLUICtrl* ctrl) +{ + LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); +} + +void LLPanelSnapshotInventory::onSend() +{ + // Switch to upload progress display. + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPanel("panel_post_progress", LLSD().with("post-type", "inventory")); + } + + LLFloaterSnapshot::saveTexture(); +} + +void LLPanelSnapshotInventory::onCancel() +{ + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPreviousPanel(); + } +} diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp new file mode 100644 index 0000000000..5dc32d228f --- /dev/null +++ b/indra/newview/llpanelsnapshotlocal.cpp @@ -0,0 +1,209 @@ +/** + * @file llpanelsnapshotlocal.cpp + * @brief The panel provides UI for saving snapshot to a local folder. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llcombobox.h" +#include "llsidetraypanelcontainer.h" +#include "llsliderctrl.h" +#include "llspinctrl.h" + +#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model +#include "llpanelsnapshot.h" +#include "llviewercontrol.h" // gSavedSettings + +/** + * The panel provides UI for saving snapshot to a local folder. + */ +class LLPanelSnapshotLocal +: public LLPanelSnapshot +{ + LOG_CLASS(LLPanelSnapshotLocal); + +public: + LLPanelSnapshotLocal(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + /*virtual*/ std::string getWidthSpinnerName() const { return "local_snapshot_width"; } + /*virtual*/ std::string getHeightSpinnerName() const { return "local_snapshot_height"; } + /*virtual*/ std::string getAspectRatioCBName() const { return "local_keep_aspect_check"; } + /*virtual*/ std::string getImageSizeComboName() const { return "local_size_combo"; } + /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const; + /*virtual*/ void updateControls(const LLSD& info); + + void updateCustomResControls(); ///< Show/hide custom resolution controls (spinners and checkbox) + + void onFormatComboCommit(LLUICtrl* ctrl); + void onResolutionComboCommit(LLUICtrl* ctrl); + void onCustomResolutionCommit(LLUICtrl* ctrl); + void onKeepAspectRatioCommit(LLUICtrl* ctrl); + void onQualitySliderCommit(LLUICtrl* ctrl); + void onSend(); + void onCancel(); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotlocal"); + +LLPanelSnapshotLocal::LLPanelSnapshotLocal() +{ + mCommitCallbackRegistrar.add("Local.Save", boost::bind(&LLPanelSnapshotLocal::onSend, this)); + mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::onCancel, this)); +} + +// virtual +BOOL LLPanelSnapshotLocal::postBuild() +{ + getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onResolutionComboCommit, this, _1)); + getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1)); + getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1)); + getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onKeepAspectRatioCommit, this, _1)); + getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1)); + getChild("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1)); + + updateControls(LLSD()); + + return TRUE; +} + +// virtual +void LLPanelSnapshotLocal::onOpen(const LLSD& key) +{ + updateCustomResControls(); +} + +// virtual +LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const +{ + LLFloaterSnapshot::ESnapshotFormat fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; + + LLComboBox* local_format_combo = getChild("local_format_combo"); + const std::string id = local_format_combo->getSelectedItemLabel(); + if (id == "PNG") + { + fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; + } + else if (id == "JPEG") + { + fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; + } + else if (id == "BMP") + { + fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP; + } + + return fmt; +} + +// virtual +void LLPanelSnapshotLocal::updateControls(const LLSD& info) +{ + LLFloaterSnapshot::ESnapshotFormat fmt = + (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat"); + getChild("local_format_combo")->selectNthItem((S32) fmt); + + const bool show_quality_ctrls = (fmt == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + getChild("image_quality_slider")->setVisible(show_quality_ctrls); + getChild("image_quality_level")->setVisible(show_quality_ctrls); + + getChild("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality")); + updateImageQualityLevel(); + + const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; + getChild("save_btn")->setEnabled(have_snapshot); +} + +void LLPanelSnapshotLocal::updateCustomResControls() +{ + LLComboBox* combo = getChild(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild(getWidthSpinnerName())->setEnabled(enable); + getChild(getWidthSpinnerName())->setAllowEdit(enable); + getChild(getHeightSpinnerName())->setEnabled(enable); + getChild(getHeightSpinnerName())->setAllowEdit(enable); + getChild(getAspectRatioCBName())->setEnabled(enable); +} + +void LLPanelSnapshotLocal::onFormatComboCommit(LLUICtrl* ctrl) +{ +#if 0 // redundant? + gSavedSettings.setS32("SnapshotFormat", ctrl->getValue().asInteger()); +#endif + + // will call updateControls() + LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); +} + +void LLPanelSnapshotLocal::onResolutionComboCommit(LLUICtrl* ctrl) +{ + updateCustomResControls(); + + LLSD info; + info["combo-res-change"]["control-name"] = ctrl->getName(); + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshotLocal::onCustomResolutionCommit(LLUICtrl* ctrl) +{ + LLSD info; + info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); + info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); + LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); +} + +void LLPanelSnapshotLocal::onKeepAspectRatioCommit(LLUICtrl* ctrl) +{ + LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); +} + +void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl) +{ + updateImageQualityLevel(); + + LLSliderCtrl* slider = (LLSliderCtrl*)ctrl; + S32 quality_val = llfloor((F32)slider->getValue().asReal()); + LLSD info; + info["image-quality-change"] = quality_val; + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshotLocal::onSend() +{ + LLFloaterSnapshot::saveLocal(); + onCancel(); +} + +void LLPanelSnapshotLocal::onCancel() +{ + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPreviousPanel(); + } +} diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp new file mode 100644 index 0000000000..8e5ff282b3 --- /dev/null +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -0,0 +1,94 @@ +/** + * @file llpanelsnapshotoptions.cpp + * @brief Snapshot posting options panel. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanel.h" +#include "llsidetraypanelcontainer.h" + +#include "llfloatersnapshot.h" // FIXME: create a snapshot model + +/** + * Provides several ways to save a snapshot. + */ +class LLPanelSnapshotOptions +: public LLPanel +{ + LOG_CLASS(LLPanelSnapshotOptions); + +public: + LLPanelSnapshotOptions(); + +private: + void openPanel(const std::string& panel_name); + void onSaveToProfile(); + void onSaveToEmail(); + void onSaveToInventory(); + void onSaveToComputer(); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotoptions"); + +LLPanelSnapshotOptions::LLPanelSnapshotOptions() +{ + mCommitCallbackRegistrar.add("Snapshot.SaveToProfile", boost::bind(&LLPanelSnapshotOptions::onSaveToProfile, this)); + mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this)); + mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this)); + mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); +} + +void LLPanelSnapshotOptions::openPanel(const std::string& panel_name) +{ + LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->openPanel(panel_name); + LLFloaterSnapshot::postPanelSwitch(); +} + +void LLPanelSnapshotOptions::onSaveToProfile() +{ + openPanel("panel_snapshot_profile"); +} + +void LLPanelSnapshotOptions::onSaveToEmail() +{ + openPanel("panel_snapshot_postcard"); +} + +void LLPanelSnapshotOptions::onSaveToInventory() +{ + openPanel("panel_snapshot_inventory"); +} + +void LLPanelSnapshotOptions::onSaveToComputer() +{ + openPanel("panel_snapshot_local"); +} diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp new file mode 100644 index 0000000000..c2b83d5c19 --- /dev/null +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -0,0 +1,336 @@ +/** + * @file llpanelsnapshotpostcard.cpp + * @brief Postcard sending panel. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llcombobox.h" +#include "llnotificationsutil.h" +#include "llsidetraypanelcontainer.h" +#include "llsliderctrl.h" +#include "llspinctrl.h" +#include "lltexteditor.h" + +#include "llagent.h" +#include "llagentui.h" +#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model +#include "llpanelsnapshot.h" +#include "llpostcard.h" +#include "llviewercontrol.h" // gSavedSettings +#include "llviewerwindow.h" + +#include + +/** + * Sends postcard via email. + */ +class LLPanelSnapshotPostcard +: public LLPanelSnapshot +{ + LOG_CLASS(LLPanelSnapshotPostcard); + +public: + LLPanelSnapshotPostcard(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ S32 notify(const LLSD& info); + +private: + /*virtual*/ std::string getWidthSpinnerName() const { return "postcard_snapshot_width"; } + /*virtual*/ std::string getHeightSpinnerName() const { return "postcard_snapshot_height"; } + /*virtual*/ std::string getAspectRatioCBName() const { return "postcard_keep_aspect_check"; } + /*virtual*/ std::string getImageSizeComboName() const { return "postcard_size_combo"; } + /*virtual*/ void updateControls(const LLSD& info); + + void updateCustomResControls(); ///< Enable/disable custom resolution controls (spinners and checkbox) + bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); + void sendPostcard(); + + void onMsgFormFocusRecieved(); + void onFormatComboCommit(LLUICtrl* ctrl); + void onResolutionComboCommit(LLUICtrl* ctrl); + void onCustomResolutionCommit(LLUICtrl* ctrl); + void onKeepAspectRatioCommit(LLUICtrl* ctrl); + void onQualitySliderCommit(LLUICtrl* ctrl); + void onTabButtonPress(S32 btn_idx); + void onSend(); + void onCancel(); + + bool mHasFirstMsgFocus; +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotpostcard"); + +LLPanelSnapshotPostcard::LLPanelSnapshotPostcard() +: mHasFirstMsgFocus(false) +{ + mCommitCallbackRegistrar.add("Postcard.Send", boost::bind(&LLPanelSnapshotPostcard::onSend, this)); + mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::onCancel, this)); + mCommitCallbackRegistrar.add("Postcard.Message", boost::bind(&LLPanelSnapshotPostcard::onTabButtonPress, this, 0)); + mCommitCallbackRegistrar.add("Postcard.Settings", boost::bind(&LLPanelSnapshotPostcard::onTabButtonPress, this, 1)); + +} + +// virtual +BOOL LLPanelSnapshotPostcard::postBuild() +{ + // pick up the user's up-to-date email address + gAgent.sendAgentUserInfoRequest(); + + getChildView("from_form")->setEnabled(FALSE); + + std::string name_string; + LLAgentUI::buildFullname(name_string); + getChild("name_form")->setValue(LLSD(name_string)); + + // For the first time a user focuses to .the msg box, all text will be selected. + getChild("msg_form")->setFocusChangedCallback(boost::bind(&LLPanelSnapshotPostcard::onMsgFormFocusRecieved, this)); + + getChild("to_form")->setFocus(TRUE); + + getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onResolutionComboCommit, this, _1)); + getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1)); + getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1)); + getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onKeepAspectRatioCommit, this, _1)); + getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1)); + + getChild("message_btn")->setToggleState(TRUE); + + updateControls(LLSD()); + + return TRUE; +} + +// virtual +void LLPanelSnapshotPostcard::onOpen(const LLSD& key) +{ + gSavedSettings.setS32("SnapshotFormat", getImageFormat()); + updateCustomResControls(); +} + +// virtual +S32 LLPanelSnapshotPostcard::notify(const LLSD& info) +{ + if (!info.has("agent-email")) + { + llassert(info.has("agent-email")); + return 0; + } + + LLUICtrl* from_input = getChild("from_form"); + const std::string& text = from_input->getValue().asString(); + if (text.empty()) + { + // there's no text in this field yet, pre-populate + from_input->setValue(info["agent-email"]); + } + + return 1; +} + +// virtual +void LLPanelSnapshotPostcard::updateControls(const LLSD& info) +{ + getChild("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality")); + updateImageQualityLevel(); + + const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; + getChild("send_btn")->setEnabled(have_snapshot); +} + +void LLPanelSnapshotPostcard::updateCustomResControls() +{ + LLComboBox* combo = getChild(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild(getWidthSpinnerName())->setEnabled(enable); + getChild(getWidthSpinnerName())->setAllowEdit(enable); + getChild(getHeightSpinnerName())->setEnabled(enable); + getChild(getHeightSpinnerName())->setAllowEdit(enable); + getChild(getAspectRatioCBName())->setEnabled(enable); +} + +bool LLPanelSnapshotPostcard::missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if(0 == option) + { + // User clicked OK + if((getChild("subject_form")->getValue().asString()).empty()) + { + // Stuff the subject back into the form. + getChild("subject_form")->setValue(getString("default_subject")); + } + + if (!mHasFirstMsgFocus) + { + // The user never switched focus to the message window. + // Using the default string. + getChild("msg_form")->setValue(getString("default_message")); + } + + sendPostcard(); + } + return false; +} + + +void LLPanelSnapshotPostcard::sendPostcard() +{ + std::string from(getChild("from_form")->getValue().asString()); + std::string to(getChild("to_form")->getValue().asString()); + std::string subject(getChild("subject_form")->getValue().asString()); + + LLSD postcard = LLSD::emptyMap(); + postcard["pos-global"] = LLFloaterSnapshot::getPosTakenGlobal().getValue(); + postcard["to"] = to; + postcard["from"] = from; + postcard["name"] = getChild("name_form")->getValue().asString(); + postcard["subject"] = subject; + postcard["msg"] = getChild("msg_form")->getValue().asString(); + LLPostCard::send(LLFloaterSnapshot::getImageData(), postcard); + LLFloaterSnapshot::postSave(); + + // Give user feedback of the event. + gViewerWindow->playSnapshotAnimAndSound(); + + // Switch to upload progress display. + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPanel("panel_post_progress", LLSD().with("post-type", "postcard")); + } +} + +void LLPanelSnapshotPostcard::onMsgFormFocusRecieved() +{ + LLTextEditor* msg_form = getChild("msg_form"); + if (msg_form->hasFocus() && !mHasFirstMsgFocus) + { + mHasFirstMsgFocus = true; + msg_form->setText(LLStringUtil::null); + } +} + +void LLPanelSnapshotPostcard::onFormatComboCommit(LLUICtrl* ctrl) +{ + // will call updateControls() + LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); +} + +void LLPanelSnapshotPostcard::onResolutionComboCommit(LLUICtrl* ctrl) +{ + updateCustomResControls(); + + LLSD info; + info["combo-res-change"]["control-name"] = ctrl->getName(); + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshotPostcard::onCustomResolutionCommit(LLUICtrl* ctrl) +{ + LLSD info; + info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); + info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); + LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); +} + +void LLPanelSnapshotPostcard::onKeepAspectRatioCommit(LLUICtrl* ctrl) +{ + LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); +} + +void LLPanelSnapshotPostcard::onQualitySliderCommit(LLUICtrl* ctrl) +{ + updateImageQualityLevel(); + + LLSliderCtrl* slider = (LLSliderCtrl*)ctrl; + S32 quality_val = llfloor((F32)slider->getValue().asReal()); + LLSD info; + info["image-quality-change"] = quality_val; + LLFloaterSnapshot::getInstance()->notify(info); // updates the "SnapshotQuality" setting +} + +void LLPanelSnapshotPostcard::onTabButtonPress(S32 btn_idx) +{ + static LLButton* sButtons[2] = { + getChild("message_btn"), + getChild("settings_btn"), + }; + + // Switch between Message and Settings tabs. + LLButton* clicked_btn = sButtons[btn_idx]; + LLButton* other_btn = sButtons[!btn_idx]; + LLSideTrayPanelContainer* container = + getChild("postcard_panel_container"); + + container->selectTab(clicked_btn->getToggleState() ? btn_idx : !btn_idx); + //clicked_btn->setEnabled(FALSE); + other_btn->toggleState(); + //other_btn->setEnabled(TRUE); + + lldebugs << "Button #" << btn_idx << " (" << clicked_btn->getName() << ") clicked" << llendl; +} + +void LLPanelSnapshotPostcard::onSend() +{ + // Validate input. + std::string from(getChild("from_form")->getValue().asString()); + std::string to(getChild("to_form")->getValue().asString()); + + boost::regex email_format("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*"); + + if (to.empty() || !boost::regex_match(to, email_format)) + { + LLNotificationsUtil::add("PromptRecipientEmail"); + return; + } + + if (from.empty() || !boost::regex_match(from, email_format)) + { + LLNotificationsUtil::add("PromptSelfEmail"); + return; + } + + std::string subject(getChild("subject_form")->getValue().asString()); + if(subject.empty() || !mHasFirstMsgFocus) + { + LLNotificationsUtil::add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLPanelSnapshotPostcard::missingSubjMsgAlertCallback, this, _1, _2)); + return; + } + + // Send postcard. + sendPostcard(); +} + +void LLPanelSnapshotPostcard::onCancel() +{ + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPreviousPanel(); + } +} diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp new file mode 100644 index 0000000000..80a379a5a0 --- /dev/null +++ b/indra/newview/llpanelsnapshotprofile.cpp @@ -0,0 +1,162 @@ +/** + * @file llpanelsnapshotprofile.cpp + * @brief Posts a snapshot to My Profile feed. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +// libs +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "llpanel.h" +#include "llspinctrl.h" + +// newview +#include "llfloatersnapshot.h" +#include "llpanelsnapshot.h" +#include "llsidetraypanelcontainer.h" +#include "llwebprofile.h" + +/** + * Posts a snapshot to My Profile feed. + */ +class LLPanelSnapshotProfile +: public LLPanelSnapshot +{ + LOG_CLASS(LLPanelSnapshotProfile); + +public: + LLPanelSnapshotProfile(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + /*virtual*/ std::string getWidthSpinnerName() const { return "profile_snapshot_width"; } + /*virtual*/ std::string getHeightSpinnerName() const { return "profile_snapshot_height"; } + /*virtual*/ std::string getAspectRatioCBName() const { return "profile_keep_aspect_check"; } + /*virtual*/ std::string getImageSizeComboName() const { return "profile_size_combo"; } + /*virtual*/ void updateControls(const LLSD& info); + + void updateCustomResControls(); ///< Enable/disable custom resolution controls (spinners and checkbox) + + void onSend(); + void onCancel(); + void onResolutionComboCommit(LLUICtrl* ctrl); + void onCustomResolutionCommit(LLUICtrl* ctrl); + void onKeepAspectRatioCommit(LLUICtrl* ctrl); +}; + +static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotprofile"); + +LLPanelSnapshotProfile::LLPanelSnapshotProfile() +{ + mCommitCallbackRegistrar.add("PostToProfile.Send", boost::bind(&LLPanelSnapshotProfile::onSend, this)); + mCommitCallbackRegistrar.add("PostToProfile.Cancel", boost::bind(&LLPanelSnapshotProfile::onCancel, this)); +} + +// virtual +BOOL LLPanelSnapshotProfile::postBuild() +{ + getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onResolutionComboCommit, this, _1)); + getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); + getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); + getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onKeepAspectRatioCommit, this, _1)); + return TRUE; +} + +// virtual +void LLPanelSnapshotProfile::onOpen(const LLSD& key) +{ + updateCustomResControls(); +} + +// virtual +void LLPanelSnapshotProfile::updateControls(const LLSD& info) +{ + const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; + getChild("post_btn")->setEnabled(have_snapshot); +} + +void LLPanelSnapshotProfile::updateCustomResControls() ///< Enable/disable custom resolution controls (spinners and checkbox) +{ + LLComboBox* combo = getChild(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild(getWidthSpinnerName())->setEnabled(enable); + getChild(getWidthSpinnerName())->setAllowEdit(enable); + getChild(getHeightSpinnerName())->setEnabled(enable); + getChild(getHeightSpinnerName())->setAllowEdit(enable); + getChild(getAspectRatioCBName())->setEnabled(enable); +} + +void LLPanelSnapshotProfile::onSend() +{ + std::string caption = getChild("caption")->getValue().asString(); + bool add_location = getChild("add_location_cb")->getValue().asBoolean(); + + LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location); + LLFloaterSnapshot::postSave(); + + // Switch to upload progress display. + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPanel("panel_post_progress", LLSD().with("post-type", "profile")); + } +} + +void LLPanelSnapshotProfile::onCancel() +{ + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPreviousPanel(); + } +} + +void LLPanelSnapshotProfile::onResolutionComboCommit(LLUICtrl* ctrl) +{ + updateCustomResControls(); + + LLSD info; + info["combo-res-change"]["control-name"] = ctrl->getName(); + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshotProfile::onCustomResolutionCommit(LLUICtrl* ctrl) +{ + S32 w = getChild(getWidthSpinnerName())->getValue().asInteger(); + S32 h = getChild(getHeightSpinnerName())->getValue().asInteger(); + LLSD info; + info["w"] = w; + info["h"] = h; + LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); +} + +void LLPanelSnapshotProfile::onKeepAspectRatioCommit(LLUICtrl* ctrl) +{ + LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); +} diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp new file mode 100644 index 0000000000..5f57f3a856 --- /dev/null +++ b/indra/newview/llpostcard.cpp @@ -0,0 +1,160 @@ +/** + * @file llpostcard.cpp + * @brief Sending postcards. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpostcard.h" + +#include "llvfile.h" +#include "llvfs.h" +#include "llviewerregion.h" + +#include "message.h" + +#include "llagent.h" +#include "llassetuploadresponders.h" + +/////////////////////////////////////////////////////////////////////////////// +// misc + +static void postcard_upload_callback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) +{ + LLSD* postcard_data = (LLSD*)user_data; + + if (result) + { + // TODO: display the error messages in UI + llwarns << "Failed to send postcard: " << LLAssetStorage::getErrorString(result) << llendl; + LLPostCard::reportPostResult(false); + } + else + { + // only create the postcard once the upload succeeds + + // request the postcard + const LLSD& data = *postcard_data; + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("SendPostcard"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->addUUID("AssetID", data["asset-id"].asUUID()); + msg->addVector3d("PosGlobal", LLVector3d(data["pos-global"])); + msg->addString("To", data["to"]); + msg->addString("From", data["from"]); + msg->addString("Name", data["name"]); + msg->addString("Subject", data["subject"]); + msg->addString("Msg", data["msg"]); + msg->addBOOL("AllowPublish", FALSE); + msg->addBOOL("MaturePublish", FALSE); + gAgent.sendReliableMessage(); + + LLPostCard::reportPostResult(true); + } + + delete postcard_data; +} + + +/////////////////////////////////////////////////////////////////////////////// +// LLPostcardSendResponder + +class LLPostcardSendResponder : public LLAssetUploadResponder +{ + LOG_CLASS(LLPostcardSendResponder); + +public: + LLPostcardSendResponder(const LLSD &post_data, + const LLUUID& vfile_id, + LLAssetType::EType asset_type): + LLAssetUploadResponder(post_data, vfile_id, asset_type) + { + } + + /*virtual*/ void uploadComplete(const LLSD& content) + { + llinfos << "Postcard sent" << llendl; + LL_DEBUGS("Snapshots") << "content: " << content << llendl; + LLPostCard::reportPostResult(true); + } + + /*virtual*/ void uploadFailure(const LLSD& content) + { + llwarns << "Sending postcard failed: " << content << llendl; + LLPostCard::reportPostResult(false); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// LLPostCard + +LLPostCard::result_callback_t LLPostCard::mResultCallback; + +// static +void LLPostCard::send(LLPointer image, const LLSD& postcard_data) +{ +#if 0 + static LLTransactionID transaction_id; + static LLAssetID asset_id; +#else + LLTransactionID transaction_id; + LLAssetID asset_id; +#endif + + transaction_id.generate(); + asset_id = transaction_id.makeAssetID(gAgent.getSecureSessionID()); + LLVFile::writeFile(image->getData(), image->getDataSize(), gVFS, asset_id, LLAssetType::AT_IMAGE_JPEG); + + // upload the image + std::string url = gAgent.getRegion()->getCapability("SendPostcard"); + if (!url.empty()) + { + llinfos << "Sending postcard via capability" << llendl; + // the capability already encodes: agent ID, region ID + LL_DEBUGS("Snapshots") << "url: " << url << llendl; + LL_DEBUGS("Snapshots") << "body: " << postcard_data << llendl; + LL_DEBUGS("Snapshots") << "data size: " << image->getDataSize() << llendl; + LLHTTPClient::post(url, postcard_data, + new LLPostcardSendResponder(postcard_data, asset_id, LLAssetType::AT_IMAGE_JPEG)); + } + else + { + llinfos << "Sending postcard" << llendl; + LLSD* data = new LLSD(postcard_data); + (*data)["asset-id"] = asset_id; + gAssetStorage->storeAssetData(transaction_id, LLAssetType::AT_IMAGE_JPEG, + &postcard_upload_callback, (void *)data, FALSE); + } +} + +// static +void LLPostCard::reportPostResult(bool ok) +{ + if (mResultCallback) + { + mResultCallback(ok); + } +} diff --git a/indra/newview/llpostcard.h b/indra/newview/llpostcard.h new file mode 100644 index 0000000000..0eb118b906 --- /dev/null +++ b/indra/newview/llpostcard.h @@ -0,0 +1,48 @@ +/** + * @file llpostcard.h + * @brief Sending postcards. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPOSTCARD_H +#define LL_LLPOSTCARD_H + +#include "llimage.h" +#include "lluuid.h" + +class LLPostCard +{ + LOG_CLASS(LLPostCard); + +public: + typedef boost::function result_callback_t; + + static void send(LLPointer image, const LLSD& postcard_data); + static void setPostResultCallback(result_callback_t cb) { mResultCallback = cb; } + static void reportPostResult(bool ok); + +private: + static result_callback_t mResultCallback; +}; + +#endif // LL_LLPOSTCARD_H diff --git a/indra/newview/llsidetraypanelcontainer.cpp b/indra/newview/llsidetraypanelcontainer.cpp index 95a12c7c23..e340333c2c 100644 --- a/indra/newview/llsidetraypanelcontainer.cpp +++ b/indra/newview/llsidetraypanelcontainer.cpp @@ -62,6 +62,13 @@ void LLSideTrayPanelContainer::onOpen(const LLSD& key) getCurrentPanel()->onOpen(key); } +void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key) +{ + LLSD combined_key = key; + combined_key[PARAM_SUB_PANEL_NAME] = panel_name; + onOpen(combined_key); +} + void LLSideTrayPanelContainer::openPreviousPanel() { if(!mDefaultPanelName.empty()) diff --git a/indra/newview/llsidetraypanelcontainer.h b/indra/newview/llsidetraypanelcontainer.h index 14269b002b..93a85ed374 100644 --- a/indra/newview/llsidetraypanelcontainer.h +++ b/indra/newview/llsidetraypanelcontainer.h @@ -56,6 +56,11 @@ public: */ /*virtual*/ void onOpen(const LLSD& key); + /** + * Opens given subpanel. + */ + void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap()); + /** * Opens previous panel from panel navigation history. */ diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index c761969fcf..74c4f6d2dc 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -85,7 +85,6 @@ #include "llfloateropenobject.h" #include "llfloaterpay.h" #include "llfloaterperms.h" -#include "llfloaterpostcard.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" #include "llfloaterproperties.h" @@ -245,7 +244,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("postcard", "floater_postcard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 41b4dc01e8..5afd481dda 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -50,6 +50,7 @@ #include "llvoavatar.h" #include "llvoavatarself.h" #include "llviewerregion.h" +#include "llwebprofile.h" #include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this! #include "llfilepicker.h" #include "llnotifications.h" @@ -319,6 +320,10 @@ public: std::string cookie = content["set-cookie"].asString(); LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost); + + // Set cookie for snapshot publishing. + std::string auth_cookie = cookie.substr(0, cookie.find(";")); // strip path + LLWebProfile::setAuthCookie(auth_cookie); } void completedRaw( @@ -1484,6 +1489,8 @@ void LLViewerMedia::setOpenIDCookie() std::string profile_url = getProfileURL(""); LLURL raw_profile_url( profile_url.c_str() ); + LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << llendl; + LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << llendl; LLHTTPClient::get(profile_url, new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), headers); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index b9293b3b31..7e830e14bf 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -528,23 +528,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t { gViewerWindow->playSnapshotAnimAndSound(); - LLPointer formatted; - switch(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))) - { - case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: - formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality")); - break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: - formatted = new LLImagePNG; - break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: - formatted = new LLImageBMP; - break; - default: - llwarns << "Unknown Local Snapshot format" << llendl; - return true; - } - + LLPointer formatted = new LLImagePNG; formatted->enableOverSize() ; formatted->encode(raw, 0); formatted->disableOverSize() ; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a9ca70fd26..7cae19a1d2 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -59,9 +59,9 @@ #include "llfloaterland.h" #include "llfloaterregioninfo.h" #include "llfloaterlandholdings.h" -#include "llfloaterpostcard.h" #include "llfloaterpreference.h" #include "llfloatersidepanelcontainer.h" +#include "llfloatersnapshot.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llinventoryfunctions.h" @@ -6470,7 +6470,7 @@ void process_user_info_reply(LLMessageSystem* msg, void**) msg->getString( "UserData", "DirectoryVisibility", dir_visibility); LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email); - LLFloaterPostcard::updateUserInfo(email); + LLFloaterSnapshot::setAgentEmail(email); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6fcbc401af..c20bc5f02f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4020,10 +4020,11 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d } // Saves an image to the harddrive as "SnapshotX" where X >= 1. -BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image) +BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker) { if (!image) { + llwarns << "No image to save" << llendl; return FALSE; } @@ -4043,7 +4044,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image) pick_type = LLFilePicker::FFSAVE_ALL; // ??? // Get a base file location if needed. - if ( ! isSnapshotLocSet()) + if (force_picker || !isSnapshotLocSet()) { std::string proposed_name( sSnapshotBaseName ); @@ -4083,6 +4084,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image) } while( -1 != err ); // search until the file is not found (i.e., stat() gives an error). + llinfos << "Saving snapshot to " << filepath << llendl; return image->save(filepath); } diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index d10b06f121..0cb7f82b58 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -324,7 +324,7 @@ public: BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ; BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); } void resetSnapshotLoc() const { sSnapshotDir.clear(); } - BOOL saveImageNumbered(LLImageFormatted *image); + BOOL saveImageNumbered(LLImageFormatted *image, bool force_picker = false); // Reset the directory where snapshots are saved. // Client will open directory picker on next snapshot save. diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp new file mode 100644 index 0000000000..bb8a9a491b --- /dev/null +++ b/indra/newview/llwebprofile.cpp @@ -0,0 +1,297 @@ +/** + * @file llwebprofile.cpp + * @brief Web profile access. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llwebprofile.h" + +// libs +#include "llbufferstream.h" +#include "llhttpclient.h" +#include "llplugincookiestore.h" + +// newview +#include "llpanelprofile.h" // for getProfileURL(). FIXME: move the method to LLAvatarActions +#include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals + +// third-party +#include "reader.h" // JSON + +/* + * Workflow: + * 1. LLViewerMedia::setOpenIDCookie() + * -> GET https://my-demo.secondlife.com/ via LLViewerMediaWebProfileResponder + * -> LLWebProfile::setAuthCookie() + * 2. LLWebProfile::uploadImage() + * -> GET "https://my-demo.secondlife.com/snapshots/s3_upload_config" via ConfigResponder + * 3. LLWebProfile::post() + * -> POST via PostImageResponder + * -> redirect + * -> GET via PostImageRedirectResponder + */ + +/////////////////////////////////////////////////////////////////////////////// +// LLWebProfileResponders::ConfigResponder + +class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLWebProfileResponders::ConfigResponder); + +public: + ConfigResponder(LLPointer imagep) + : mImagep(imagep) + { + } + + /*virtual*/ void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + LLBufferStream istr(channels, buffer.get()); + std::stringstream strstrm; + strstrm << istr.rdbuf(); + const std::string body = strstrm.str(); + + if (status != 200) + { + llwarns << "Failed to get upload config (" << status << ")" << llendl; + LLWebProfile::reportImageUploadStatus(false); + return; + } + + Json::Value root; + Json::Reader reader; + if (!reader.parse(body, root)) + { + llwarns << "Failed to parse upload config: " << reader.getFormatedErrorMessages() << llendl; + LLWebProfile::reportImageUploadStatus(false); + return; + } + + // *TODO: 404 = not supported by the grid + // *TODO: increase timeout or handle 499 Expired + + // Convert config to LLSD. + const Json::Value data = root["data"]; + const std::string upload_url = root["url"].asString(); + LLSD config; + config["acl"] = data["acl"].asString(); + config["AWSAccessKeyId"] = data["AWSAccessKeyId"].asString(); + config["Content-Type"] = data["Content-Type"].asString(); + config["key"] = data["key"].asString(); + config["policy"] = data["policy"].asString(); + config["success_action_redirect"] = data["success_action_redirect"].asString(); + config["signature"] = data["signature"].asString(); + config["add_loc"] = data.get("add_loc", "0").asString(); + config["caption"] = data.get("caption", "").asString(); + + // Do the actual image upload using the configuration. + LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl; + LLWebProfile::post(mImagep, config, upload_url); + } + +private: + LLPointer mImagep; +}; + +/////////////////////////////////////////////////////////////////////////////// +// LLWebProfilePostImageRedirectResponder +class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLWebProfileResponders::PostImageRedirectResponder); + +public: + /*virtual*/ void completedRaw( + U32 status, + const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + if (status != 200) + { + llwarns << "Failed to upload image: " << status << " " << reason << llendl; + LLWebProfile::reportImageUploadStatus(false); + return; + } + + LLBufferStream istr(channels, buffer.get()); + std::stringstream strstrm; + strstrm << istr.rdbuf(); + const std::string body = strstrm.str(); + llinfos << "Image uploaded." << llendl; + LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << body << "]" << llendl; + LLWebProfile::reportImageUploadStatus(true); + } + +private: + LLPointer mImagep; +}; + + +/////////////////////////////////////////////////////////////////////////////// +// LLWebProfileResponders::PostImageResponder +class LLWebProfileResponders::PostImageResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLWebProfileResponders::PostImageResponder); + +public: + /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + // Viewer seems to fail to follow a 303 redirect on POST request + // (URLRequest Error: 65, Send failed since rewinding of the data stream failed). + // Handle it manually. + if (status == 303) + { + LLSD headers = LLViewerMedia::getHeaders(); + headers["Cookie"] = LLWebProfile::getAuthCookie(); + const std::string& redir_url = content["location"]; + LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << llendl; + LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder, headers); + } + else + { + llwarns << "Unexpected POST status: " << status << " " << reason << llendl; + LL_DEBUGS("Snapshots") << "headers: [" << content << "]" << llendl; + LLWebProfile::reportImageUploadStatus(false); + } + } + + // Override just to suppress warnings. + /*virtual*/ void completedRaw(U32 status, const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// LLWebProfile + +std::string LLWebProfile::sAuthCookie; +LLWebProfile::status_callback_t LLWebProfile::mStatusCallback; + +// static +void LLWebProfile::uploadImage(LLPointer image, const std::string& caption, bool add_location) +{ + // Get upload configuration data. + std::string config_url(getProfileURL(LLStringUtil::null) + "snapshots/s3_upload_config"); + config_url += "?caption=" + LLURI::escape(caption); + config_url += "&add_loc=" + std::string(add_location ? "1" : "0"); + + LL_DEBUGS("Snapshots") << "Requesting " << config_url << llendl; + LLSD headers = LLViewerMedia::getHeaders(); + headers["Cookie"] = getAuthCookie(); + LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image), headers); +} + +// static +void LLWebProfile::setAuthCookie(const std::string& cookie) +{ + LL_DEBUGS("Snapshots") << "Setting auth cookie: " << cookie << llendl; + sAuthCookie = cookie; +} + +// static +void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url) +{ + // *TODO: make sure it's a jpeg? + + const std::string boundary = "----------------------------0123abcdefab"; + + LLSD headers = LLViewerMedia::getHeaders(); + headers["Cookie"] = getAuthCookie(); + headers["Content-Type"] = "multipart/form-data; boundary=" + boundary; + + std::ostringstream body; + + // *NOTE: The order seems to matter. + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"key\"\r\n\r\n" + << config["key"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"AWSAccessKeyId\"\r\n\r\n" + << config["AWSAccessKeyId"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"acl\"\r\n\r\n" + << config["acl"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"Content-Type\"\r\n\r\n" + << config["Content-Type"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"policy\"\r\n\r\n" + << config["policy"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"signature\"\r\n\r\n" + << config["signature"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"success_action_redirect\"\r\n\r\n" + << config["success_action_redirect"].asString() << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"file\"; filename=\"snapshot.jpg\"\r\n" + << "Content-Type: image/jpeg\r\n\r\n"; + + // Insert the image data. + // *FIX: Treating this as a string will probably screw it up ... + U8* image_data = image->getData(); + for (S32 i = 0; i < image->getDataSize(); ++i) + { + body << image_data[i]; + } + + body << "\r\n--" << boundary << "--\r\n"; + + // postRaw() takes ownership of the buffer and releases it later. + size_t size = body.str().size(); + U8 *data = new U8[size]; + memcpy(data, body.str().data(), size); + + // Send request, successful upload will trigger posting metadata. + LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(), headers); +} + +// static +void LLWebProfile::reportImageUploadStatus(bool ok) +{ + if (mStatusCallback) + { + mStatusCallback(ok); + } +} + +// static +std::string LLWebProfile::getAuthCookie() +{ + return sAuthCookie; +} diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h new file mode 100644 index 0000000000..10279bffac --- /dev/null +++ b/indra/newview/llwebprofile.h @@ -0,0 +1,69 @@ +/** + * @file llwebprofile.h + * @brief Web profile access. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWEBPROFILE_H +#define LL_LLWEBPROFILE_H + +#include "llimage.h" + +namespace LLWebProfileResponders +{ + class ConfigResponder; + class PostImageResponder; + class PostImageRedirectResponder; +}; + +/** + * @class LLWebProfile + * + * Manages interaction with, a web service allowing the upload of snapshot images + * taken within the viewer. + */ +class LLWebProfile +{ + LOG_CLASS(LLWebProfile); + +public: + typedef boost::function status_callback_t; + + static void uploadImage(LLPointer image, const std::string& caption, bool add_location); + static void setAuthCookie(const std::string& cookie); + static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; } + +private: + friend class LLWebProfileResponders::ConfigResponder; + friend class LLWebProfileResponders::PostImageResponder; + friend class LLWebProfileResponders::PostImageRedirectResponder; + + static void post(LLPointer image, const LLSD& config, const std::string& url); + static void reportImageUploadStatus(bool ok); + static std::string getAuthCookie(); + + static std::string sAuthCookie; + static status_callback_t mStatusCallback; +}; + +#endif // LL_LLWEBPROFILE_H diff --git a/indra/newview/skins/default/textures/snapshot_download.png b/indra/newview/skins/default/textures/snapshot_download.png new file mode 100644 index 0000000000..c8c6236c96 Binary files /dev/null and b/indra/newview/skins/default/textures/snapshot_download.png differ diff --git a/indra/newview/skins/default/textures/snapshot_email.png b/indra/newview/skins/default/textures/snapshot_email.png new file mode 100644 index 0000000000..8a1a9bcde9 Binary files /dev/null and b/indra/newview/skins/default/textures/snapshot_email.png differ diff --git a/indra/newview/skins/default/textures/snapshot_inventory.png b/indra/newview/skins/default/textures/snapshot_inventory.png new file mode 100644 index 0000000000..56487ec443 Binary files /dev/null and b/indra/newview/skins/default/textures/snapshot_inventory.png differ diff --git a/indra/newview/skins/default/textures/snapshot_profile.png b/indra/newview/skins/default/textures/snapshot_profile.png new file mode 100644 index 0000000000..c8b90fb40b Binary files /dev/null and b/indra/newview/skins/default/textures/snapshot_profile.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index bb91d32c6c..0e1f711627 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -547,6 +547,10 @@ with the same filename but different name + + + + diff --git a/indra/newview/skins/default/xui/en/floater_postcard.xml b/indra/newview/skins/default/xui/en/floater_postcard.xml deleted file mode 100644 index adc2433105..0000000000 --- a/indra/newview/skins/default/xui/en/floater_postcard.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - Postcard from [SECOND_LIFE]. - - - Check this out! - - - Sending... - - - Recipient's Email: - - - - Your Email: - - - - Your Name: - - - - Subject: - - - - Message: - - - Type your message here. - - + + diff --git a/indra/newview/skins/default/xui/en/panel_postcard_message.xml b/indra/newview/skins/default/xui/en/panel_postcard_message.xml new file mode 100644 index 0000000000..c2a3c70b6e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_postcard_message.xml @@ -0,0 +1,137 @@ + + + + Recipient's Email: + + + + Your Email: + + + + Your Name: + + + + Subject: + + + + Message: + + + Type your message here. + + + + diff --git a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml new file mode 100644 index 0000000000..84e3593798 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + ([QLVL]) + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml new file mode 100644 index 0000000000..cb243fbc5b --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml @@ -0,0 +1,146 @@ + + + + + Save to My Inventory + + + + Saving an image to your inventory costs L$TBD. To save your image as a texture select one of the square formats. + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml new file mode 100644 index 0000000000..fd2c735df7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml @@ -0,0 +1,191 @@ + + + + + Save to My Computer + + + + + + + + + + + + + + + + + + + + + + + ([QLVL]) + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml new file mode 100644 index 0000000000..e6324f8923 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -0,0 +1,80 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml new file mode 100644 index 0000000000..fc041e07bd --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml @@ -0,0 +1,107 @@ + + + + Postcard from [SECOND_LIFE]. + + + Check this out! + + + Sending... + + + Postcard from [SECOND_LIFE]. + + + Check this out! + + + + Email + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml new file mode 100644 index 0000000000..e03508f5cc --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml @@ -0,0 +1,165 @@ + + + + + Post to My Profile Feed + + + + + + + + + + + + + + Caption: + + + + + + + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ec230773cc..befcc5dd87 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3724,4 +3724,12 @@ Try enclosing path to the editor with double quotes. Wrap Preview Normal + + + Very Low + Low + Medium + High + Very High + -- cgit v1.2.3 From 2da4d944a71d3d7bd599baaedb5128cf873fc551 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 2 Nov 2011 10:40:02 -0700 Subject: EXP-1492 Avatar picker floater should be 4.5 thumbnails wide --- indra/newview/skins/default/xui/en/floater_avatar.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml index 2d973e7d90..6009821f7f 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar.xml @@ -16,11 +16,11 @@ save_rect="true" save_visibility="true" title="AVATAR PICKER" - width="635"> + width="700"> -- cgit v1.2.3 From a900701f55ee0acea8ce6e44002c509d9f03b756 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 2 Nov 2011 11:03:38 -0700 Subject: EXP-1474 FIX -- Create Classified does not work from Search Window * The code now opens the "picks" window and starts the "create new classified" action on it directly. Reviewed by Richard. --- indra/newview/llpanelpicks.cpp | 11 +++++------ indra/newview/llpanelpicks.h | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 72c6be4c79..360197ce55 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -247,12 +247,11 @@ public: void createClassified() { - // open the new classified panel on the Me > Picks sidetray - LLSD params; - params["id"] = gAgent.getID(); - params["open_tab_name"] = "panel_picks"; - params["show_tab_panel"] = "create_classified"; - LLFloaterSidePanelContainer::showPanel("my_profile", params); + // open the new classified panel on the Picks floater + LLFloater* picks_floater = LLFloaterReg::showInstance("picks"); + + LLPanelPicks* picks = picks_floater->findChild("panel_picks"); + picks->createNewClassified(); } void openClassified(LLAvatarClassifiedInfo* c_info) diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index 29db110523..3bb7413ac3 100755 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -82,6 +82,9 @@ public: // parent panels failed to work (picks related code was in my profile panel) void setProfilePanel(LLPanelProfile* profile_panel); + void createNewPick(); + void createNewClassified(); + protected: /*virtual*/void updateButtons(); @@ -115,9 +118,6 @@ private: bool onEnableMenuItem(const LLSD& user_data); - void createNewPick(); - void createNewClassified(); - void openPickInfo(); void openClassifiedInfo(); void openClassifiedInfo(const LLSD& params); -- cgit v1.2.3 From 2179e1c1f2f3614678d528fe96640728ce663f2e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 2 Nov 2011 13:13:38 -0500 Subject: SH-2541 Fix for speckles on avatar on some cards -- don't use "maximum_alpha" for alpha tests in shaders as it was always being set to 1.0 anyway. --- indra/llrender/llglslshader.cpp | 5 ++-- indra/llrender/llglslshader.h | 2 +- indra/llrender/llshadermgr.cpp | 3 ++ indra/llrender/llshadermgr.h | 2 ++ .../shaders/class1/deferred/diffuseAlphaMaskF.glsl | 3 +- .../class1/deferred/diffuseAlphaMaskIndexedF.glsl | 3 +- .../class1/deferred/diffuseAlphaMaskNoColorF.glsl | 3 +- .../shaders/class1/deferred/impostorF.glsl | 3 +- .../shaders/class1/deferred/shadowAlphaMaskF.glsl | 3 +- .../shaders/class1/deferred/treeF.glsl | 3 +- .../shaders/class1/deferred/treeShadowF.glsl | 3 +- .../shaders/class1/interface/alphamaskF.glsl | 3 +- .../shaders/class1/lighting/lightAlphaMaskF.glsl | 3 +- .../class1/lighting/lightAlphaMaskNonIndexedF.glsl | 4 +-- .../class1/lighting/lightFullbrightAlphaMaskF.glsl | 3 +- .../lightFullbrightNonIndexedAlphaMaskF.glsl | 3 +- .../lighting/lightFullbrightWaterAlphaMaskF.glsl | 3 +- .../lightFullbrightWaterNonIndexedAlphaMaskF.glsl | 3 +- .../class1/lighting/lightWaterAlphaMaskF.glsl | 3 +- .../lighting/lightWaterAlphaMaskNonIndexedF.glsl | 3 +- .../shaders/class1/objects/impostorF.glsl | 3 +- indra/newview/lldrawpoolalpha.cpp | 16 +++++----- indra/newview/lldrawpoolavatar.cpp | 12 ++++---- indra/newview/lldrawpoolsimple.cpp | 4 +-- indra/newview/lldrawpooltree.cpp | 6 ++-- indra/newview/lltexlayer.cpp | 34 +++++++++++----------- indra/newview/pipeline.cpp | 4 +-- 27 files changed, 63 insertions(+), 77 deletions(-) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index d6ab5208c6..5a6f3d8292 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1009,9 +1009,8 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) } } -void LLGLSLShader::setAlphaRange(F32 minimum, F32 maximum) +void LLGLSLShader::setMinimumAlpha(F32 minimum) { gGL.flush(); - uniform1f("minimum_alpha", minimum); - uniform1f("maximum_alpha", maximum); + uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum); } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index eb19599eca..2a6c050eac 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -108,7 +108,7 @@ public: void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void setAlphaRange(F32 minimum, F32 maximum); + void setMinimumAlpha(F32 minimum); void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void vertexAttrib4fv(U32 index, GLfloat* v); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 810afe210d..84dc768983 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1009,6 +1009,9 @@ void LLShaderMgr::initAttribsAndUniforms() llassert(mReservedUniforms.size() == LLShaderMgr::GLOW_DELTA+1); + + mReservedUniforms.push_back("minimum_alpha"); + mReservedUniforms.push_back("shadow_matrix"); mReservedUniforms.push_back("env_mat"); mReservedUniforms.push_back("shadow_clip"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 9cc2f1bd7f..a5150b3e51 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -107,6 +107,8 @@ public: GLOW_STRENGTH, GLOW_DELTA, + MINIMUM_ALPHA, + DEFERRED_SHADOW_MATRIX, DEFERRED_ENV_MAT, DEFERRED_SHADOW_CLIP, diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index 14b79c37fd..e9989a4e48 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragData[3]; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -40,7 +39,7 @@ void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl index 381fba8813..fdf8d72b38 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl @@ -30,7 +30,6 @@ out vec4 gl_FragData[3]; VARYING vec3 vary_normal; uniform float minimum_alpha; -uniform float maximum_alpha; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; @@ -39,7 +38,7 @@ void main() { vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl index b582ba7f9c..bb20e2ca47 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl @@ -29,7 +29,6 @@ out vec4 gl_FragData[3]; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -40,7 +39,7 @@ void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 5decddebbb..a44173a2a4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragData[3]; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -41,7 +40,7 @@ void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 71b12326d8..46d42d2a4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -40,7 +39,7 @@ void main() { float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a; - if (alpha < minimum_alpha || alpha > maximum_alpha) + if (alpha < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index b934bc6991..ea98d6884c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -34,12 +34,11 @@ VARYING vec3 vary_normal; VARYING vec2 vary_texcoord0; uniform float minimum_alpha; -uniform float maximum_alpha; void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl index 29ec6e6bee..20d0170535 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -39,7 +38,7 @@ void main() { float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a; - if (alpha < minimum_alpha || alpha > maximum_alpha) + if (alpha < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl index 4f2767fc97..d2f5e1987a 100644 --- a/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/alphamaskF.glsl @@ -30,7 +30,6 @@ out vec4 gl_FragColor; uniform sampler2D diffuseMap; uniform float minimum_alpha; -uniform float maximum_alpha; VARYING vec2 vary_texcoord0; VARYING vec4 vertex_color; @@ -38,7 +37,7 @@ VARYING vec4 vertex_color; void main() { vec4 col = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy); - if (col.a < minimum_alpha || col.a > maximum_alpha) + if (col.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl index 6815f7aa85..10413bdeb0 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); @@ -40,7 +39,7 @@ void default_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl index 2640668d7d..1164e5b0a6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl @@ -28,8 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; - uniform sampler2D diffuseMap; @@ -43,7 +41,7 @@ void default_lighting() { vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl index 92113d9afa..ba99c0ed71 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -40,7 +39,7 @@ void fullbright_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl index d1ad3da009..276fad4f44 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -42,7 +41,7 @@ void fullbright_lighting() { vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl index 32a1c71099..754b2922d9 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; vec4 diffuseLookup(vec2 texcoord); @@ -42,7 +41,7 @@ void fullbright_lighting_water() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl index 1b5aa61441..f69b907dc7 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -42,7 +41,7 @@ void fullbright_lighting_water() { vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl index 60289cf7f7..103dd633c9 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); @@ -40,7 +39,7 @@ void default_lighting_water() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl index d0038ae89b..bef72752da 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -42,7 +41,7 @@ void default_lighting_water() { vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl index e7c81888eb..3c6e22b295 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl @@ -28,7 +28,6 @@ out vec4 gl_FragColor; #endif uniform float minimum_alpha; -uniform float maximum_alpha; uniform sampler2D diffuseMap; @@ -38,7 +37,7 @@ void main() { vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); - if (color.a < minimum_alpha || color.a > maximum_alpha) + if (color.a < minimum_alpha) { discard; } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 230c4e2638..54f937d8fd 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -90,7 +90,7 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) { LLFastTimer t(FTM_RENDER_GRASS); gDeferredDiffuseAlphaMaskProgram.bind(); - gDeferredDiffuseAlphaMaskProgram.setAlphaRange(0.33f, 1.f); + gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); //render alpha masked objects LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -136,7 +136,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) simple_shader = NULL; fullbright_shader = NULL; gObjectFullbrightAlphaMaskProgram.bind(); - gObjectFullbrightAlphaMaskProgram.setAlphaRange(0.33f, 1.f); + gObjectFullbrightAlphaMaskProgram.setMinimumAlpha(0.33f); } deferred_render = TRUE; @@ -232,14 +232,14 @@ void LLDrawPoolAlpha::render(S32 pass) if (!LLPipeline::sRenderDeferred || !deferred_render) { simple_shader->bind(); - simple_shader->setAlphaRange(0.33f, 1.f); + simple_shader->setMinimumAlpha(0.33f); pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } if (fullbright_shader) { fullbright_shader->bind(); - fullbright_shader->setAlphaRange(0.33f, 1.f); + fullbright_shader->setMinimumAlpha(0.33f); } pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); @@ -275,16 +275,16 @@ void LLDrawPoolAlpha::render(S32 pass) if (LLPipeline::sImpostorRender) { fullbright_shader->bind(); - fullbright_shader->setAlphaRange(0.5f, 1.f); + fullbright_shader->setMinimumAlpha(0.5f); simple_shader->bind(); - simple_shader->setAlphaRange(0.5f, 1.f); + simple_shader->setMinimumAlpha(0.5f); } else { fullbright_shader->bind(); - fullbright_shader->setAlphaRange(0.f, 1.f); + fullbright_shader->setMinimumAlpha(0.f); simple_shader->bind(); - simple_shader->setAlphaRange(0.f, 1.f); + simple_shader->setMinimumAlpha(0.f); } } else diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 7290a48a1a..60313b25a0 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -576,7 +576,7 @@ void LLDrawPoolAvatar::beginImpostor() if (LLGLSLShader::sNoFixedFunction) { gImpostorProgram.bind(); - gImpostorProgram.setAlphaRange(0.01f, 1.f); + gImpostorProgram.setMinimumAlpha(0.01f); } gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); @@ -608,7 +608,7 @@ void LLDrawPoolAvatar::beginRigid() if (sVertexProgram != NULL) { //eyeballs render with the specular shader sVertexProgram->bind(); - sVertexProgram->setAlphaRange(0.2f, 1.f); + sVertexProgram->setMinimumAlpha(0.2f); } } else @@ -641,7 +641,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor() sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); sVertexProgram->bind(); - sVertexProgram->setAlphaRange(0.01f, 1.f); + sVertexProgram->setMinimumAlpha(0.01f); } void LLDrawPoolAvatar::endDeferredImpostor() @@ -659,7 +659,7 @@ void LLDrawPoolAvatar::beginDeferredRigid() sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; sVertexProgram->bind(); - sVertexProgram->setAlphaRange(0.2f, 1.f); + sVertexProgram->setMinimumAlpha(0.2f); } void LLDrawPoolAvatar::endDeferredRigid() @@ -716,7 +716,7 @@ void LLDrawPoolAvatar::beginSkinned() if (LLGLSLShader::sNoFixedFunction) { - sVertexProgram->setAlphaRange(0.2f, 1.f); + sVertexProgram->setMinimumAlpha(0.2f); } } @@ -1014,7 +1014,7 @@ void LLDrawPoolAvatar::beginDeferredSkinned() sRenderingSkinned = TRUE; sVertexProgram->bind(); - sVertexProgram->setAlphaRange(0.2f, 1.f); + sVertexProgram->setMinimumAlpha(0.2f); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gGL.getTexUnit(0)->activate(); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 80c202d4e2..6e0ea78af2 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -269,7 +269,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); - simple_shader->setAlphaRange(0.5f, 1.f); + simple_shader->setMinimumAlpha(0.5f); } else { @@ -325,7 +325,7 @@ void LLDrawPoolGrass::renderDeferred(S32 pass) { LLFastTimer t(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); - gDeferredNonIndexedDiffuseAlphaMaskProgram.setAlphaRange(0.5f, 1.f); + gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); //render grass LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index cdf6e1ab52..d198e28c14 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -75,7 +75,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) if (gPipeline.canUseVertexShaders()) { shader->bind(); - shader->setAlphaRange(0.5f, 1.f); + shader->setMinimumAlpha(0.5f); gGL.diffuseColor4f(1,1,1,1); } else @@ -144,7 +144,7 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass) shader = &gDeferredTreeProgram; shader->bind(); - shader->setAlphaRange(0.5f, 1.f); + shader->setMinimumAlpha(0.5f); } void LLDrawPoolTree::renderDeferred(S32 pass) @@ -170,7 +170,7 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) gSavedSettings.getF32("RenderDeferredTreeShadowBias")); gDeferredTreeShadowProgram.bind(); - gDeferredTreeShadowProgram.setAlphaRange(0.5f, 1.f); + gDeferredTreeShadowProgram.setMinimumAlpha(0.5f); } void LLDrawPoolTree::renderShadow(S32 pass) diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 9f5cbf6ec8..6f6d5dbf12 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -300,7 +300,7 @@ BOOL LLTexLayerSetBuffer::render() if (use_shaders) { gAlphaMaskProgram.bind(); - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } LLVertexBuffer::unbind(); @@ -947,7 +947,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) LLGLDisable no_alpha(GL_ALPHA_TEST); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.0f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.0f); } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); @@ -957,7 +957,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) gGL.flush(); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } @@ -987,7 +987,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) LLGLDisable no_alpha(GL_ALPHA_TEST); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -999,7 +999,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) gGL.flush(); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } @@ -1135,7 +1135,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, LLGLDisable no_alpha(GL_ALPHA_TEST); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); @@ -1145,7 +1145,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, gGL.flush(); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } @@ -1717,7 +1717,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0); if (use_shaders && no_alpha_test) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); @@ -1731,7 +1731,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); if (use_shaders && no_alpha_test) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } @@ -1768,14 +1768,14 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) LLGLDisable no_alpha(GL_ALPHA_TEST); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( net_color.mV ); gl_rect_2d_simple( width, height ); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } @@ -1874,14 +1874,14 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) LLGLSNoAlphaTest gls_no_alpha_test; if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.getTexUnit(0)->bind(tex, TRUE); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } else @@ -1899,7 +1899,7 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) LLGLSNoAlphaTest gls_no_alpha_test; if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.getTexUnit(0)->bind(tex); gl_rect_2d_simple_tex( width, height ); @@ -1907,7 +1907,7 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) success = TRUE; if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } } } @@ -1931,7 +1931,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.f); } gGL.setColorMask(false, true); @@ -2011,7 +2011,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC if (use_shaders) { - gAlphaMaskProgram.setAlphaRange(0.004f, 1.f); + gAlphaMaskProgram.setMinimumAlpha(0.004f); } LLGLSUIDefault gls_ui; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 76ddeab203..152f4728dd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8154,10 +8154,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera { LLFastTimer ftm(FTM_SHADOW_ALPHA); gDeferredShadowAlphaMaskProgram.bind(); - gDeferredShadowAlphaMaskProgram.setAlphaRange(0.598f, 1.f); + gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f); renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); gDeferredTreeShadowProgram.bind(); - gDeferredTreeShadowProgram.setAlphaRange(0.598f, 1.f); + gDeferredTreeShadowProgram.setMinimumAlpha(0.598f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); } -- cgit v1.2.3 From 7661f809ece7ea853bd1cf3d654d1321d28826c0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 11:32:28 -0700 Subject: removed deprecated minimal skin stuff --- indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml | 4 ---- indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml | 4 ---- indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml | 4 ---- 3 files changed, 12 deletions(-) delete mode 100644 indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml delete mode 100644 indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml delete mode 100644 indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml diff --git a/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml deleted file mode 100644 index f95913ef2b..0000000000 --- a/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml deleted file mode 100644 index 2efe6d7e71..0000000000 --- a/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml deleted file mode 100644 index a0a8520650..0000000000 --- a/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - -- cgit v1.2.3 From 334d8f4076b4045e8fd4ede5fd9d31f0b185ded4 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 2 Nov 2011 11:42:41 -0700 Subject: Updating 'createPick' behavior to mirror new 'createClassified' behavior --- indra/newview/llpanelpicks.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 360197ce55..04e78e04e3 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -130,11 +130,11 @@ public: void createPick() { - LLSD params; - params["id"] = gAgent.getID(); - params["open_tab_name"] = "panel_picks"; - params["show_tab_panel"] = "create_pick"; - LLFloaterSidePanelContainer::showPanel("my_profile", params); + // open the new pick panel on the Picks floater + LLFloater* picks_floater = LLFloaterReg::showInstance("picks"); + + LLPanelPicks* picks = picks_floater->findChild("panel_picks"); + picks->createNewPick(); } void editPick(LLPickData* pick_info) -- cgit v1.2.3 From 8485199c650680881b0a50341440fc5f66fcbffe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 11:51:27 -0700 Subject: removed some unused texture references --- indra/newview/skins/default/textures/textures.xml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 0f3769f0f8..362248c3c5 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -157,7 +157,6 @@ with the same filename but different name - @@ -572,21 +571,14 @@ with the same filename but different name - - - - - - - @@ -650,6 +642,12 @@ with the same filename but different name + + + + + + @@ -682,9 +680,6 @@ with the same filename but different name - - - @@ -718,7 +713,6 @@ with the same filename but different name - @@ -735,7 +729,6 @@ with the same filename but different name - -- cgit v1.2.3 From 6cd39ec82afa41f7d7d4ad992bda9c1ba5d55913 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 11:52:02 -0700 Subject: EXP-1390 WIP Cannot see full sound icon when in IM call when background is a dark color voice icons with dark background --- .../default/textures/bottomtray/VoicePTT_Lvl1_Dark.png | Bin 0 -> 1394 bytes .../default/textures/bottomtray/VoicePTT_Lvl2_Dark.png | Bin 0 -> 1453 bytes .../default/textures/bottomtray/VoicePTT_Lvl3_Dark.png | Bin 0 -> 1426 bytes .../default/textures/bottomtray/VoicePTT_Off_Dark.png | Bin 0 -> 1353 bytes .../default/textures/bottomtray/VoicePTT_On_Dark.png | Bin 0 -> 1342 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png create mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png create mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png create mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png create mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png new file mode 100644 index 0000000000..9ef5465dd3 Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png new file mode 100644 index 0000000000..38918b9bed Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png new file mode 100644 index 0000000000..180385e29e Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png new file mode 100644 index 0000000000..42fed4183b Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png new file mode 100644 index 0000000000..fa09006d1f Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png differ -- cgit v1.2.3 From 7e0444cbe7643b119c9630e365002f4c46987fd7 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 2 Nov 2011 11:59:33 -0700 Subject: STORM-1678: Correct map display when For Sale is enabled --- indra/newview/llworldmapview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 265d5dc801..e99657cd22 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -422,7 +422,7 @@ void LLWorldMapView::draw() // Draw something whenever we have enough info if (overlayimage->hasGLTexture()) { - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); + gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); gGL.getTexUnit(0)->bind(overlayimage); gGL.color4f(1.f, 1.f, 1.f, 1.f); gGL.begin(LLRender::QUADS); -- cgit v1.2.3 From 6c9227df13facff681adb95b9715c35cc3077531 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 2 Nov 2011 13:31:51 -0600 Subject: fix for SH-2559: [crashhunters] crash in LLPluginMessage::generate() discussed and reviewed by callum. --- indra/newview/llviewermedia.cpp | 70 ++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 41b4dc01e8..21f5f23652 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2450,44 +2450,58 @@ BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::updateJavascriptObject() { + static LLFrameTimer timer ; + if ( mMediaSource ) { // flag to expose this information to internal browser or not. bool enable = gSavedSettings.getBOOL("BrowserEnableJSObject"); + + if(!enable) + { + return ; //no need to go further. + } + + if(timer.getElapsedTimeF32() < 1.0f) + { + return ; //do not update more than once per second. + } + timer.reset() ; + mMediaSource->jsEnableObject( enable ); // these values are only menaingful after login so don't set them before bool logged_in = LLLoginInstance::getInstance()->authSuccess(); if ( logged_in ) { - // current location within a region - LLVector3 agent_pos = gAgent.getPositionAgent(); - double x = agent_pos.mV[ VX ]; - double y = agent_pos.mV[ VY ]; - double z = agent_pos.mV[ VZ ]; - mMediaSource->jsAgentLocationEvent( x, y, z ); - - // current location within the grid - LLVector3d agent_pos_global = gAgent.getLastPositionGlobal(); - double global_x = agent_pos_global.mdV[ VX ]; - double global_y = agent_pos_global.mdV[ VY ]; - double global_z = agent_pos_global.mdV[ VZ ]; - mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z ); - - // current agent orientation - double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] ); - double angle = rotation * RAD_TO_DEG; - if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation! - mMediaSource->jsAgentOrientationEvent( angle ); - - // current region agent is in - std::string region_name(""); - LLViewerRegion* region = gAgent.getRegion(); - if ( region ) - { - region_name = region->getName(); - }; - mMediaSource->jsAgentRegionEvent( region_name ); + // current location within a region + LLVector3 agent_pos = gAgent.getPositionAgent(); + double x = agent_pos.mV[ VX ]; + double y = agent_pos.mV[ VY ]; + double z = agent_pos.mV[ VZ ]; + mMediaSource->jsAgentLocationEvent( x, y, z ); + + // current location within the grid + LLVector3d agent_pos_global = gAgent.getLastPositionGlobal(); + double global_x = agent_pos_global.mdV[ VX ]; + double global_y = agent_pos_global.mdV[ VY ]; + double global_z = agent_pos_global.mdV[ VZ ]; + mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z ); + + // current agent orientation + double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] ); + double angle = rotation * RAD_TO_DEG; + if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation! + mMediaSource->jsAgentOrientationEvent( angle ); + + // current region agent is in + std::string region_name(""); + LLViewerRegion* region = gAgent.getRegion(); + if ( region ) + { + region_name = region->getName(); + }; + mMediaSource->jsAgentRegionEvent( region_name ); } // language code the viewer is set to -- cgit v1.2.3 From db8267f95109cccb94cde8b9673df995dddc7a3e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 2 Nov 2011 14:47:01 -0500 Subject: SH-1427 Fix for shader compilation failure when detail set to "mid" --- .../app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 4fe0ef9caf..6ff860362c 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -38,7 +38,7 @@ vec3 atmosAffectDirectionalLight(float lightIntensity) vec3 atmosGetDiffuseSunlightColor() { - return sunlight_color.rgb; + return sunlight_color_copy.rgb; } vec3 scaleDownLight(vec3 light) -- cgit v1.2.3 From a9b5e3830ba27b6332194ce983ae6eb2ad78c8fd Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 2 Nov 2011 22:23:25 +0200 Subject: STORM-1580 WIP Fixed build. --- indra/newview/llfloatersnapshot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index c8c66931a1..9171f222e5 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2138,7 +2138,7 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 } } #endif - previewp->setMaxImageSize(getWidthSpinner(view)->getMaxValue()) ; + previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ; // Check image size changes the value of height and width if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize()) -- cgit v1.2.3 From 139c13bdc0387f50d9f3a71737a95a4585bc471c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 2 Nov 2011 13:43:14 -0700 Subject: EXP-1473 : FIX. Added an onOpen key to open directly on the Landmarks list. Used this from the favorites toolbar Open Landmark. Also fixed the ugly stretching of the overflow button in edit landmark panel. --- indra/newview/llfavoritesbar.cpp | 4 +- indra/newview/llpanelplaces.cpp | 154 ++++++++++++--------- .../newview/skins/default/xui/en/panel_places.xml | 4 +- 3 files changed, 95 insertions(+), 67 deletions(-) diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 6c9058caf1..f254ec8c52 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1016,7 +1016,9 @@ void LLFavoritesBarCtrl::addOpenLandmarksMenuItem(LLToggleableMenu* menu) LLMenuItemCallGL::Params item_params; item_params.name("open_my_landmarks"); item_params.label(translated ? label_transl: label_untrans); - item_params.on_click.function(boost::bind(&LLFloaterSidePanelContainer::showPanel, "places", LLSD())); + LLSD key; + key["type"] = "open_landmark_tab"; + item_params.on_click.function(boost::bind(&LLFloaterSidePanelContainer::showPanel, "places", key)); LLMenuItemCallGL* menu_item = LLUICtrlFactory::create(item_params); fitLabelWidth(menu_item); diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 7f8f9b29af..6d321d4716 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -82,6 +82,7 @@ static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark"; static const std::string LANDMARK_INFO_TYPE = "landmark"; static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place"; static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history"; +static const std::string LANDMARK_TAB_INFO_TYPE = "open_landmark_tab"; // Support for secondlife:///app/parcel/{UUID}/about SLapps class LLParcelHandler : public LLCommandHandler @@ -365,83 +366,104 @@ void LLPanelPlaces::onOpen(const LLSD& key) if (key.size() != 0) { - mFilterEditor->clear(); - onFilterEdit("", false); - - mPlaceInfoType = key["type"].asString(); - mPosGlobal.setZero(); - mItem = NULL; - isLandmarkEditModeOn = false; - togglePlaceInfoPanel(TRUE); - - if (mPlaceInfoType == AGENT_INFO_TYPE) + std::string key_type = key["type"].asString(); + if (key_type == LANDMARK_TAB_INFO_TYPE) { - mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT); + // Small hack: We need to toggle twice. The first toggle moves from the Landmark + // or Teleport History info panel to the Landmark or Teleport History list panel. + // For this first toggle, the mPlaceInfoType should be the one previously used so + // that the state can be corretly set. + // The second toggle forces the list to be set to Landmark. + // This avoids extracting and duplicating all the state logic from togglePlaceInfoPanel() + // here or some specific private method + togglePlaceInfoPanel(FALSE); + mPlaceInfoType = key_type; + togglePlaceInfoPanel(FALSE); + // Update the active tab + onTabSelected(); + // Update the buttons at the bottom of the panel + updateVerbs(); } - else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE) + else { - mLandmarkInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK); + mFilterEditor->clear(); + onFilterEdit("", false); - if (key.has("x") && key.has("y") && key.has("z")) + mPlaceInfoType = key_type; + mPosGlobal.setZero(); + mItem = NULL; + isLandmarkEditModeOn = false; + togglePlaceInfoPanel(TRUE); + + if (mPlaceInfoType == AGENT_INFO_TYPE) { - mPosGlobal = LLVector3d(key["x"].asReal(), - key["y"].asReal(), - key["z"].asReal()); + mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT); } - else + else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE) { - mPosGlobal = gAgent.getPositionGlobal(); + mLandmarkInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK); + + if (key.has("x") && key.has("y") && key.has("z")) + { + mPosGlobal = LLVector3d(key["x"].asReal(), + key["y"].asReal(), + key["z"].asReal()); + } + else + { + mPosGlobal = gAgent.getPositionGlobal(); + } + + mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal); + + mSaveBtn->setEnabled(FALSE); } - - mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal); - - mSaveBtn->setEnabled(FALSE); - } - else if (mPlaceInfoType == LANDMARK_INFO_TYPE) - { - mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK); - - LLInventoryItem* item = gInventory.getItem(key["id"].asUUID()); - if (!item) - return; - - setItem(item); - } - else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE) - { - if (key.has("id")) + else if (mPlaceInfoType == LANDMARK_INFO_TYPE) { - LLUUID parcel_id = key["id"].asUUID(); - mPlaceProfile->setParcelID(parcel_id); + mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK); - // query the server to get the global 3D position of this - // parcel - we need this for teleport/mapping functions. - mRemoteParcelObserver->setParcelID(parcel_id); + LLInventoryItem* item = gInventory.getItem(key["id"].asUUID()); + if (!item) + return; + + setItem(item); } - else + else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE) { - mPosGlobal = LLVector3d(key["x"].asReal(), - key["y"].asReal(), - key["z"].asReal()); - mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + if (key.has("id")) + { + LLUUID parcel_id = key["id"].asUUID(); + mPlaceProfile->setParcelID(parcel_id); + + // query the server to get the global 3D position of this + // parcel - we need this for teleport/mapping functions. + mRemoteParcelObserver->setParcelID(parcel_id); + } + else + { + mPosGlobal = LLVector3d(key["x"].asReal(), + key["y"].asReal(), + key["z"].asReal()); + mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + } + + mPlaceProfile->setInfoType(LLPanelPlaceInfo::PLACE); } + else if (mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) + { + S32 index = key["id"].asInteger(); - mPlaceProfile->setInfoType(LLPanelPlaceInfo::PLACE); - } - else if (mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) - { - S32 index = key["id"].asInteger(); + const LLTeleportHistoryStorage::slurl_list_t& hist_items = + LLTeleportHistoryStorage::getInstance()->getItems(); - const LLTeleportHistoryStorage::slurl_list_t& hist_items = - LLTeleportHistoryStorage::getInstance()->getItems(); + mPosGlobal = hist_items[index].mGlobalPos; - mPosGlobal = hist_items[index].mGlobalPos; + mPlaceProfile->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY); + mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + } - mPlaceProfile->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY); - mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + updateVerbs(); } - - updateVerbs(); } LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); @@ -942,7 +964,8 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) } } else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE || - mPlaceInfoType == LANDMARK_INFO_TYPE) + mPlaceInfoType == LANDMARK_INFO_TYPE || + mPlaceInfoType == LANDMARK_TAB_INFO_TYPE) { mLandmarkInfo->setVisible(visible); @@ -960,13 +983,15 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) { LLLandmarksPanel* landmarks_panel = dynamic_cast(mTabContainer->getPanelByName("Landmarks")); - if (landmarks_panel && mItem.notNull()) + if (landmarks_panel) { // If a landmark info is being closed we open the landmarks tab // and set this landmark selected. mTabContainer->selectTabPanel(landmarks_panel); - - landmarks_panel->setItemSelected(mItem->getUUID(), TRUE); + if (mItem.notNull()) + { + landmarks_panel->setItemSelected(mItem->getUUID(), TRUE); + } } } } @@ -1163,7 +1188,8 @@ LLPanelPlaceInfo* LLPanelPlaces::getCurrentInfoPanel() return mPlaceProfile; } else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE || - mPlaceInfoType == LANDMARK_INFO_TYPE) + mPlaceInfoType == LANDMARK_INFO_TYPE || + mPlaceInfoType == LANDMARK_TAB_INFO_TYPE) { return mLandmarkInfo; } diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml index 5d7334f780..670aa47313 100644 --- a/indra/newview/skins/default/xui/en/panel_places.xml +++ b/indra/newview/skins/default/xui/en/panel_places.xml @@ -202,7 +202,7 @@ background_visible="true" Date: Wed, 2 Nov 2011 22:47:56 +0200 Subject: EXP-1488 FIXED Minimum viewer window size limited to 1024x768 on Linux. --- indra/llwindow/llwindowsdl.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index e41aa9820f..da2222ad51 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -63,6 +63,9 @@ extern BOOL gDebugWindowProc; const S32 MAX_NUM_RESOLUTIONS = 200; +const S32 MIN_WINDOW_WIDTH = 1024; +const S32 MIN_WINDOW_HEIGHT = 768; + // static variable for ATI mouse cursor crash work-around: static bool ATIbug = false; @@ -1843,11 +1846,15 @@ void LLWindowSDL::gatherInput() break; case SDL_VIDEORESIZE: // *FIX: handle this? + { llinfos << "Handling a resize event: " << event.resize.w << "x" << event.resize.h << llendl; + S32 width = llmax(event.resize.w, MIN_WINDOW_WIDTH); + S32 height = llmax(event.resize.h, MIN_WINDOW_HEIGHT); + // *FIX: I'm not sure this is necessary! - mWindow = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, mSDLFlags); + mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags); if (!mWindow) { // *FIX: More informative dialog? @@ -1861,9 +1868,9 @@ void LLWindowSDL::gatherInput() break; } - mCallbacks->handleResize(this, event.resize.w, event.resize.h ); + mCallbacks->handleResize(this, width, height); break; - + } case SDL_ACTIVEEVENT: if (event.active.state & SDL_APPINPUTFOCUS) { -- cgit v1.2.3 From 33b17af15c6fbf0762e99342042a20d0f89f732f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 2 Nov 2011 23:37:55 +0200 Subject: STORM-1580 WIP Another build fix. --- indra/newview/llfloatersnapshot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 9171f222e5..08ca1e8cea 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1283,7 +1283,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) { LLSnapshotLivePreview* previewp = getPreviewView(floaterp); - bool advanced = gSavedSettings.getBOOL("AdvanceSnapshot"); + BOOL advanced = gSavedSettings.getBOOL("AdvanceSnapshot"); // Show/hide advanced options. LLPanel* advanced_options_panel = floaterp->getChild("advanced_options_panel"); -- cgit v1.2.3 From 91354304fc8a5dd400aefa8047c2e1fe62d143bd Mon Sep 17 00:00:00 2001 From: callum Date: Wed, 2 Nov 2011 15:05:55 -0700 Subject: Turn off debug loading overlay for older versions of LLQtWebKit thar do not support it (Linux) --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index c7c66e5895..13d51099a8 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -383,8 +383,11 @@ private: //lldebugs << "data url is: " << url.str() << llendl; // loading overlay debug screen follows media debugging flag from client for now. +#if LLQTWEBKIT_API_VERSION >= 16 LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, mEnableMediaPluginDebugging); - +#else + llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl; +#endif str.clear(); str << "Loading overlay enabled = " << mEnableMediaPluginDebugging << " for mBrowserWindowId = " << mBrowserWindowId; postDebugMessage( str.str() ); -- cgit v1.2.3 From c7a146e23f0d1c4b0eb782519dccd6c23470cbfa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 15:17:16 -0700 Subject: removed unused textures --- indra/newview/skins/default/textures/arrow_keys.png | Bin 6558 -> 0 bytes .../skins/default/textures/bottomtray/Cam_Pan_Over.png | Bin 275 -> 0 bytes .../default/textures/bottomtray/CameraView_Press.png | Bin 489 -> 0 bytes .../default/textures/bottomtray/PanOrbit_Disabled.png | Bin 50975 -> 0 bytes .../skins/default/textures/bottomtray/PanOrbit_Over.png | Bin 54713 -> 0 bytes .../default/textures/bottomtray/PanOrbit_Press.png | Bin 51053 -> 0 bytes .../default/textures/checkerboard_transparency_bg.png | Bin 1110 -> 0 bytes indra/newview/skins/default/textures/circle.tga | Bin 1068 -> 0 bytes .../textures/containers/Accordion_ArrowClosed_Over.png | Bin 170 -> 0 bytes .../textures/containers/Accordion_ArrowOpened_Over.png | Bin 162 -> 0 bytes .../default/textures/containers/TabTop_Left_Over.png | Bin 337 -> 0 bytes .../default/textures/containers/TabTop_Middle_Over.png | Bin 285 -> 0 bytes .../default/textures/containers/TabTop_Right_Over.png | Bin 362 -> 0 bytes indra/newview/skins/default/textures/icn_label_web.tga | Bin 4140 -> 0 bytes indra/newview/skins/default/textures/icn_media.tga | Bin 4140 -> 0 bytes .../skins/default/textures/icn_voice-groupfocus.tga | Bin 1068 -> 0 bytes .../skins/default/textures/icn_voice-localchat.tga | Bin 1068 -> 0 bytes .../skins/default/textures/icn_voice-pvtfocus.tga | Bin 1068 -> 0 bytes indra/newview/skins/default/textures/icon_day_cycle.tga | Bin 25682 -> 0 bytes .../newview/skins/default/textures/icon_event_adult.tga | Bin 1006 -> 0 bytes indra/newview/skins/default/textures/icon_lock.tga | Bin 1030 -> 0 bytes .../skins/default/textures/icons/AddItem_Over.png | Bin 165 -> 0 bytes .../skins/default/textures/icons/BackArrow_Over.png | Bin 214 -> 0 bytes .../newview/skins/default/textures/icons/DragHandle.png | Bin 163 -> 0 bytes .../skins/default/textures/icons/Generic_Object.png | Bin 366 -> 0 bytes indra/newview/skins/default/textures/icons/Inv_Gift.png | Bin 1335 -> 0 bytes .../skins/default/textures/icons/OptionsMenu_Over.png | Bin 277 -> 0 bytes .../default/textures/icons/OutboxPush_On_Selected.png | Bin 1912 -> 0 bytes .../default/textures/icons/Parcel_Damage_Light_Alt.png | Bin 285 -> 0 bytes .../default/textures/icons/Parcel_NoScripts_Light.png | Bin 620 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_1.png | Bin 1149 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_2.png | Bin 1147 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_3.png | Bin 1211 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_4.png | Bin 1205 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_5.png | Bin 1137 -> 0 bytes .../skins/default/textures/icons/Sync_Progress_6.png | Bin 1164 -> 0 bytes .../skins/default/textures/icons/TrashItem_Over.png | Bin 201 -> 0 bytes .../skins/default/textures/icons/parcel_color_EVRY.png | Bin 393 -> 0 bytes .../skins/default/textures/icons/parcel_color_EXP.png | Bin 272 -> 0 bytes .../skins/default/textures/icons/parcel_color_M.png | Bin 306 -> 0 bytes .../newview/skins/default/textures/image_edit_icon.tga | Bin 3116 -> 0 bytes .../skins/default/textures/inv_folder_animation.tga | Bin 1068 -> 0 bytes .../newview/skins/default/textures/inv_folder_inbox.tga | Bin 2085 -> 0 bytes .../skins/default/textures/map_avatar_above_8.tga | Bin 300 -> 0 bytes .../skins/default/textures/map_avatar_below_8.tga | Bin 300 -> 0 bytes .../newview/skins/default/textures/map_event_adult.tga | Bin 1006 -> 0 bytes .../newview/skins/default/textures/map_event_mature.tga | Bin 1068 -> 0 bytes indra/newview/skins/default/textures/map_track_8.tga | Bin 300 -> 0 bytes indra/newview/skins/default/textures/menu_separator.png | Bin 2831 -> 0 bytes .../default/textures/model_wizard/divider_line.png | Bin 2815 -> 0 bytes indra/newview/skins/default/textures/mute_icon.tga | Bin 1042 -> 0 bytes .../skins/default/textures/navbar/Arrow_Left_Over.png | Bin 381 -> 0 bytes .../skins/default/textures/navbar/Arrow_Right_Over.png | Bin 379 -> 0 bytes .../newview/skins/default/textures/navbar/Help_Over.png | Bin 348 -> 0 bytes .../newview/skins/default/textures/navbar/Home_Over.png | Bin 330 -> 0 bytes .../skins/default/textures/places_rating_adult.tga | Bin 648 -> 0 bytes .../skins/default/textures/places_rating_mature.tga | Bin 1068 -> 0 bytes .../newview/skins/default/textures/places_rating_pg.tga | Bin 1068 -> 0 bytes indra/newview/skins/default/textures/propertyline.tga | Bin 2092 -> 0 bytes .../default/textures/quick_tips/avatar_free_mode.png | Bin 1447 -> 0 bytes .../default/textures/quick_tips/camera_free_mode.png | Bin 2267 -> 0 bytes .../default/textures/quick_tips/camera_orbit_mode.png | Bin 2381 -> 0 bytes .../default/textures/quick_tips/camera_pan_mode.png | Bin 2418 -> 0 bytes .../textures/quick_tips/camera_preset_front_view.png | Bin 2365 -> 0 bytes .../textures/quick_tips/camera_preset_group_view.png | Bin 2595 -> 0 bytes .../textures/quick_tips/camera_preset_rear_view.png | Bin 2221 -> 0 bytes .../default/textures/quick_tips/move_fly_first.png | Bin 1528 -> 0 bytes .../default/textures/quick_tips/move_fly_second.png | Bin 2128 -> 0 bytes .../default/textures/quick_tips/move_run_first.png | Bin 1554 -> 0 bytes .../default/textures/quick_tips/move_run_second.png | Bin 2534 -> 0 bytes .../default/textures/quick_tips/move_walk_first.png | Bin 2106 -> 0 bytes .../default/textures/quick_tips/move_walk_second.png | Bin 3108 -> 0 bytes indra/newview/skins/default/textures/show_btn.tga | Bin 3884 -> 0 bytes .../skins/default/textures/show_btn_selected.tga | Bin 3884 -> 0 bytes indra/newview/skins/default/textures/smicon_warn.tga | Bin 1068 -> 0 bytes indra/newview/skins/default/textures/spacer35.tga | Bin 3404 -> 0 bytes .../skins/default/textures/square_btn_32x128.tga | Bin 6292 -> 0 bytes .../default/textures/square_btn_selected_32x128.tga | Bin 6983 -> 0 bytes indra/newview/skins/default/textures/startup_logo.j2c | Bin 69118 -> 0 bytes indra/newview/skins/default/textures/status_busy.tga | Bin 4140 -> 0 bytes .../textures/taskpanel/TabIcon_Appearance_Off.png | Bin 273 -> 0 bytes .../textures/taskpanel/TabIcon_Appearance_Selected.png | Bin 349 -> 0 bytes .../default/textures/taskpanel/TabIcon_Home_Off.png | Bin 749 -> 0 bytes .../default/textures/taskpanel/TabIcon_Me_Selected.png | Bin 359 -> 0 bytes .../textures/taskpanel/TabIcon_People_Selected.png | Bin 536 -> 0 bytes .../default/textures/taskpanel/TabIcon_Places_Large.png | Bin 709 -> 0 bytes .../textures/taskpanel/TabIcon_Places_Selected.png | Bin 653 -> 0 bytes .../textures/taskpanel/TabIcon_Things_Selected.png | Bin 297 -> 0 bytes .../skins/default/textures/toolbar_icons/mini_map.png | Bin 1766 -> 0 bytes .../skins/default/textures/widgets/Checkbox_On_Over.png | Bin 547 -> 0 bytes .../skins/default/textures/widgets/Checkbox_Over.png | Bin 318 -> 0 bytes .../textures/widgets/ComboButton_Up_On_Selected.png | Bin 482 -> 0 bytes .../textures/widgets/DisclosureArrow_Closed_Over.png | Bin 164 -> 0 bytes .../textures/widgets/DisclosureArrow_Opened_Over.png | Bin 165 -> 0 bytes .../default/textures/widgets/PushButton_On_Over.png | Bin 498 -> 0 bytes .../textures/widgets/PushButton_Selected_Over.png | Bin 498 -> 0 bytes .../default/textures/widgets/RadioButton_On_Over.png | Bin 635 -> 0 bytes .../skins/default/textures/widgets/RadioButton_Over.png | Bin 575 -> 0 bytes .../skins/default/textures/widgets/ScrollArrow_Down.png | Bin 239 -> 0 bytes .../default/textures/widgets/ScrollArrow_Down_Over.png | Bin 257 -> 0 bytes .../default/textures/widgets/ScrollArrow_Left_Over.png | Bin 295 -> 0 bytes .../default/textures/widgets/ScrollArrow_Right_Over.png | Bin 283 -> 0 bytes .../skins/default/textures/widgets/ScrollArrow_Up.png | Bin 262 -> 0 bytes .../default/textures/widgets/ScrollArrow_Up_Over.png | Bin 276 -> 0 bytes .../default/textures/widgets/ScrollThumb_Horiz_Over.png | Bin 311 -> 0 bytes .../default/textures/widgets/ScrollThumb_Vert_Over.png | Bin 311 -> 0 bytes .../default/textures/widgets/SegmentedBtn_Left_On.png | Bin 404 -> 0 bytes .../textures/widgets/SegmentedBtn_Left_On_Disabled.png | Bin 404 -> 0 bytes .../textures/widgets/SegmentedBtn_Left_On_Over.png | Bin 394 -> 0 bytes .../textures/widgets/SegmentedBtn_Left_On_Selected.png | Bin 495 -> 0 bytes .../default/textures/widgets/SegmentedBtn_Middle_On.png | Bin 308 -> 0 bytes .../textures/widgets/SegmentedBtn_Middle_On_Over.png | Bin 300 -> 0 bytes .../textures/widgets/SegmentedBtn_Middle_On_Press.png | Bin 393 -> 0 bytes .../textures/widgets/SegmentedBtn_Middle_Over.png | Bin 286 -> 0 bytes .../widgets/SegmentedBtn_Middle_Selected_Over.png | Bin 300 -> 0 bytes .../default/textures/widgets/SegmentedBtn_Right_On.png | Bin 420 -> 0 bytes .../textures/widgets/SegmentedBtn_Right_On_Over.png | Bin 416 -> 0 bytes .../textures/widgets/SegmentedBtn_Right_On_Selected.png | Bin 502 -> 0 bytes .../widgets/SegmentedBtn_Right_Selected_Over.png | Bin 416 -> 0 bytes .../skins/default/textures/widgets/SliderThumb_Over.png | Bin 482 -> 0 bytes .../default/textures/widgets/Stepper_Down_Over.png | Bin 310 -> 0 bytes .../skins/default/textures/widgets/Stepper_Up_Over.png | Bin 314 -> 0 bytes indra/newview/skins/default/textures/windows/Flyout.png | Bin 820 -> 0 bytes .../default/textures/windows/Flyout_Pointer_Up.png | Bin 260 -> 0 bytes .../skins/default/textures/windows/Icon_Gear_Over.png | Bin 293 -> 0 bytes .../skins/default/textures/windows/Icon_Help_Press.png | Bin 3062 -> 0 bytes .../default/textures/windows/Icon_Undock_Foreground.png | Bin 268 -> 0 bytes .../default/textures/windows/Icon_Undock_Press.png | Bin 267 -> 0 bytes .../skins/default/textures/windows/hint_arrow_down.png | Bin 3170 -> 0 bytes .../skins/default/textures/windows/hint_arrow_up.png | Bin 3219 -> 0 bytes 130 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 indra/newview/skins/default/textures/arrow_keys.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/Cam_Pan_Over.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/CameraView_Press.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/PanOrbit_Disabled.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/PanOrbit_Over.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/PanOrbit_Press.png delete mode 100644 indra/newview/skins/default/textures/checkerboard_transparency_bg.png delete mode 100644 indra/newview/skins/default/textures/circle.tga delete mode 100644 indra/newview/skins/default/textures/containers/Accordion_ArrowClosed_Over.png delete mode 100644 indra/newview/skins/default/textures/containers/Accordion_ArrowOpened_Over.png delete mode 100644 indra/newview/skins/default/textures/containers/TabTop_Left_Over.png delete mode 100644 indra/newview/skins/default/textures/containers/TabTop_Middle_Over.png delete mode 100644 indra/newview/skins/default/textures/containers/TabTop_Right_Over.png delete mode 100644 indra/newview/skins/default/textures/icn_label_web.tga delete mode 100644 indra/newview/skins/default/textures/icn_media.tga delete mode 100644 indra/newview/skins/default/textures/icn_voice-groupfocus.tga delete mode 100644 indra/newview/skins/default/textures/icn_voice-localchat.tga delete mode 100644 indra/newview/skins/default/textures/icn_voice-pvtfocus.tga delete mode 100644 indra/newview/skins/default/textures/icon_day_cycle.tga delete mode 100644 indra/newview/skins/default/textures/icon_event_adult.tga delete mode 100644 indra/newview/skins/default/textures/icon_lock.tga delete mode 100644 indra/newview/skins/default/textures/icons/AddItem_Over.png delete mode 100644 indra/newview/skins/default/textures/icons/BackArrow_Over.png delete mode 100644 indra/newview/skins/default/textures/icons/DragHandle.png delete mode 100644 indra/newview/skins/default/textures/icons/Generic_Object.png delete mode 100644 indra/newview/skins/default/textures/icons/Inv_Gift.png delete mode 100644 indra/newview/skins/default/textures/icons/OptionsMenu_Over.png delete mode 100644 indra/newview/skins/default/textures/icons/OutboxPush_On_Selected.png delete mode 100644 indra/newview/skins/default/textures/icons/Parcel_Damage_Light_Alt.png delete mode 100644 indra/newview/skins/default/textures/icons/Parcel_NoScripts_Light.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_1.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_2.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_3.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_4.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_5.png delete mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_6.png delete mode 100644 indra/newview/skins/default/textures/icons/TrashItem_Over.png delete mode 100644 indra/newview/skins/default/textures/icons/parcel_color_EVRY.png delete mode 100644 indra/newview/skins/default/textures/icons/parcel_color_EXP.png delete mode 100644 indra/newview/skins/default/textures/icons/parcel_color_M.png delete mode 100644 indra/newview/skins/default/textures/image_edit_icon.tga delete mode 100644 indra/newview/skins/default/textures/inv_folder_animation.tga delete mode 100644 indra/newview/skins/default/textures/inv_folder_inbox.tga delete mode 100644 indra/newview/skins/default/textures/map_avatar_above_8.tga delete mode 100644 indra/newview/skins/default/textures/map_avatar_below_8.tga delete mode 100644 indra/newview/skins/default/textures/map_event_adult.tga delete mode 100644 indra/newview/skins/default/textures/map_event_mature.tga delete mode 100644 indra/newview/skins/default/textures/map_track_8.tga delete mode 100644 indra/newview/skins/default/textures/menu_separator.png delete mode 100644 indra/newview/skins/default/textures/model_wizard/divider_line.png delete mode 100644 indra/newview/skins/default/textures/mute_icon.tga delete mode 100644 indra/newview/skins/default/textures/navbar/Arrow_Left_Over.png delete mode 100644 indra/newview/skins/default/textures/navbar/Arrow_Right_Over.png delete mode 100644 indra/newview/skins/default/textures/navbar/Help_Over.png delete mode 100644 indra/newview/skins/default/textures/navbar/Home_Over.png delete mode 100644 indra/newview/skins/default/textures/places_rating_adult.tga delete mode 100644 indra/newview/skins/default/textures/places_rating_mature.tga delete mode 100644 indra/newview/skins/default/textures/places_rating_pg.tga delete mode 100644 indra/newview/skins/default/textures/propertyline.tga delete mode 100644 indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_free_mode.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_fly_first.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_fly_second.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_run_first.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_run_second.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_walk_first.png delete mode 100644 indra/newview/skins/default/textures/quick_tips/move_walk_second.png delete mode 100644 indra/newview/skins/default/textures/show_btn.tga delete mode 100644 indra/newview/skins/default/textures/show_btn_selected.tga delete mode 100644 indra/newview/skins/default/textures/smicon_warn.tga delete mode 100644 indra/newview/skins/default/textures/spacer35.tga delete mode 100644 indra/newview/skins/default/textures/square_btn_32x128.tga delete mode 100644 indra/newview/skins/default/textures/square_btn_selected_32x128.tga delete mode 100644 indra/newview/skins/default/textures/startup_logo.j2c delete mode 100644 indra/newview/skins/default/textures/status_busy.tga delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Off.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Selected.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Home_Off.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Me_Selected.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_People_Selected.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Large.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Selected.png delete mode 100644 indra/newview/skins/default/textures/taskpanel/TabIcon_Things_Selected.png delete mode 100644 indra/newview/skins/default/textures/toolbar_icons/mini_map.png delete mode 100644 indra/newview/skins/default/textures/widgets/Checkbox_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/Checkbox_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png delete mode 100644 indra/newview/skins/default/textures/widgets/DisclosureArrow_Closed_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/PushButton_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/PushButton_Selected_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/RadioButton_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/RadioButton_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/ScrollThumb_Vert_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Disabled.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Selected.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Press.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png delete mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/SliderThumb_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/Stepper_Down_Over.png delete mode 100644 indra/newview/skins/default/textures/widgets/Stepper_Up_Over.png delete mode 100644 indra/newview/skins/default/textures/windows/Flyout.png delete mode 100644 indra/newview/skins/default/textures/windows/Flyout_Pointer_Up.png delete mode 100644 indra/newview/skins/default/textures/windows/Icon_Gear_Over.png delete mode 100644 indra/newview/skins/default/textures/windows/Icon_Help_Press.png delete mode 100644 indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png delete mode 100644 indra/newview/skins/default/textures/windows/Icon_Undock_Press.png delete mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_down.png delete mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_up.png diff --git a/indra/newview/skins/default/textures/arrow_keys.png b/indra/newview/skins/default/textures/arrow_keys.png deleted file mode 100644 index f19af59251..0000000000 Binary files a/indra/newview/skins/default/textures/arrow_keys.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/Cam_Pan_Over.png b/indra/newview/skins/default/textures/bottomtray/Cam_Pan_Over.png deleted file mode 100644 index b5781718ec..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/Cam_Pan_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/CameraView_Press.png b/indra/newview/skins/default/textures/bottomtray/CameraView_Press.png deleted file mode 100644 index 5a9346fd39..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/CameraView_Press.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Disabled.png b/indra/newview/skins/default/textures/bottomtray/PanOrbit_Disabled.png deleted file mode 100644 index 20fa40e127..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Disabled.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Over.png b/indra/newview/skins/default/textures/bottomtray/PanOrbit_Over.png deleted file mode 100644 index f1420e0002..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Press.png b/indra/newview/skins/default/textures/bottomtray/PanOrbit_Press.png deleted file mode 100644 index 89a6269edc..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/PanOrbit_Press.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/checkerboard_transparency_bg.png b/indra/newview/skins/default/textures/checkerboard_transparency_bg.png deleted file mode 100644 index 9a16935204..0000000000 Binary files a/indra/newview/skins/default/textures/checkerboard_transparency_bg.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/circle.tga b/indra/newview/skins/default/textures/circle.tga deleted file mode 100644 index d7097e3a35..0000000000 Binary files a/indra/newview/skins/default/textures/circle.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/containers/Accordion_ArrowClosed_Over.png b/indra/newview/skins/default/textures/containers/Accordion_ArrowClosed_Over.png deleted file mode 100644 index e47f913db1..0000000000 Binary files a/indra/newview/skins/default/textures/containers/Accordion_ArrowClosed_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/containers/Accordion_ArrowOpened_Over.png b/indra/newview/skins/default/textures/containers/Accordion_ArrowOpened_Over.png deleted file mode 100644 index e2c67de9c0..0000000000 Binary files a/indra/newview/skins/default/textures/containers/Accordion_ArrowOpened_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/containers/TabTop_Left_Over.png b/indra/newview/skins/default/textures/containers/TabTop_Left_Over.png deleted file mode 100644 index 295cd89a57..0000000000 Binary files a/indra/newview/skins/default/textures/containers/TabTop_Left_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/containers/TabTop_Middle_Over.png b/indra/newview/skins/default/textures/containers/TabTop_Middle_Over.png deleted file mode 100644 index 0758cbcf0d..0000000000 Binary files a/indra/newview/skins/default/textures/containers/TabTop_Middle_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/containers/TabTop_Right_Over.png b/indra/newview/skins/default/textures/containers/TabTop_Right_Over.png deleted file mode 100644 index c2cbc2b1e5..0000000000 Binary files a/indra/newview/skins/default/textures/containers/TabTop_Right_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icn_label_web.tga b/indra/newview/skins/default/textures/icn_label_web.tga deleted file mode 100644 index 7c9131dfff..0000000000 Binary files a/indra/newview/skins/default/textures/icn_label_web.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icn_media.tga b/indra/newview/skins/default/textures/icn_media.tga deleted file mode 100644 index 43dd342c9d..0000000000 Binary files a/indra/newview/skins/default/textures/icn_media.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icn_voice-groupfocus.tga b/indra/newview/skins/default/textures/icn_voice-groupfocus.tga deleted file mode 100644 index 9f48d4609d..0000000000 Binary files a/indra/newview/skins/default/textures/icn_voice-groupfocus.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icn_voice-localchat.tga b/indra/newview/skins/default/textures/icn_voice-localchat.tga deleted file mode 100644 index 7cf267eaf5..0000000000 Binary files a/indra/newview/skins/default/textures/icn_voice-localchat.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icn_voice-pvtfocus.tga b/indra/newview/skins/default/textures/icn_voice-pvtfocus.tga deleted file mode 100644 index abadb09aaf..0000000000 Binary files a/indra/newview/skins/default/textures/icn_voice-pvtfocus.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icon_day_cycle.tga b/indra/newview/skins/default/textures/icon_day_cycle.tga deleted file mode 100644 index 2d5dee1e94..0000000000 Binary files a/indra/newview/skins/default/textures/icon_day_cycle.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icon_event_adult.tga b/indra/newview/skins/default/textures/icon_event_adult.tga deleted file mode 100644 index f548126e5a..0000000000 Binary files a/indra/newview/skins/default/textures/icon_event_adult.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icon_lock.tga b/indra/newview/skins/default/textures/icon_lock.tga deleted file mode 100644 index 23521aa113..0000000000 Binary files a/indra/newview/skins/default/textures/icon_lock.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/AddItem_Over.png b/indra/newview/skins/default/textures/icons/AddItem_Over.png deleted file mode 100644 index cad6e8d52f..0000000000 Binary files a/indra/newview/skins/default/textures/icons/AddItem_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/BackArrow_Over.png b/indra/newview/skins/default/textures/icons/BackArrow_Over.png deleted file mode 100644 index b36e03a8cf..0000000000 Binary files a/indra/newview/skins/default/textures/icons/BackArrow_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/DragHandle.png b/indra/newview/skins/default/textures/icons/DragHandle.png deleted file mode 100644 index c3cbc07a33..0000000000 Binary files a/indra/newview/skins/default/textures/icons/DragHandle.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Generic_Object.png b/indra/newview/skins/default/textures/icons/Generic_Object.png deleted file mode 100644 index e3a80b2aef..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Generic_Object.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Inv_Gift.png b/indra/newview/skins/default/textures/icons/Inv_Gift.png deleted file mode 100644 index 5afe85d72d..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Inv_Gift.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/OptionsMenu_Over.png b/indra/newview/skins/default/textures/icons/OptionsMenu_Over.png deleted file mode 100644 index fcabd4c6d3..0000000000 Binary files a/indra/newview/skins/default/textures/icons/OptionsMenu_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/OutboxPush_On_Selected.png b/indra/newview/skins/default/textures/icons/OutboxPush_On_Selected.png deleted file mode 100644 index 0e60b417b0..0000000000 Binary files a/indra/newview/skins/default/textures/icons/OutboxPush_On_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Parcel_Damage_Light_Alt.png b/indra/newview/skins/default/textures/icons/Parcel_Damage_Light_Alt.png deleted file mode 100644 index d72f02f708..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Parcel_Damage_Light_Alt.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Parcel_NoScripts_Light.png b/indra/newview/skins/default/textures/icons/Parcel_NoScripts_Light.png deleted file mode 100644 index f82354959e..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Parcel_NoScripts_Light.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_1.png b/indra/newview/skins/default/textures/icons/Sync_Progress_1.png deleted file mode 100644 index 624e556376..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_1.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_2.png b/indra/newview/skins/default/textures/icons/Sync_Progress_2.png deleted file mode 100644 index 5769803b3f..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_2.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_3.png b/indra/newview/skins/default/textures/icons/Sync_Progress_3.png deleted file mode 100644 index 92d4bfb020..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_3.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_4.png b/indra/newview/skins/default/textures/icons/Sync_Progress_4.png deleted file mode 100644 index 6d43eb3a9f..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_4.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_5.png b/indra/newview/skins/default/textures/icons/Sync_Progress_5.png deleted file mode 100644 index 766d063c99..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_5.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_6.png b/indra/newview/skins/default/textures/icons/Sync_Progress_6.png deleted file mode 100644 index dfe7f68b72..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Sync_Progress_6.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/TrashItem_Over.png b/indra/newview/skins/default/textures/icons/TrashItem_Over.png deleted file mode 100644 index 1a0eea6c67..0000000000 Binary files a/indra/newview/skins/default/textures/icons/TrashItem_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png b/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png deleted file mode 100644 index b5508423eb..0000000000 Binary files a/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/parcel_color_EXP.png b/indra/newview/skins/default/textures/icons/parcel_color_EXP.png deleted file mode 100644 index 4813d37198..0000000000 Binary files a/indra/newview/skins/default/textures/icons/parcel_color_EXP.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/icons/parcel_color_M.png b/indra/newview/skins/default/textures/icons/parcel_color_M.png deleted file mode 100644 index 41984c43e4..0000000000 Binary files a/indra/newview/skins/default/textures/icons/parcel_color_M.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/image_edit_icon.tga b/indra/newview/skins/default/textures/image_edit_icon.tga deleted file mode 100644 index 8666f0bbe6..0000000000 Binary files a/indra/newview/skins/default/textures/image_edit_icon.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/inv_folder_animation.tga b/indra/newview/skins/default/textures/inv_folder_animation.tga deleted file mode 100644 index 1b4df7a2d8..0000000000 Binary files a/indra/newview/skins/default/textures/inv_folder_animation.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/inv_folder_inbox.tga b/indra/newview/skins/default/textures/inv_folder_inbox.tga deleted file mode 100644 index 04539c2cc4..0000000000 Binary files a/indra/newview/skins/default/textures/inv_folder_inbox.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_avatar_above_8.tga b/indra/newview/skins/default/textures/map_avatar_above_8.tga deleted file mode 100644 index 193428e530..0000000000 Binary files a/indra/newview/skins/default/textures/map_avatar_above_8.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_avatar_below_8.tga b/indra/newview/skins/default/textures/map_avatar_below_8.tga deleted file mode 100644 index 9e14bfab90..0000000000 Binary files a/indra/newview/skins/default/textures/map_avatar_below_8.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_event_adult.tga b/indra/newview/skins/default/textures/map_event_adult.tga deleted file mode 100644 index f548126e5a..0000000000 Binary files a/indra/newview/skins/default/textures/map_event_adult.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_event_mature.tga b/indra/newview/skins/default/textures/map_event_mature.tga deleted file mode 100644 index 71067c0dfd..0000000000 Binary files a/indra/newview/skins/default/textures/map_event_mature.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_track_8.tga b/indra/newview/skins/default/textures/map_track_8.tga deleted file mode 100644 index 53425ff45b..0000000000 Binary files a/indra/newview/skins/default/textures/map_track_8.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/menu_separator.png b/indra/newview/skins/default/textures/menu_separator.png deleted file mode 100644 index 89dcdcdff5..0000000000 Binary files a/indra/newview/skins/default/textures/menu_separator.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/model_wizard/divider_line.png b/indra/newview/skins/default/textures/model_wizard/divider_line.png deleted file mode 100644 index 76c9e68767..0000000000 Binary files a/indra/newview/skins/default/textures/model_wizard/divider_line.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/mute_icon.tga b/indra/newview/skins/default/textures/mute_icon.tga deleted file mode 100644 index 879b9e6188..0000000000 Binary files a/indra/newview/skins/default/textures/mute_icon.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/navbar/Arrow_Left_Over.png b/indra/newview/skins/default/textures/navbar/Arrow_Left_Over.png deleted file mode 100644 index a91b74819f..0000000000 Binary files a/indra/newview/skins/default/textures/navbar/Arrow_Left_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/navbar/Arrow_Right_Over.png b/indra/newview/skins/default/textures/navbar/Arrow_Right_Over.png deleted file mode 100644 index a2caf227a7..0000000000 Binary files a/indra/newview/skins/default/textures/navbar/Arrow_Right_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/navbar/Help_Over.png b/indra/newview/skins/default/textures/navbar/Help_Over.png deleted file mode 100644 index b9bc0d0f87..0000000000 Binary files a/indra/newview/skins/default/textures/navbar/Help_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/navbar/Home_Over.png b/indra/newview/skins/default/textures/navbar/Home_Over.png deleted file mode 100644 index d9c6b3842e..0000000000 Binary files a/indra/newview/skins/default/textures/navbar/Home_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/places_rating_adult.tga b/indra/newview/skins/default/textures/places_rating_adult.tga deleted file mode 100644 index c344fb1e78..0000000000 Binary files a/indra/newview/skins/default/textures/places_rating_adult.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/places_rating_mature.tga b/indra/newview/skins/default/textures/places_rating_mature.tga deleted file mode 100644 index 61c879bc92..0000000000 Binary files a/indra/newview/skins/default/textures/places_rating_mature.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/places_rating_pg.tga b/indra/newview/skins/default/textures/places_rating_pg.tga deleted file mode 100644 index 7805dbce60..0000000000 Binary files a/indra/newview/skins/default/textures/places_rating_pg.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/propertyline.tga b/indra/newview/skins/default/textures/propertyline.tga deleted file mode 100644 index 0c504eea71..0000000000 Binary files a/indra/newview/skins/default/textures/propertyline.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png b/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png deleted file mode 100644 index be7c87efb6..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png deleted file mode 100644 index 9a3f3703b2..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png deleted file mode 100644 index dd72cc0162..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png deleted file mode 100644 index b537dcbe46..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png deleted file mode 100644 index 7674a75ac3..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png deleted file mode 100644 index 9c9b923a5a..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png deleted file mode 100644 index 15c3053491..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_fly_first.png b/indra/newview/skins/default/textures/quick_tips/move_fly_first.png deleted file mode 100644 index b6e2ce60e4..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_fly_first.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_fly_second.png b/indra/newview/skins/default/textures/quick_tips/move_fly_second.png deleted file mode 100644 index 84b63cc338..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_fly_second.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_run_first.png b/indra/newview/skins/default/textures/quick_tips/move_run_first.png deleted file mode 100644 index 16093dc683..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_run_first.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_run_second.png b/indra/newview/skins/default/textures/quick_tips/move_run_second.png deleted file mode 100644 index 19fa43ec32..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_run_second.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_walk_first.png b/indra/newview/skins/default/textures/quick_tips/move_walk_first.png deleted file mode 100644 index 92d120d53e..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_walk_first.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/quick_tips/move_walk_second.png b/indra/newview/skins/default/textures/quick_tips/move_walk_second.png deleted file mode 100644 index f8e28722be..0000000000 Binary files a/indra/newview/skins/default/textures/quick_tips/move_walk_second.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/show_btn.tga b/indra/newview/skins/default/textures/show_btn.tga deleted file mode 100644 index 5f05f377e3..0000000000 Binary files a/indra/newview/skins/default/textures/show_btn.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/show_btn_selected.tga b/indra/newview/skins/default/textures/show_btn_selected.tga deleted file mode 100644 index 00a2f34a37..0000000000 Binary files a/indra/newview/skins/default/textures/show_btn_selected.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/smicon_warn.tga b/indra/newview/skins/default/textures/smicon_warn.tga deleted file mode 100644 index 90ccaa07e5..0000000000 Binary files a/indra/newview/skins/default/textures/smicon_warn.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/spacer35.tga b/indra/newview/skins/default/textures/spacer35.tga deleted file mode 100644 index b88bc6680a..0000000000 Binary files a/indra/newview/skins/default/textures/spacer35.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/square_btn_32x128.tga b/indra/newview/skins/default/textures/square_btn_32x128.tga deleted file mode 100644 index d7ce58dac3..0000000000 Binary files a/indra/newview/skins/default/textures/square_btn_32x128.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/square_btn_selected_32x128.tga b/indra/newview/skins/default/textures/square_btn_selected_32x128.tga deleted file mode 100644 index 59ca365aa4..0000000000 Binary files a/indra/newview/skins/default/textures/square_btn_selected_32x128.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/startup_logo.j2c b/indra/newview/skins/default/textures/startup_logo.j2c deleted file mode 100644 index d1b991f17f..0000000000 Binary files a/indra/newview/skins/default/textures/startup_logo.j2c and /dev/null differ diff --git a/indra/newview/skins/default/textures/status_busy.tga b/indra/newview/skins/default/textures/status_busy.tga deleted file mode 100644 index 7743d9c7bb..0000000000 Binary files a/indra/newview/skins/default/textures/status_busy.tga and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Off.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Off.png deleted file mode 100644 index 0b91abfb0d..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Off.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Selected.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Selected.png deleted file mode 100644 index 33a47236a5..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Appearance_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Home_Off.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Home_Off.png deleted file mode 100644 index 421f5e1705..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Home_Off.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Me_Selected.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Me_Selected.png deleted file mode 100644 index 905d4c973e..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Me_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_People_Selected.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_People_Selected.png deleted file mode 100644 index 909f0d0a47..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_People_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Large.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Large.png deleted file mode 100644 index cc505c4a30..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Large.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Selected.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Selected.png deleted file mode 100644 index 8e0fb9661e..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Places_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/taskpanel/TabIcon_Things_Selected.png b/indra/newview/skins/default/textures/taskpanel/TabIcon_Things_Selected.png deleted file mode 100644 index d4ac451c8e..0000000000 Binary files a/indra/newview/skins/default/textures/taskpanel/TabIcon_Things_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/mini_map.png b/indra/newview/skins/default/textures/toolbar_icons/mini_map.png deleted file mode 100644 index ab0a654056..0000000000 Binary files a/indra/newview/skins/default/textures/toolbar_icons/mini_map.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_On_Over.png b/indra/newview/skins/default/textures/widgets/Checkbox_On_Over.png deleted file mode 100644 index bc504d130e..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/Checkbox_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/Checkbox_Over.png b/indra/newview/skins/default/textures/widgets/Checkbox_Over.png deleted file mode 100644 index 5a7162addf..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/Checkbox_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png b/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png deleted file mode 100644 index fd1d11dd0b..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Closed_Over.png b/indra/newview/skins/default/textures/widgets/DisclosureArrow_Closed_Over.png deleted file mode 100644 index 45bcb0464e..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Closed_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Over.png b/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Over.png deleted file mode 100644 index dabbd85b34..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/DisclosureArrow_Opened_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/PushButton_On_Over.png b/indra/newview/skins/default/textures/widgets/PushButton_On_Over.png deleted file mode 100644 index 064a4c4f7f..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/PushButton_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/PushButton_Selected_Over.png b/indra/newview/skins/default/textures/widgets/PushButton_Selected_Over.png deleted file mode 100644 index 064a4c4f7f..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/PushButton_Selected_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_On_Over.png b/indra/newview/skins/default/textures/widgets/RadioButton_On_Over.png deleted file mode 100644 index 3e7d803a28..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/RadioButton_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/RadioButton_Over.png b/indra/newview/skins/default/textures/widgets/RadioButton_Over.png deleted file mode 100644 index a5c8cbe293..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/RadioButton_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png deleted file mode 100644 index 186822da43..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over.png deleted file mode 100644 index 605d159eaa..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over.png deleted file mode 100644 index c79547dffd..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Left_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over.png deleted file mode 100644 index e353542ad9..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Right_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png deleted file mode 100644 index 4d245eb57a..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over.png deleted file mode 100644 index dd2fceb716..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz_Over.png b/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz_Over.png deleted file mode 100644 index cf78ea3924..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollThumb_Horiz_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert_Over.png b/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert_Over.png deleted file mode 100644 index 53587197da..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/ScrollThumb_Vert_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On.png deleted file mode 100644 index 7afb9c99c3..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Disabled.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Disabled.png deleted file mode 100644 index 77c4224539..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Disabled.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Over.png deleted file mode 100644 index 8b93dd551e..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Selected.png deleted file mode 100644 index 3f207cbea2..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Left_On_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On.png deleted file mode 100644 index 220df9db25..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Over.png deleted file mode 100644 index 5bbcdcb0b4..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Press.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Press.png deleted file mode 100644 index dde367f05e..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_On_Press.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Over.png deleted file mode 100644 index d4f30b9adb..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected_Over.png deleted file mode 100644 index 5bbcdcb0b4..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Middle_Selected_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On.png deleted file mode 100644 index 467c43fc90..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Over.png deleted file mode 100644 index 2049736897..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png deleted file mode 100644 index 1574f48b28..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected_Over.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected_Over.png deleted file mode 100644 index 2049736897..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_Selected_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/SliderThumb_Over.png b/indra/newview/skins/default/textures/widgets/SliderThumb_Over.png deleted file mode 100644 index b6f900d3bd..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/SliderThumb_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/Stepper_Down_Over.png b/indra/newview/skins/default/textures/widgets/Stepper_Down_Over.png deleted file mode 100644 index 01e0a2d9f1..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/Stepper_Down_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/widgets/Stepper_Up_Over.png b/indra/newview/skins/default/textures/widgets/Stepper_Up_Over.png deleted file mode 100644 index 2ce84ea5be..0000000000 Binary files a/indra/newview/skins/default/textures/widgets/Stepper_Up_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Flyout.png b/indra/newview/skins/default/textures/windows/Flyout.png deleted file mode 100644 index 5596b194c9..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Flyout.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Flyout_Pointer_Up.png b/indra/newview/skins/default/textures/windows/Flyout_Pointer_Up.png deleted file mode 100644 index 361fab59e0..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Flyout_Pointer_Up.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png deleted file mode 100644 index 67bd399358..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Help_Press.png b/indra/newview/skins/default/textures/windows/Icon_Help_Press.png deleted file mode 100644 index 7478644b6a..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Icon_Help_Press.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png deleted file mode 100644 index 9a71d16a3f..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Undock_Press.png b/indra/newview/skins/default/textures/windows/Icon_Undock_Press.png deleted file mode 100644 index 3ab8c3666a..0000000000 Binary files a/indra/newview/skins/default/textures/windows/Icon_Undock_Press.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_down.png b/indra/newview/skins/default/textures/windows/hint_arrow_down.png deleted file mode 100644 index ddadef0978..0000000000 Binary files a/indra/newview/skins/default/textures/windows/hint_arrow_down.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_up.png b/indra/newview/skins/default/textures/windows/hint_arrow_up.png deleted file mode 100644 index bb3e1c07fa..0000000000 Binary files a/indra/newview/skins/default/textures/windows/hint_arrow_up.png and /dev/null differ -- cgit v1.2.3 From 8db1be0d9834b9572b137a820551bdd9c56668b0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 15:26:32 -0700 Subject: restored missing minimap icon --- .../skins/default/textures/toolbar_icons/mini_map.png | Bin 0 -> 1766 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/mini_map.png diff --git a/indra/newview/skins/default/textures/toolbar_icons/mini_map.png b/indra/newview/skins/default/textures/toolbar_icons/mini_map.png new file mode 100644 index 0000000000..ab0a654056 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/mini_map.png differ -- cgit v1.2.3 From 86927066473a912a8f65b03c60776a99debc70b8 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 2 Nov 2011 15:39:42 -0700 Subject: EXP-1178 FIX -- Places floater sorted weird and landmark folders inside are open --- indra/newview/llpanellandmarks.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index a65631b8d8..c7454e85a9 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -1399,10 +1399,6 @@ static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::strin inventory_list->restoreFolderState(); } - // Open the immediate children of the root folder, since those - // are invisible in the UI and thus must always be open. - inventory_list->getRootFolder()->openTopLevelFolders(); - if (inventory_list->getFilterSubString().empty() && string.empty()) { // current filter and new filter empty, do nothing -- cgit v1.2.3 From 424d100f7d96cd11eabd6dfd56241d3b84cfd976 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 15:44:26 -0700 Subject: restored final set of referenced images --- .../skins/default/textures/icons/Sync_Progress_1.png | Bin 0 -> 1149 bytes .../skins/default/textures/icons/Sync_Progress_2.png | Bin 0 -> 1147 bytes .../skins/default/textures/icons/Sync_Progress_3.png | Bin 0 -> 1211 bytes .../skins/default/textures/icons/Sync_Progress_4.png | Bin 0 -> 1205 bytes .../skins/default/textures/icons/Sync_Progress_5.png | Bin 0 -> 1137 bytes .../skins/default/textures/icons/Sync_Progress_6.png | Bin 0 -> 1164 bytes indra/newview/skins/default/textures/menu_separator.png | Bin 0 -> 2831 bytes .../skins/default/textures/widgets/ScrollArrow_Down.png | Bin 0 -> 239 bytes .../skins/default/textures/widgets/ScrollArrow_Up.png | Bin 0 -> 262 bytes .../textures/widgets/SegmentedBtn_Right_On_Selected.png | Bin 0 -> 502 bytes .../skins/default/textures/windows/Icon_Help_Press.png | Bin 0 -> 3062 bytes .../default/textures/windows/Icon_Undock_Foreground.png | Bin 0 -> 268 bytes .../skins/default/textures/windows/hint_arrow_down.png | Bin 0 -> 3170 bytes .../skins/default/textures/windows/hint_arrow_up.png | Bin 0 -> 3219 bytes 14 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_1.png create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_2.png create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_3.png create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_4.png create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_5.png create mode 100644 indra/newview/skins/default/textures/icons/Sync_Progress_6.png create mode 100644 indra/newview/skins/default/textures/menu_separator.png create mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png create mode 100644 indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png create mode 100644 indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png create mode 100644 indra/newview/skins/default/textures/windows/Icon_Help_Press.png create mode 100644 indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_down.png create mode 100644 indra/newview/skins/default/textures/windows/hint_arrow_up.png diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_1.png b/indra/newview/skins/default/textures/icons/Sync_Progress_1.png new file mode 100644 index 0000000000..624e556376 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_1.png differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_2.png b/indra/newview/skins/default/textures/icons/Sync_Progress_2.png new file mode 100644 index 0000000000..5769803b3f Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_2.png differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_3.png b/indra/newview/skins/default/textures/icons/Sync_Progress_3.png new file mode 100644 index 0000000000..92d4bfb020 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_3.png differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_4.png b/indra/newview/skins/default/textures/icons/Sync_Progress_4.png new file mode 100644 index 0000000000..6d43eb3a9f Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_4.png differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_5.png b/indra/newview/skins/default/textures/icons/Sync_Progress_5.png new file mode 100644 index 0000000000..766d063c99 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_5.png differ diff --git a/indra/newview/skins/default/textures/icons/Sync_Progress_6.png b/indra/newview/skins/default/textures/icons/Sync_Progress_6.png new file mode 100644 index 0000000000..dfe7f68b72 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Sync_Progress_6.png differ diff --git a/indra/newview/skins/default/textures/menu_separator.png b/indra/newview/skins/default/textures/menu_separator.png new file mode 100644 index 0000000000..89dcdcdff5 Binary files /dev/null and b/indra/newview/skins/default/textures/menu_separator.png differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png new file mode 100644 index 0000000000..186822da43 Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/ScrollArrow_Down.png differ diff --git a/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png new file mode 100644 index 0000000000..4d245eb57a Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/ScrollArrow_Up.png differ diff --git a/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png new file mode 100644 index 0000000000..1574f48b28 Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/SegmentedBtn_Right_On_Selected.png differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Help_Press.png b/indra/newview/skins/default/textures/windows/Icon_Help_Press.png new file mode 100644 index 0000000000..7478644b6a Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Icon_Help_Press.png differ diff --git a/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png new file mode 100644 index 0000000000..9a71d16a3f Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Icon_Undock_Foreground.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_down.png b/indra/newview/skins/default/textures/windows/hint_arrow_down.png new file mode 100644 index 0000000000..ddadef0978 Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_down.png differ diff --git a/indra/newview/skins/default/textures/windows/hint_arrow_up.png b/indra/newview/skins/default/textures/windows/hint_arrow_up.png new file mode 100644 index 0000000000..bb3e1c07fa Binary files /dev/null and b/indra/newview/skins/default/textures/windows/hint_arrow_up.png differ -- cgit v1.2.3 From 57eaa1d6f1b197022bd8e16462454306665ccda7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 15:45:41 -0700 Subject: minor syntactical cleanup --- indra/newview/skins/default/textures/textures.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 362248c3c5..c93f106418 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -39,7 +39,7 @@ with the same filename but different name - + @@ -48,9 +48,6 @@ with the same filename but different name - - -- cgit v1.2.3 From 1806b59e85e82eaddbd10e56213aba7ec8e3ce85 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 2 Nov 2011 18:45:10 -0700 Subject: EXP-1390 FIX Cannot see full sound icon when in IM call when background is a dark co --- .../textures/bottomtray/VoicePTT_Lvl1_Dark.png | Bin 1394 -> 602 bytes .../textures/bottomtray/VoicePTT_Lvl2_Dark.png | Bin 1453 -> 669 bytes .../textures/bottomtray/VoicePTT_Lvl3_Dark.png | Bin 1426 -> 639 bytes .../textures/bottomtray/VoicePTT_Off_Dark.png | Bin 1353 -> 547 bytes .../textures/bottomtray/VoicePTT_On_Dark.png | Bin 1342 -> 526 bytes indra/newview/skins/default/textures/textures.xml | 1 - .../default/xui/en/widgets/chiclet_im_adhoc.xml | 20 +++++++++++++------- .../default/xui/en/widgets/chiclet_im_group.xml | 20 +++++++++++++------- .../skins/default/xui/en/widgets/chiclet_im_p2p.xml | 20 +++++++++++++------- 9 files changed, 39 insertions(+), 22 deletions(-) diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png index 9ef5465dd3..857fa1e047 100644 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png index 38918b9bed..453bb53673 100644 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png index 180385e29e..135a66ca0d 100644 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png index 42fed4183b..a63aec5e6d 100644 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png index fa09006d1f..1719eb3e84 100644 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png and b/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index c93f106418..d2c5f6af3e 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -569,7 +569,6 @@ with the same filename but different name - diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml index 413ca1d1ef..f47e9874b4 100644 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml +++ b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml @@ -12,13 +12,19 @@ tab_stop="false" width="25" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + name="speaker" + visible="false" + width="20" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + name="speaker" + visible="false" + width="20" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + name="speaker" + visible="false" + width="20" /> Date: Thu, 3 Nov 2011 08:25:34 -0400 Subject: STORM-1679 Avatar Draw Weight number is always red --- doc/contributions.txt | 1 + indra/newview/llvoavatar.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index d719f64baf..c6739dd2a1 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -582,6 +582,7 @@ Jonathan Yap STORM-1639 STORM-910 STORM-1642 + STORM-1679 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bdab250b49..163ac2dc70 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8335,7 +8335,7 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d void LLVOAvatar::idleUpdateRenderCost() { static const U32 ARC_BODY_PART_COST = 200; - static const U32 ARC_LIMIT = 2048; + static const U32 ARC_LIMIT = 40000; static std::set all_textures; -- cgit v1.2.3 From ce05b9f7e5347c28780b399efa70992cb7bf5229 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 3 Nov 2011 15:39:12 +0200 Subject: STORM-1580 WIP Implemented new "Working" and "Success/Failure" screens. --- indra/newview/CMakeLists.txt | 2 - indra/newview/llfloatersnapshot.cpp | 127 +++++++++++++++++++-- indra/newview/llfloatersnapshot.h | 4 +- indra/newview/llpanelpostprogress.cpp | 59 ---------- indra/newview/llpanelpostresult.cpp | 90 --------------- indra/newview/llpanelsnapshot.cpp | 28 +++++ indra/newview/llpanelsnapshot.h | 7 +- indra/newview/llpanelsnapshotinventory.cpp | 23 +--- indra/newview/llpanelsnapshotlocal.cpp | 24 ++-- indra/newview/llpanelsnapshotpostcard.cpp | 25 +--- indra/newview/llpanelsnapshotprofile.cpp | 23 +--- .../skins/default/xui/en/floater_snapshot.xml | 90 ++++++++++++--- .../skins/default/xui/en/panel_post_progress.xml | 55 --------- .../skins/default/xui/en/panel_post_result.xml | 78 ------------- .../default/xui/en/panel_snapshot_options.xml | 64 +++++++++++ 15 files changed, 314 insertions(+), 385 deletions(-) delete mode 100644 indra/newview/llpanelpostprogress.cpp delete mode 100644 indra/newview/llpanelpostresult.cpp delete mode 100644 indra/newview/skins/default/xui/en/panel_post_progress.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_post_result.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 63b05f5a1d..ff9cf3199e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -392,8 +392,6 @@ set(viewer_SOURCE_FILES llpanelplaceprofile.cpp llpanelplaces.cpp llpanelplacestab.cpp - llpanelpostprogress.cpp - llpanelpostresult.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp llpanelprofileview.cpp diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 08ca1e8cea..3df715e24b 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -86,7 +86,7 @@ ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -LLRect LLFloaterSnapshot::sThumbnailPlaceholderRect; +LLUICtrl* LLFloaterSnapshot::sThumbnailPlaceholder = NULL; LLSnapshotFloaterView* gSnapshotFloaterView = NULL; const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; @@ -1063,10 +1063,18 @@ void LLSnapshotLivePreview::regionNameCallback(LLImageJPEG* snapshot, LLSD& meta class LLFloaterSnapshot::Impl { public: + typedef enum e_status + { + STATUS_READY, + STATUS_WORKING, + STATUS_FINISHED + } EStatus; + Impl() : mAvatarPauseHandles(), mLastToolset(NULL), - mAspectRatioCheckOff(false) + mAspectRatioCheckOff(false), + mStatus(STATUS_READY) { } ~Impl() @@ -1114,6 +1122,8 @@ public: static void updateControls(LLFloaterSnapshot* floater); static void updateLayout(LLFloaterSnapshot* floater); static void updateResolutionTextEntry(LLFloaterSnapshot* floater); + static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); + EStatus getStatus() const { return mStatus; } private: static LLSnapshotLivePreview::ESnapshotType getTypeIndex(const std::string& id); @@ -1122,6 +1132,9 @@ private: static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname); static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); static void checkAspectRatio(LLFloaterSnapshot *view, S32 index) ; + static void setWorking(LLFloaterSnapshot* floater, bool working); + static void setFinished(LLFloaterSnapshot* floater, bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); + public: std::vector mAvatarPauseHandles; @@ -1129,6 +1142,7 @@ public: LLToolset* mLastToolset; LLHandle mPreviewHandle; bool mAspectRatioCheckOff ; + EStatus mStatus; }; // static @@ -1575,6 +1589,29 @@ void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* float } } +// static +void LLFloaterSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg) +{ + LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance(); + switch (status) + { + case STATUS_READY: + setWorking(floater, false); + setFinished(floater, false); + break; + case STATUS_WORKING: + setWorking(floater, true); + setFinished(floater, false); + break; + case STATUS_FINISHED: + setWorking(floater, false); + setFinished(floater, true, ok, msg); + break; + } + + floater->impl.mStatus = status; +} + // static void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail) { @@ -1770,6 +1807,44 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde return ; } +// static +void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool working) +{ + LLUICtrl* working_lbl = floater->getChild("working_lbl"); + working_lbl->setVisible(working); + floater->getChild("working_indicator")->setVisible(working); + + if (working) + { + const std::string panel_name = getActivePanel(floater, false)->getName(); + const std::string prefix = panel_name.substr(std::string("panel_snapshot_").size()); + std::string progress_text = floater->getString(prefix + "_" + "progress_str"); + working_lbl->setValue(progress_text); + } + + // All controls should be disable while posting. + floater->setCtrlsEnabled(!working); + LLPanelSnapshot* active_panel = getActivePanel(floater); + if (active_panel) + { + active_panel->setCtrlsEnabled(!working); + } +} + +// static +void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finished, bool ok, const std::string& msg) +{ + floater->getChild("succeeded_panel")->setVisible(finished && ok); + floater->getChild("failed_panel")->setVisible(finished && !ok); + + if (finished) + { + LLUICtrl* finished_lbl = floater->getChild(ok ? "succeeded_lbl" : "failed_lbl"); + std::string result_text = floater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str")); + finished_lbl->setValue(result_text); + } +} + static std::string lastSnapshotWidthName(S32 shot_type) { switch (shot_type) @@ -2167,14 +2242,16 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 // static void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(LLSideTrayPanelContainer* panel_container, bool status) { - panel_container->openPanel("panel_post_result", LLSD().with("post-result", status).with("post-type", "profile")); + panel_container->openPreviousPanel(); + setStatus(STATUS_FINISHED, status, "profile"); } // static void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLSideTrayPanelContainer* panel_container, bool status) { - panel_container->openPanel("panel_post_result", LLSD().with("post-result", status).with("post-type", "postcard")); + panel_container->openPreviousPanel(); + setStatus(STATUS_FINISHED, status, "postcard"); } ///---------------------------------------------------------------------------- @@ -2265,8 +2342,7 @@ BOOL LLFloaterSnapshot::postBuild() LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, panel_container, _1)); LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, panel_container, _1)); - // remember preview rect - sThumbnailPlaceholderRect = getChild("thumbnail_placeholder")->getRect(); + sThumbnailPlaceholder = getChild("thumbnail_placeholder"); // create preview window LLRect full_screen_rect = getRootView()->getRect(); @@ -2307,18 +2383,32 @@ void LLFloaterSnapshot::draw() { if(previewp->getThumbnailImage()) { - LLRect& thumbnail_rect = sThumbnailPlaceholderRect; + bool working = impl.getStatus() == Impl::STATUS_WORKING; + const LLRect& thumbnail_rect = getThumbnailPlaceholderRect(); S32 offset_x = thumbnail_rect.mLeft + (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 ; S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; glMatrixMode(GL_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, previewp->getThumbnailWidth(), previewp->getThumbnailHeight(), - previewp->getThumbnailImage(), LLColor4::white % alpha); + previewp->getThumbnailImage(), color % alpha); previewp->drawPreviewRect(offset_x, offset_y) ; + + if (working) + { + gGL.pushUIMatrix(); + { + const LLRect& r = getThumbnailPlaceholderRect(); + //gGL.translateUI((F32) r.mLeft, (F32) r.mBottom, 0.f); + LLUI::translate((F32) r.mLeft, (F32) r.mBottom); + sThumbnailPlaceholder->draw(); + } + gGL.popUIMatrix(); + } } } } @@ -2377,6 +2467,24 @@ S32 LLFloaterSnapshot::notify(const LLSD& info) return 1; } + if (info.has("set-ready")) + { + impl.setStatus(Impl::STATUS_READY); + return 1; + } + + if (info.has("set-working")) + { + impl.setStatus(Impl::STATUS_WORKING); + return 1; + } + + if (info.has("set-finished")) + { + LLSD data = info["set-finished"]; + impl.setStatus(Impl::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString()); + return 1; + } return 0; } @@ -2425,7 +2533,6 @@ void LLFloaterSnapshot::saveTexture() } previewp->saveTexture(); - instance->postSave(); } // static @@ -2447,7 +2554,6 @@ void LLFloaterSnapshot::saveLocal() } previewp->saveLocal(); - instance->postSave(); } // static @@ -2483,6 +2589,7 @@ void LLFloaterSnapshot::postSave() } instance->impl.updateControls(instance); + instance->impl.setStatus(Impl::STATUS_WORKING); } // static diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index de69824ad0..2c79c749d6 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -67,10 +67,10 @@ public: static const LLVector3d& getPosTakenGlobal(); static void setAgentEmail(const std::string& email); - static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholderRect; } + static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } private: - static LLRect sThumbnailPlaceholderRect; + static LLUICtrl* sThumbnailPlaceholder; class Impl; Impl& impl; diff --git a/indra/newview/llpanelpostprogress.cpp b/indra/newview/llpanelpostprogress.cpp deleted file mode 100644 index 9b7de2cb23..0000000000 --- a/indra/newview/llpanelpostprogress.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file llpanelpostprogress.cpp - * @brief Displays progress of publishing a snapshot. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the termsllpanelpostprogress of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterreg.h" -#include "llpanel.h" -#include "llsidetraypanelcontainer.h" - -/** - * Displays progress of publishing a snapshot. - */ -class LLPanelPostProgress -: public LLPanel -{ - LOG_CLASS(LLPanelPostProgress); - -public: - /*virtual*/ void onOpen(const LLSD& key); -}; - -static LLRegisterPanelClassWrapper panel_class("llpanelpostprogress"); - -// virtual -void LLPanelPostProgress::onOpen(const LLSD& key) -{ - if (key.has("post-type")) - { - std::string progress_text = getString(key["post-type"].asString() + "_" + "progress_str"); - getChild("progress_lbl")->setText(progress_text); - } - else - { - llwarns << "Invalid key" << llendl; - } -} diff --git a/indra/newview/llpanelpostresult.cpp b/indra/newview/llpanelpostresult.cpp deleted file mode 100644 index 2b937d83b9..0000000000 --- a/indra/newview/llpanelpostresult.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @file llpanelpostresult.cpp - * @brief Result of publishing a snapshot (success/failure). - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterreg.h" -#include "llpanel.h" -#include "llsidetraypanelcontainer.h" - -/** - * Displays snapshot publishing result. - */ -class LLPanelPostResult -: public LLPanel -{ - LOG_CLASS(LLPanelPostResult); - -public: - LLPanelPostResult(); - - /*virtual*/ void onOpen(const LLSD& key); -private: - void onBack(); - void onClose(); -}; - -static LLRegisterPanelClassWrapper panel_class("llpanelpostresult"); - -LLPanelPostResult::LLPanelPostResult() -{ - mCommitCallbackRegistrar.add("Snapshot.Result.Back", boost::bind(&LLPanelPostResult::onBack, this)); - mCommitCallbackRegistrar.add("Snapshot.Result.Close", boost::bind(&LLPanelPostResult::onClose, this)); -} - - -// virtual -void LLPanelPostResult::onOpen(const LLSD& key) -{ - if (key.isMap() && key.has("post-result") && key.has("post-type")) - { - bool ok = key["post-result"].asBoolean(); - std::string type = key["post-type"].asString(); - std::string result_text = getString(type + "_" + (ok ? "succeeded_str" : "failed_str")); - getChild("result_lbl")->setText(result_text); - } - else - { - llwarns << "Invalid key" << llendl; - } -} - -void LLPanelPostResult::onBack() -{ - LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); - if (!parent) - { - llwarns << "Cannot find panel container" << llendl; - return; - } - - parent->openPreviousPanel(); -} - -void LLPanelPostResult::onClose() -{ - LLFloaterReg::hideInstance("snapshot"); -} diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index e89e62c750..893f1ca43c 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -35,6 +35,19 @@ // newview #include "llsidetraypanelcontainer.h" +// virtual +BOOL LLPanelSnapshot::postBuild() +{ + updateControls(LLSD()); + return TRUE; +} + +// virtual +void LLPanelSnapshot::onOpen(const LLSD& key) +{ + setCtrlsEnabled(true); +} + LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshot::getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; @@ -107,3 +120,18 @@ void LLPanelSnapshot::updateImageQualityLevel() getChild("image_quality_level")->setTextArg("[QLVL]", quality_lvl); } + +void LLPanelSnapshot::goBack() +{ + LLSideTrayPanelContainer* parent = getParentContainer(); + if (parent) + { + parent->openPreviousPanel(); + } +} + +void LLPanelSnapshot::cancel() +{ + goBack(); + LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-ready", true)); +} diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h index a227317d2f..eaa0bc42c6 100644 --- a/indra/newview/llpanelsnapshot.h +++ b/indra/newview/llpanelsnapshot.h @@ -37,6 +37,9 @@ class LLSideTrayPanelContainer; class LLPanelSnapshot: public LLPanel { public: + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + virtual std::string getWidthSpinnerName() const = 0; virtual std::string getHeightSpinnerName() const = 0; virtual std::string getAspectRatioCBName() const = 0; @@ -48,11 +51,13 @@ public: virtual LLSpinCtrl* getHeightSpinner(); virtual void enableAspectRatioCheckbox(BOOL enable); virtual LLFloaterSnapshot::ESnapshotFormat getImageFormat() const; - virtual void updateControls(const LLSD& info) {} ///< Update controls from saved settings + virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings protected: LLSideTrayPanelContainer* getParentContainer(); void updateImageQualityLevel(); + void goBack(); ///< Switch to the default (Snapshot Options) panel + void cancel(); }; #endif // LL_LLPANELSNAPSHOT_H diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 6419c37494..c781138f88 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -60,7 +60,6 @@ private: void onCustomResolutionCommit(LLUICtrl* ctrl); void onKeepAspectRatioCommit(LLUICtrl* ctrl); void onSend(); - void onCancel(); }; static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotinventory"); @@ -68,7 +67,7 @@ static LLRegisterPanelClassWrapper panel_class("llpane LLPanelSnapshotInventory::LLPanelSnapshotInventory() { mCommitCallbackRegistrar.add("Inventory.Save", boost::bind(&LLPanelSnapshotInventory::onSend, this)); - mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::onCancel, this)); + mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::cancel, this)); } // virtual @@ -78,7 +77,7 @@ BOOL LLPanelSnapshotInventory::postBuild() getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onKeepAspectRatioCommit, this, _1)); - return TRUE; + return LLPanelSnapshot::postBuild(); } // virtual @@ -88,6 +87,7 @@ void LLPanelSnapshotInventory::onOpen(const LLSD& key) getChild(getImageSizeComboName())->selectNthItem(0); // FIXME? has no effect #endif updateCustomResControls(); + LLPanelSnapshot::onOpen(key); } void LLPanelSnapshotInventory::updateCustomResControls() @@ -132,21 +132,6 @@ void LLPanelSnapshotInventory::onKeepAspectRatioCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventory::onSend() { - // Switch to upload progress display. - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPanel("panel_post_progress", LLSD().with("post-type", "inventory")); - } - LLFloaterSnapshot::saveTexture(); -} - -void LLPanelSnapshotInventory::onCancel() -{ - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPreviousPanel(); - } + LLFloaterSnapshot::postSave(); } diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp index 5dc32d228f..b67c4ec673 100644 --- a/indra/newview/llpanelsnapshotlocal.cpp +++ b/indra/newview/llpanelsnapshotlocal.cpp @@ -64,7 +64,6 @@ private: void onKeepAspectRatioCommit(LLUICtrl* ctrl); void onQualitySliderCommit(LLUICtrl* ctrl); void onSend(); - void onCancel(); }; static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotlocal"); @@ -72,7 +71,7 @@ static LLRegisterPanelClassWrapper panel_class("llpanelsna LLPanelSnapshotLocal::LLPanelSnapshotLocal() { mCommitCallbackRegistrar.add("Local.Save", boost::bind(&LLPanelSnapshotLocal::onSend, this)); - mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::onCancel, this)); + mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::cancel, this)); } // virtual @@ -85,15 +84,14 @@ BOOL LLPanelSnapshotLocal::postBuild() getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1)); getChild("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1)); - updateControls(LLSD()); - - return TRUE; + return LLPanelSnapshot::postBuild(); } // virtual void LLPanelSnapshotLocal::onOpen(const LLSD& key) { updateCustomResControls(); + LLPanelSnapshot::onOpen(key); } // virtual @@ -195,15 +193,11 @@ void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl) void LLPanelSnapshotLocal::onSend() { - LLFloaterSnapshot::saveLocal(); - onCancel(); -} + LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance(); -void LLPanelSnapshotLocal::onCancel() -{ - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPreviousPanel(); - } + floater->notify(LLSD().with("set-working", true)); + LLFloaterSnapshot::saveLocal(); + LLFloaterSnapshot::postSave(); + goBack(); + floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local"))); } diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index c2b83d5c19..9f3f6d7cb6 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -76,7 +76,6 @@ private: void onQualitySliderCommit(LLUICtrl* ctrl); void onTabButtonPress(S32 btn_idx); void onSend(); - void onCancel(); bool mHasFirstMsgFocus; }; @@ -87,7 +86,7 @@ LLPanelSnapshotPostcard::LLPanelSnapshotPostcard() : mHasFirstMsgFocus(false) { mCommitCallbackRegistrar.add("Postcard.Send", boost::bind(&LLPanelSnapshotPostcard::onSend, this)); - mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::onCancel, this)); + mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::cancel, this)); mCommitCallbackRegistrar.add("Postcard.Message", boost::bind(&LLPanelSnapshotPostcard::onTabButtonPress, this, 0)); mCommitCallbackRegistrar.add("Postcard.Settings", boost::bind(&LLPanelSnapshotPostcard::onTabButtonPress, this, 1)); @@ -118,9 +117,7 @@ BOOL LLPanelSnapshotPostcard::postBuild() getChild("message_btn")->setToggleState(TRUE); - updateControls(LLSD()); - - return TRUE; + return LLPanelSnapshot::postBuild(); } // virtual @@ -128,6 +125,7 @@ void LLPanelSnapshotPostcard::onOpen(const LLSD& key) { gSavedSettings.setS32("SnapshotFormat", getImageFormat()); updateCustomResControls(); + LLPanelSnapshot::onOpen(key); } // virtual @@ -212,17 +210,11 @@ void LLPanelSnapshotPostcard::sendPostcard() postcard["subject"] = subject; postcard["msg"] = getChild("msg_form")->getValue().asString(); LLPostCard::send(LLFloaterSnapshot::getImageData(), postcard); - LLFloaterSnapshot::postSave(); // Give user feedback of the event. gViewerWindow->playSnapshotAnimAndSound(); - // Switch to upload progress display. - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPanel("panel_post_progress", LLSD().with("post-type", "postcard")); - } + LLFloaterSnapshot::postSave(); } void LLPanelSnapshotPostcard::onMsgFormFocusRecieved() @@ -325,12 +317,3 @@ void LLPanelSnapshotPostcard::onSend() // Send postcard. sendPostcard(); } - -void LLPanelSnapshotPostcard::onCancel() -{ - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPreviousPanel(); - } -} diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp index 80a379a5a0..33237fd84f 100644 --- a/indra/newview/llpanelsnapshotprofile.cpp +++ b/indra/newview/llpanelsnapshotprofile.cpp @@ -62,7 +62,6 @@ private: void updateCustomResControls(); ///< Enable/disable custom resolution controls (spinners and checkbox) void onSend(); - void onCancel(); void onResolutionComboCommit(LLUICtrl* ctrl); void onCustomResolutionCommit(LLUICtrl* ctrl); void onKeepAspectRatioCommit(LLUICtrl* ctrl); @@ -73,7 +72,7 @@ static LLRegisterPanelClassWrapper panel_class("llpanels LLPanelSnapshotProfile::LLPanelSnapshotProfile() { mCommitCallbackRegistrar.add("PostToProfile.Send", boost::bind(&LLPanelSnapshotProfile::onSend, this)); - mCommitCallbackRegistrar.add("PostToProfile.Cancel", boost::bind(&LLPanelSnapshotProfile::onCancel, this)); + mCommitCallbackRegistrar.add("PostToProfile.Cancel", boost::bind(&LLPanelSnapshotProfile::cancel, this)); } // virtual @@ -83,13 +82,15 @@ BOOL LLPanelSnapshotProfile::postBuild() getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onKeepAspectRatioCommit, this, _1)); - return TRUE; + + return LLPanelSnapshot::postBuild(); } // virtual void LLPanelSnapshotProfile::onOpen(const LLSD& key) { updateCustomResControls(); + LLPanelSnapshot::onOpen(key); } // virtual @@ -119,22 +120,6 @@ void LLPanelSnapshotProfile::onSend() LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location); LLFloaterSnapshot::postSave(); - - // Switch to upload progress display. - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPanel("panel_post_progress", LLSD().with("post-type", "profile")); - } -} - -void LLPanelSnapshotProfile::onCancel() -{ - LLSideTrayPanelContainer* parent = getParentContainer(); - if (parent) - { - parent->openPreviousPanel(); - } } void LLPanelSnapshotProfile::onResolutionComboCommit(LLUICtrl* ctrl) diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index bc48561196..22d6ba5bdb 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -17,6 +17,54 @@ name="unknown"> unknown + + Sending Email + + + Posting + + + Saving to Inventory + + + Saving to Computer + + + Your Profile Feed has been updated! + + + Email Sent! + + + Saved to Inventory! + + + Saved to Computer! + + + Failed to update your Profile Feed. + + + Failed to send email. + + + Failed to save to inventory. + + + Failed to save to computer. + + left="10"> + + + Working + + - - - - - Sending Email - - - Posting - - - Saving to Inventory - - - Saving to Computer - - - - - Working - - diff --git a/indra/newview/skins/default/xui/en/panel_post_result.xml b/indra/newview/skins/default/xui/en/panel_post_result.xml deleted file mode 100644 index 4a64b8469b..0000000000 --- a/indra/newview/skins/default/xui/en/panel_post_result.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - Your Profile Feed has been updated! - - - Email Sent! - - - Saved to Inventory! - - - Saved to Computer! - - - Failed to update your Profile Feed. - - - Failed to send email. - - - Failed to save to inventory. - - - Failed to save to computer. - - - Result - - - - diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml index e6324f8923..6fb17ed6a6 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -77,4 +77,68 @@ + + + Succeeded + + + + + Failed + + -- cgit v1.2.3 From 41e6455f7404b001696f8fe54e4353c80059c6e5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 3 Nov 2011 18:03:36 +0200 Subject: STORM-1580 WIP Updated texture upload progress according to the spec. By the way, fixed displaying upload cost. --- indra/newview/llassetuploadresponders.cpp | 10 ++++++ indra/newview/llfloatersnapshot.cpp | 36 ++++++++++------------ indra/newview/llpanelsnapshot.cpp | 1 + indra/newview/llpanelsnapshotinventory.cpp | 2 ++ indra/newview/llpanelsnapshotoptions.cpp | 10 ++++++ .../default/xui/en/panel_snapshot_inventory.xml | 2 +- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 966f5b941e..40a4d665f8 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -78,6 +78,8 @@ void on_new_single_inventory_upload_complete( const LLSD& server_response, S32 upload_price) { + bool success = false; + if ( upload_price > 0 ) { // this upload costed us L$, update our balance @@ -152,6 +154,7 @@ void on_new_single_inventory_upload_complete( gInventory.updateItem(item); gInventory.notifyObservers(); + success = true; // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. @@ -175,6 +178,13 @@ void on_new_single_inventory_upload_complete( // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); + + // Let the Snapshot floater know we have finished uploading a snapshot to inventory. + LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot"); + if (asset_type == LLAssetType::AT_TEXTURE && floater_snapshot) + { + floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory"))); + } } LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data, diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 3df715e24b..128d50a061 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1105,8 +1105,8 @@ public: static void onCommitCustomResolution(LLUICtrl *ctrl, void* data); #endif static void applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h); - static void onSnapshotUploadFinished(LLSideTrayPanelContainer* panel_container, bool status); - static void onSendingPostcardFinished(LLSideTrayPanelContainer* panel_container, bool status); + static void onSnapshotUploadFinished(bool status); + static void onSendingPostcardFinished(bool status); static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ; static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); @@ -1505,10 +1505,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); } - // FIXME: move this to the panel code - S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - floater->getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost)); - // Update displayed image resolution. LLTextBox* image_res_tb = floater->getChild("image_res_text"); image_res_tb->setVisible(got_snap); @@ -1842,6 +1838,10 @@ void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finis LLUICtrl* finished_lbl = floater->getChild(ok ? "succeeded_lbl" : "failed_lbl"); std::string result_text = floater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str")); finished_lbl->setValue(result_text); + + LLSideTrayPanelContainer* panel_container = floater->getChild("panel_container"); + panel_container->openPreviousPanel(); + panel_container->getCurrentPanel()->onOpen(LLSD()); } } @@ -2240,17 +2240,15 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 } // static -void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(LLSideTrayPanelContainer* panel_container, bool status) +void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(bool status) { - panel_container->openPreviousPanel(); setStatus(STATUS_FINISHED, status, "profile"); } // static -void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLSideTrayPanelContainer* panel_container, bool status) +void LLFloaterSnapshot::Impl::onSendingPostcardFinished(bool status) { - panel_container->openPreviousPanel(); setStatus(STATUS_FINISHED, status, "postcard"); } @@ -2338,9 +2336,8 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); - LLSideTrayPanelContainer* panel_container = getChild("panel_container"); - LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, panel_container, _1)); - LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, panel_container, _1)); + LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, _1)); + LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, _1)); sThumbnailPlaceholder = getChild("thumbnail_placeholder"); @@ -2398,15 +2395,13 @@ void LLFloaterSnapshot::draw() previewp->drawPreviewRect(offset_x, offset_y) ; + // Draw progress indicators on top of the preview. if (working) { gGL.pushUIMatrix(); - { - const LLRect& r = getThumbnailPlaceholderRect(); - //gGL.translateUI((F32) r.mLeft, (F32) r.mBottom, 0.f); - LLUI::translate((F32) r.mLeft, (F32) r.mBottom); - sThumbnailPlaceholder->draw(); - } + const LLRect& r = getThumbnailPlaceholderRect(); + LLUI::translate((F32) r.mLeft, (F32) r.mBottom); + sThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } } @@ -2424,6 +2419,9 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setVisible(TRUE); gSnapshotFloaterView->adjustToFitScreen(this, FALSE); + + // Initialize default tab. + getChild("panel_container")->getCurrentPanel()->onOpen(LLSD()); } void LLFloaterSnapshot::onClose(bool app_quitting) diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 893f1ca43c..35627ababe 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -127,6 +127,7 @@ void LLPanelSnapshot::goBack() if (parent) { parent->openPreviousPanel(); + parent->getCurrentPanel()->onOpen(LLSD()); } } diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index c781138f88..d517d3811d 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llcombobox.h" +#include "lleconomy.h" #include "llsidetraypanelcontainer.h" #include "llspinctrl.h" @@ -86,6 +87,7 @@ void LLPanelSnapshotInventory::onOpen(const LLSD& key) #if 0 getChild(getImageSizeComboName())->selectNthItem(0); // FIXME? has no effect #endif + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload())); updateCustomResControls(); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 8e5ff282b3..df904b6836 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" +#include "lleconomy.h" #include "llpanel.h" #include "llsidetraypanelcontainer.h" @@ -41,6 +42,7 @@ class LLPanelSnapshotOptions public: LLPanelSnapshotOptions(); + /*virtual*/ void onOpen(const LLSD& key); private: void openPanel(const std::string& panel_name); @@ -60,6 +62,13 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions() mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); } +// virtual +void LLPanelSnapshotOptions::onOpen(const LLSD& key) +{ + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); +} + void LLPanelSnapshotOptions::openPanel(const std::string& panel_name) { LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); @@ -70,6 +79,7 @@ void LLPanelSnapshotOptions::openPanel(const std::string& panel_name) } parent->openPanel(panel_name); + parent->getCurrentPanel()->onOpen(LLSD()); LLFloaterSnapshot::postPanelSwitch(); } diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml index cb243fbc5b..5db9587de6 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml @@ -50,7 +50,7 @@ top_pad="10" type="string" word_wrap="true"> - Saving an image to your inventory costs L$TBD. To save your image as a texture select one of the square formats. + Saving an image to your inventory costs L$[UPLOAD_COST]. To save your image as a texture select one of the square formats. Date: Thu, 3 Nov 2011 21:26:42 +0200 Subject: STORM-1580 WIP Removed the "Keep open after saving" checkbox that makes no sense anymore. --- indra/newview/app_settings/settings.xml | 11 -------- indra/newview/llfloatersnapshot.cpp | 31 ---------------------- .../skins/default/xui/en/floater_snapshot.xml | 7 ----- 3 files changed, 49 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9812b2868f..55e28cd60e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1605,17 +1605,6 @@ Value 0 - CloseSnapshotOnKeep - - Comment - Close snapshot window after saving snapshot - Persist - 1 - Type - Boolean - Value - 1 - CmdLineDisableVoice Comment diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 128d50a061..49da41dc0c 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1089,7 +1089,6 @@ public: static void onClickMore(void* data) ; static void onClickUICheck(LLUICtrl *ctrl, void* data); static void onClickHUDCheck(LLUICtrl *ctrl, void* data); - static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data); #if 0 static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); #endif @@ -1426,26 +1425,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) enableAspectRatioCheckbox(floater, shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); -#if 0 - BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot"); - BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL; - BOOL show_slider = (shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD || - shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB || - (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG)); - - floater->getChildView("layer_types")->setVisible( is_advance); - floater->getChildView("layer_type_label")->setVisible( is_advance); - floater->getChildView("snapshot_width")->setVisible( is_advance); - floater->getChildView("snapshot_height")->setVisible( is_advance); - floater->getChildView("keep_aspect_check")->setVisible( is_advance); - floater->getChildView("ui_check")->setVisible( is_advance); - floater->getChildView("hud_check")->setVisible( is_advance); - floater->getChildView("keep_open_check")->setVisible( is_advance); - floater->getChildView("freeze_frame_check")->setVisible( is_advance); - floater->getChildView("auto_snapshot_check")->setVisible( is_advance); - floater->getChildView("image_quality_slider")->setVisible( is_advance && show_slider); -#endif - LLPanelSnapshot* active_panel = getActivePanel(floater); if (active_panel) { @@ -1693,13 +1672,6 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) } } -// static -void LLFloaterSnapshot::Impl::onClickKeepOpenCheck(LLUICtrl* ctrl, void* data) -{ - LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - gSavedSettings.setBOOL( "CloseSnapshotOnKeep", !check->get() ); -} - #if 0 // static void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) @@ -2308,9 +2280,6 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); getChild("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); - childSetCommitCallback("keep_open_check", Impl::onClickKeepOpenCheck, this); - getChild("keep_open_check")->setValue(!gSavedSettings.getBOOL("CloseSnapshotOnKeep")); - #if 0 childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this); #endif diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 22d6ba5bdb..9719ee464e 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -295,13 +295,6 @@ top_pad="10" width="180" name="hud_check" /> - Date: Thu, 3 Nov 2011 15:00:40 -0500 Subject: SH-2240 Fix for core profile assertions when Debug GL enabled. --- indra/llrender/llimagegl.cpp | 6 +++--- indra/llwindow/llwindowwin32.cpp | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3d3c94ef3e..7d73888151 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1116,7 +1116,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt U32* scratch = NULL; if (LLRender::sGLCoreProfile) { - if (intformat == GL_ALPHA8 && pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE) + if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE) { //GL_ALPHA is deprecated, convert to RGBA use_scratch = true; scratch = new U32[width*height]; @@ -1133,7 +1133,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt intformat = GL_RGBA8; } - if (intformat == GL_LUMINANCE8_ALPHA8 && pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE) + if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE) { //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA use_scratch = true; scratch = new U32[width*height]; @@ -1153,7 +1153,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt intformat = GL_RGBA8; } - if (intformat == GL_LUMINANCE8 && pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE) + if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE) { //GL_LUMINANCE_ALPHA is deprecated, convert to RGB use_scratch = true; scratch = new U32[width*height]; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index e46fcea692..f7cbc383eb 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1416,6 +1416,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO { llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl; done = true; + + if (LLRender::sGLCoreProfile) + { + LLGLSLShader::sNoFixedFunction = true; + } } } } -- cgit v1.2.3 From ede74731ab154a5f661cc64d8b47ed97c7863d89 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 3 Nov 2011 14:36:40 -0700 Subject: EXP-1533 FIX -- As a FUI user, I'd like to be able to remove toolbar buttons without having to drag them anywhere * Added "Remove this button" option to the toolbar context menu * Added code to track the right mouse click and execute the action to remove the appropriate button on the toolbar. Reviewed by surly leyla --- indra/llui/lltoolbar.cpp | 47 +++++++++++++++++----- indra/llui/lltoolbar.h | 4 ++ .../newview/skins/default/xui/en/menu_toolbars.xml | 8 +++- 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 287e3e2b41..e7642ae190 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -109,6 +109,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadBetween(p.pad_between), mMinGirth(p.min_girth), mPopupMenuHandle(), + mRightMouseTargetButton(NULL), mStartDragItemCallback(NULL), mHandleDragItemCallback(NULL), mHandleDropCallback(NULL), @@ -139,6 +140,7 @@ void LLToolBar::createContextMenu() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit_reg; commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); + commit_reg.add("Toolbars.RemoveSelectedCommand", boost::bind(&LLToolBar::onRemoveSelectedCommand, this)); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_reg; enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); @@ -397,6 +399,20 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) if (handle_it_here) { + // Determine which button the mouse was over during the click in case the context menu action + // is intended to affect the button. + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { + LLRect button_rect; + button->localRectToOtherView(button->getLocalRect(), &button_rect, this); + + if (button_rect.pointInRect(x, y)) + { + mRightMouseTargetButton = button; + break; + } + } + createContextMenu(); LLContextMenu * menu = (LLContextMenu *) mPopupMenuHandle.get(); @@ -446,6 +462,18 @@ void LLToolBar::onSettingEnable(const LLSD& userdata) } } +void LLToolBar::onRemoveSelectedCommand() +{ + llassert(!mReadOnly); + + if (mRightMouseTargetButton) + { + removeCommand(mRightMouseTargetButton->getCommandId()); + + mRightMouseTargetButton = NULL; + } +} + void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type) { bool regenerate_buttons = (mButtonType != button_type); @@ -524,11 +552,11 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) S32 mid_point = (button_rect.mRight + button_rect.mLeft) / 2; if (button_panel_x < mid_point) { - mDragx = button_rect.mLeft - mPadLeft; - mDragy = button_rect.mTop + mPadTop; - } - else - { + mDragx = button_rect.mLeft - mPadLeft; + mDragy = button_rect.mTop + mPadTop; + } + else + { rank++; mDragx = button_rect.mRight + mPadRight - 1; mDragy = button_rect.mTop + mPadTop; @@ -555,12 +583,12 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) { // We hit passed the end of the list so put the insertion point at the end if (orientation == LLLayoutStack::HORIZONTAL) - { + { mDragx = button_rect.mRight + mPadRight; mDragy = button_rect.mTop + mPadTop; - } - else - { + } + else + { mDragx = button_rect.mLeft - mPadLeft; mDragy = button_rect.mBottom - mPadBottom; } @@ -836,6 +864,7 @@ void LLToolBar::createButtons() } mButtons.clear(); mButtonMap.clear(); + mRightMouseTargetButton = NULL; BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 8c25c43f1a..51fe23ddd1 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -63,6 +63,7 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); + void reshape(S32 width, S32 height, BOOL called_from_parent = true); void setEnabled(BOOL enabled); void setCommandId(const LLCommandId& id) { mId = id; } @@ -233,6 +234,7 @@ private: void resizeButtonsInRow(std::vector& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); + void onRemoveSelectedCommand(); private: // static layout state @@ -270,6 +272,8 @@ private: LLPanel* mButtonPanel; LLHandle mPopupMenuHandle; + LLToolBarButton* mRightMouseTargetButton; + bool mNeedsLayout; bool mModified; diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml index 7384114d7d..fbe40a7244 100644 --- a/indra/newview/skins/default/xui/en/menu_toolbars.xml +++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml @@ -3,9 +3,15 @@ layout="topleft" name="Toolbars Popup" visible="false"> + + + + + name="Choose Buttons"> -- cgit v1.2.3 From 5d2d22322527bf303d24c15fde15025c045b7654 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 3 Nov 2011 15:11:29 -0700 Subject: EXP-1538 FIX -- New tags shown for items in subfolders in received items panel which remain after minimizing parent folder * "new" tag determination for LLInboxFolderViewItem is now done on "addToFolder" rather than at construction time to avoid computing "new" for items not directly in the top level folder. --- indra/newview/llpanelmarketplaceinboxinventory.cpp | 26 +++++++++++++--------- indra/newview/llpanelmarketplaceinboxinventory.h | 5 ++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index b9fb5b8c55..df89adb8da 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -249,12 +249,25 @@ LLInboxFolderViewItem::LLInboxFolderViewItem(const Params& p) , mFresh(false) { #if SUPPORTING_FRESH_ITEM_COUNT - computeFreshness(); - initBadgeParams(p.new_badge()); #endif } +BOOL LLInboxFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* root) +{ + BOOL retval = LLFolderViewItem::addToFolder(folder, root); + +#if SUPPORTING_FRESH_ITEM_COUNT + // Compute freshness if our parent is the root folder for the inbox + if (mParentFolder == mRoot) + { + computeFreshness(); + } +#endif + + return retval; +} + BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) { return TRUE; @@ -310,14 +323,5 @@ void LLInboxFolderViewItem::deFreshify() gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } -void LLInboxFolderViewItem::setCreationDate(time_t creation_date_utc) -{ - mCreationDate = creation_date_utc; - - if (mParentFolder == mRoot) - { - computeFreshness(); - } -} // eof diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h index 09b14ec547..d6b827ee3e 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.h +++ b/indra/newview/llpanelmarketplaceinboxinventory.h @@ -69,7 +69,7 @@ public: }; LLInboxFolderViewFolder(const Params& p); - + void draw(); void selectItem(); @@ -102,6 +102,7 @@ public: LLInboxFolderViewItem(const Params& p); + BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root); BOOL handleDoubleClick(S32 x, S32 y, MASK mask); void draw(); @@ -114,8 +115,6 @@ public: bool isFresh() const { return mFresh; } protected: - void setCreationDate(time_t creation_date_utc); - bool mFresh; }; -- cgit v1.2.3 From 94678c2f7fbab0676ebf5c664e2d4cb8643b535f Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 4 Nov 2011 11:26:50 -0700 Subject: EXP-1541 update -- Route inventory items sent in a Notecard to correct locations rather than auto-sorting by asset type * New code specifies explicit destination for "copy from notecard" or null, indicating the sim should determine the placement. Reviewed by Stone. --- indra/newview/llfavoritesbar.cpp | 6 +++++- indra/newview/llinventorybridge.cpp | 8 +++++--- indra/newview/llpreview.cpp | 6 ++++-- indra/newview/llviewerinventory.cpp | 20 ++++++++++++++++++-- indra/newview/llviewerinventory.h | 5 ++++- indra/newview/llviewertexteditor.cpp | 19 +++++++++++++------ 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index f577ef7fd0..4f2fd47488 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -599,7 +599,11 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD) { viewer_item->setType(LLAssetType::AT_LANDMARK); - copy_inventory_from_notecard(tool_dad->getObjectID(), tool_dad->getSourceID(), viewer_item.get(), gInventoryCallbacks.registerCB(cb)); + copy_inventory_from_notecard(favorites_id, + tool_dad->getObjectID(), + tool_dad->getSourceID(), + viewer_item.get(), + gInventoryCallbacks.registerCB(cb)); } else { diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0e27bd81be..9188603b7a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3544,10 +3544,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // because they must contain only links to wearable items. accept = !(move_is_into_current_outfit || move_is_into_outfit); - if(drop) + if(accept && drop) { - copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(), - LLToolDragAndDrop::getInstance()->getSourceID(), inv_item); + copy_inventory_from_notecard(mUUID, // Drop to the chosen destination folder + LLToolDragAndDrop::getInstance()->getObjectID(), + LLToolDragAndDrop::getInstance()->getSourceID(), + inv_item); } } else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 119fc95cf0..18626e3273 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -363,8 +363,10 @@ void LLPreview::onBtnCopyToInv(void* userdata) // Copy to inventory if (self->mNotecardInventoryID.notNull()) { - copy_inventory_from_notecard(self->mNotecardObjectID, - self->mNotecardInventoryID, item); + copy_inventory_from_notecard(LLUUID::null, + self->mNotecardObjectID, + self->mNotecardInventoryID, + item); } else { diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 519d4fe7f8..163581ea7f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1209,7 +1209,23 @@ void move_inventory_item( gAgent.sendReliableMessage(); } -void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id) +const LLUUID get_folder_by_itemtype(const LLInventoryItem *src) +{ + LLUUID retval = LLUUID::null; + + if (src) + { + retval = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType())); + } + + return retval; +} + +void copy_inventory_from_notecard(const LLUUID& destination_id, + const LLUUID& object_id, + const LLUUID& notecard_inv_id, + const LLInventoryItem *src, + U32 callback_id) { if (NULL == src) { @@ -1255,7 +1271,7 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar body["notecard-id"] = notecard_inv_id; body["object-id"] = object_id; body["item-id"] = src->getUUID(); - body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType())); + body["folder-id"] = destination_id; body["callback-id"] = (LLSD::Integer)callback_id; request["message"] = "CopyInventoryFromNotecard"; diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 41542a4e0f..7822ef4da6 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -363,7 +363,10 @@ void move_inventory_item( const std::string& new_name, LLPointer cb); -void copy_inventory_from_notecard(const LLUUID& object_id, +const LLUUID get_folder_by_itemtype(const LLInventoryItem *src); + +void copy_inventory_from_notecard(const LLUUID& destination_id, + const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id = 0); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0a9fae68a6..b41ed00f17 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -88,12 +88,12 @@ public: { LLVector3d global_pos; landmark->getGlobalPos(global_pos); - LLViewerInventoryItem* agent_lanmark = + LLViewerInventoryItem* agent_landmark = LLLandmarkActions::findLandmarkForGlobalPos(global_pos); - if (agent_lanmark) + if (agent_landmark) { - showInfo(agent_lanmark->getUUID()); + showInfo(agent_landmark->getUUID()); } else { @@ -104,8 +104,13 @@ public: } else { + LLInventoryItem* item = item_ptr.get(); LLPointer cb = new LLEmbeddedLandmarkCopied(); - copy_inventory_from_notecard(object_id, notecard_inventory_id, item_ptr.get(), gInventoryCallbacks.registerCB(cb)); + copy_inventory_from_notecard(get_folder_by_itemtype(item), + object_id, + notecard_inventory_id, + item, + gInventoryCallbacks.registerCB(cb)); } } } @@ -1266,9 +1271,11 @@ bool LLViewerTextEditor::importStream(std::istream& str) void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback_id) { - copy_inventory_from_notecard(mObjectID, + copy_inventory_from_notecard(LLUUID::null, // Don't specify a destination -- let the sim do that + mObjectID, mNotecardInventoryID, - item, callback_id); + item, + callback_id); } bool LLViewerTextEditor::hasEmbeddedInventory() -- cgit v1.2.3 From 652aa15ccdc5047f98424fdf07c2fc6728681a62 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Nov 2011 11:46:38 -0700 Subject: EXP-1505 : FIX. Dropping a folder in current outfit would result in broken links and lost inventory. --- indra/newview/llinventorybridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9188603b7a..0c092e9a56 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2027,7 +2027,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, #endif } } - if (move_is_into_outbox && !move_is_from_outbox) + else if (move_is_into_outbox && !move_is_from_outbox) { dropFolderToOutbox(inv_cat); } -- cgit v1.2.3 From 2d24ed6ec5a8a26099065bc259f6738d5464db33 Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 4 Nov 2011 13:45:14 -0700 Subject: WIP INTL-82 LQA changes for Turkish; remove obsolete files --- .../default/xui/ru/floater_day_cycle_options.xml | 95 ---------------------- .../skins/default/xui/tr/floater_camera.xml | 2 +- .../default/xui/tr/floater_day_cycle_options.xml | 95 ---------------------- .../default/xui/tr/floater_edit_day_cycle.xml | 20 ++--- .../default/xui/tr/floater_edit_sky_preset.xml | 12 +-- .../newview/skins/default/xui/tr/floater_picks.xml | 2 +- .../default/xui/tr/floater_preview_texture.xml | 2 +- .../skins/default/xui/tr/floater_texture_ctrl.xml | 4 +- .../newview/skins/default/xui/tr/floater_tools.xml | 2 +- .../default/xui/tr/floater_windlight_options.xml | 2 +- .../skins/default/xui/tr/menu_gesture_gear.xml | 2 +- .../skins/default/xui/tr/menu_hide_navbar.xml | 4 +- .../newview/skins/default/xui/tr/menu_landmark.xml | 4 +- .../skins/default/xui/tr/menu_picks_plus.xml | 2 +- indra/newview/skins/default/xui/tr/menu_place.xml | 2 +- .../default/xui/tr/menu_places_gear_landmark.xml | 2 +- indra/newview/skins/default/xui/tr/menu_slurl.xml | 2 +- indra/newview/skins/default/xui/tr/menu_viewer.xml | 2 +- .../newview/skins/default/xui/tr/notifications.xml | 46 +++++------ .../skins/default/xui/tr/panel_edit_pick.xml | 4 +- .../skins/default/xui/tr/panel_landmarks.xml | 2 +- indra/newview/skins/default/xui/tr/panel_me.xml | 2 +- .../skins/default/xui/tr/panel_navigation_bar.xml | 4 +- .../skins/default/xui/tr/panel_outfit_edit.xml | 4 +- .../skins/default/xui/tr/panel_outfits_list.xml | 2 +- .../newview/skins/default/xui/tr/panel_people.xml | 2 +- indra/newview/skins/default/xui/tr/panel_picks.xml | 8 +- .../default/xui/tr/panel_preferences_privacy.xml | 2 +- .../skins/default/xui/tr/panel_profile_view.xml | 2 +- .../newview/skins/default/xui/tr/role_actions.xml | 8 +- .../skins/default/xui/tr/sidepanel_appearance.xml | 12 +-- indra/newview/skins/default/xui/tr/strings.xml | 20 ++--- .../default/xui/zh/floater_day_cycle_options.xml | 95 ---------------------- 33 files changed, 92 insertions(+), 377 deletions(-) delete mode 100644 indra/newview/skins/default/xui/ru/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/tr/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_day_cycle_options.xml diff --git a/indra/newview/skins/default/xui/ru/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/ru/floater_day_cycle_options.xml deleted file mode 100644 index 7c702f246d..0000000000 --- a/indra/newview/skins/default/xui/ru/floater_day_cycle_options.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - 00:00 - - - 03:00 - - - 06:00 - - - 09:00 - - - 12:00 - - - 15:00 - - - 18:00 - - - 21:00 - - - 00:00 - - - | - - - I - - - | - - - I - - - | - - - I - - - | - - - I - - - | - - - + diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml index b75307b67b..a268c103a6 100644 --- a/indra/newview/skins/default/xui/tr/notifications.xml +++ b/indra/newview/skins/default/xui/tr/notifications.xml @@ -189,7 +189,7 @@ Bu Yetenek '[ROLE_NAME]' rolüne eklensin mi? - Bu gruba katılmanın maliyeti: [COST] L$. + Bu gruba katılmanın maliyeti: L$ [COST]. Devam etmek istiyor musunuz? @@ -199,33 +199,33 @@ Devam etmek istiyor musunuz? - Bu gruba katılmanın maliyeti: [COST] L$. + Bu gruba katılmanın maliyeti: L$ [COST]. Bu gruba katılmak için yeterli L$'na sahip deÄŸilsiniz. - Bu grubu oluÅŸturmanın maliyeti: 100 L$. + Bu grubu oluÅŸturmanın maliyeti: L$ 100. Grupların birden fazla üyeye sahip olması gereklidir, aksi takdirde grup kalıcı olarak silinir. Lütfen 48 saat içinde diÄŸer üyeleri davet edin. - + - [COST] L$ ödeyerek ('[PARCEL_NAME]') arazisine [TIME] saat süreyle girebilirsiniz. GiriÅŸ hakkı satın almak istiyor musunuz? + L$ [COST] ödeyerek ('[PARCEL_NAME]') arazisine [TIME] saat süreyle girebilirsiniz. GiriÅŸ hakkı satın almak istiyor musunuz? - Herhangi birine satış yaparken satış fiyatı 0 L$'ndan daha yüksek bir deÄŸere ayarlanmalıdır. -0 L$ fiyatla satış yapıyorsanız lütfen satışın yapılacağı kiÅŸiyi seçin. + Herhangi birine satış yaparken satış fiyatı L$ 0'dan daha yüksek bir deÄŸere ayarlanmalıdır. +L$ 0 fiyatla satış yapıyorsanız lütfen satışın yapılacağı kiÅŸiyi seçin. Seçili [LAND_SIZE] m² arazi satışa çıkarılmak üzere ayarlanıyor. -Satış fiyatınız [SALE_PRICE] L$ olacak ve [NAME] için satışa açık olacaktır. +Satış fiyatınız L$ [SALE_PRICE] olacak ve [NAME] için satışa açık olacaktır. DÄ°KKAT: 'Herkes için satışa açık' seçeneÄŸinin tıklanması, arazinizi tüm [SECOND_LIFE] topluluÄŸuna açık hale getirir, bu bölgede bulunmayanlar da buna dahildir. Seçili [LAND_SIZE] m² arazi satışa çıkarılmak üzere ayarlanıyor. -Satış fiyatınız [SALE_PRICE] L$ olacak ve [NAME] için satışa açık olacaktır. +Satış fiyatınız L$ [SALE_PRICE] olacak ve [NAME] için satışa açık olacaktır. @@ -365,7 +365,7 @@ Devam etmek istediÄŸinize emin misiniz? - Favori <nolink>[PICK]</nolink> silinsin mi? + Seçme <nolink>[PICK]</nolink> silinsin mi? @@ -1008,7 +1008,7 @@ bu simdeki TÃœM ARAZÄ°LERDEN SÄ°LMEK istediÄŸinize emin misiniz? Ä°lanınız için bir ad belirtmelisiniz. - Listeleme için ödenmesi gereken tutar en az [MIN_PRICE] L$ olmalıdır. + Listeleme için ödenmesi gereken tutar en az L$ [MIN_PRICE] olmalıdır. Lütfen daha yüksek bir tutar girin. @@ -1586,7 +1586,7 @@ Lütfen daha sonra tekrar deneyin. [PICK] konumuna ışınlanılsın mı? - + [CLASSIFIED] konumuna ışınlanılsın mı? @@ -1766,7 +1766,7 @@ EriÅŸkinlik Seviyesi tercihinizi ÅŸimdi yükseltmek ve araziye girebilmek için Hatırla: Ä°lan ücretleri iade edilmez. -Åžimdi [AMOUNT] L$ ödeyerek bu ilanı yayınlamak istiyor musunuz? +Åžimdi L$ [AMOUNT] ödeyerek bu ilanı yayınlamak istiyor musunuz? @@ -1810,7 +1810,7 @@ Lütfen sadece bir nesne seçin ve tekrar deneyin. Lütfen sadece bir nesne seçin ve tekrar deneyin. - Özgün nesne [OWNER] kullanıcısından [PRICE] L$ karşılığında satın alınsın mı? + Özgün nesne [OWNER] kullanıcısından L$ [PRICE] karşılığında satın alınsın mı? Nesnenin sahibi siz olacaksınız. Åžu iÅŸlemleri yapabileceksiniz: DeÄŸiÅŸtirme: [MODIFYPERM] @@ -1819,7 +1819,7 @@ Nesnenin sahibi siz olacaksınız. - Özgün nesne PRICE] L$ karşılığında satın alınsın mı? + Özgün nesne L$ [PRICE] karşılığında satın alınsın mı? Nesnenin sahibi siz olacaksınız. Åžu iÅŸlemleri yapabileceksiniz: DeÄŸiÅŸtirme: [MODIFYPERM] @@ -1828,7 +1828,7 @@ Nesnenin sahibi siz olacaksınız. - Bir kopyası [OWNER] kullanıcısından [PRICE] L$ karşılığında satın alınsın mı? + Bir kopyası [OWNER] kullanıcısından L$ [PRICE] karşılığında satın alınsın mı? Nesne envanterinize kopyalanacak. Åžu iÅŸlemleri yapabileceksiniz: DeÄŸiÅŸtirme: [MODIFYPERM] @@ -1837,7 +1837,7 @@ Nesne envanterinize kopyalanacak. - Bir kopyası [PRICE] L$ karşılığında satın alınsın mı? + Bir kopyası L$ [PRICE] karşılığında satın alınsın mı? Nesne envanterinize kopyalanacak. Åžu iÅŸlemleri yapabileceksiniz: DeÄŸiÅŸtirme: [MODIFYPERM] @@ -1846,12 +1846,12 @@ Nesne envanterinize kopyalanacak. - İçerik [OWNER] kullanıcısından [PRICE] L$ karşılığında satın alınsın mı? + İçerik [OWNER] kullanıcısından L$ [PRICE] karşılığında satın alınsın mı? İçerik envanterinize kopyalanacak. - İçerik [PRICE] L$ karşılığında satın alınsın mı? + İçerik L$ [PRICE] karşılığında satın alınsın mı? İçerik envanterinize kopyalanacak. @@ -1875,7 +1875,7 @@ Lütfen parolanızı yeniden girin ve Tamam'ı tıklatın. Not: -Bu favorinin konumunu güncellediniz fakat diÄŸer detaylar özgün deÄŸerlerini koruyacak. +Bu seçmenin konumunu güncellediniz fakat diÄŸer detaylar özgün deÄŸerlerini koruyacak. @@ -2132,7 +2132,7 @@ Bu adımda web tarayıcınızın baÅŸlatılacağına dikkat edin. (Yaklaşık 5 dakika sürecektir.) - Karşıya yüklemek için [AMOUNT] L$ ödediniz. + Karşıya yüklemek için L$ [AMOUNT] ödediniz. Web sitesinde yer alan anlık görüntülerin karşıya yüklenmesi tamamlandı. @@ -2479,7 +2479,7 @@ Lütfen biraz sonra tekrar deneyin. [MESSAGE] - [MATURITY_STR] <icon>[MATURITY_ICON]</icon>
-
+ + diff --git a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml new file mode 100644 index 0000000000..84e3593798 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + ([QLVL]) + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml new file mode 100644 index 0000000000..7b148fa338 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml @@ -0,0 +1,146 @@ + + + + + Save to My Inventory + + + + Saving an image to your inventory costs L$[UPLOAD_COST]. To save your image as a texture select one of the square formats. + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml new file mode 100644 index 0000000000..4d6c4bcdfa --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml @@ -0,0 +1,194 @@ + + + + + Save to My Computer + + + + + + + + + + + + + + + + + + + + + + + ([QLVL]) + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml new file mode 100644 index 0000000000..792f6dbec8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -0,0 +1,148 @@ + + + + + + + + + Succeeded + + + + + Failed + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml new file mode 100644 index 0000000000..d8ff043444 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml @@ -0,0 +1,107 @@ + + + + Postcard from [SECOND_LIFE]. + + + Check this out! + + + Sending... + + + Postcard from [SECOND_LIFE]. + + + Check this out! + + + + Email + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml new file mode 100644 index 0000000000..0760a33f82 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml @@ -0,0 +1,165 @@ + + + + + Post to My Profile Feed + + + + + + + + + + + + + + Caption: + + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml new file mode 100644 index 0000000000..7a7a6e9a09 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml @@ -0,0 +1,19 @@ + + + + -- cgit v1.2.3 From 98755a62bb414f23919e003101153c20d3ab3f72 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 14 Nov 2011 15:39:32 -0800 Subject: EXP-1588 WIP Floaters do not snap to edge --- indra/llui/llfloater.cpp | 66 ++++++++++++++++++--------------------- indra/llui/llfloater.h | 1 + indra/newview/llurldispatcher.cpp | 4 +-- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 432397d3e9..05bd7fb67f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -58,6 +58,8 @@ #include "llhelp.h" #include "llmultifloater.h" #include "llsdutil.h" +#include + // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; @@ -2163,8 +2165,15 @@ LLFloaterView::LLFloaterView (const Params& p) // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 old_width = getRect().getWidth(); - S32 old_height = getRect().getHeight(); + S32 old_right = mLastSnapRect.mRight; + S32 old_top = mLastSnapRect.mTop; + + LLView::reshape(width, height, called_from_parent); + + S32 new_right = getSnapRect().mRight; + S32 new_top = getSnapRect().mTop; + + mLastSnapRect = getSnapRect(); for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { @@ -2179,59 +2188,40 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) // Make if follow the edge it is closest to U32 follow_flags = 0x0; - if (floaterp->isMinimized()) - { - follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP); - } - else + if (!floaterp->isMinimized()) { LLRect r = floaterp->getRect(); // Compute absolute distance from each edge of screen S32 left_offset = llabs(r.mLeft - 0); - S32 right_offset = llabs(old_width - r.mRight); + S32 right_offset = llabs(old_right - r.mRight); - S32 top_offset = llabs(old_height - r.mTop); + S32 top_offset = llabs(old_top - r.mTop); S32 bottom_offset = llabs(r.mBottom - 0); + S32 translate_x = 0; + S32 translate_y = 0; - if (left_offset < right_offset) - { - follow_flags |= FOLLOWS_LEFT; - } - else + if (left_offset > right_offset) { - follow_flags |= FOLLOWS_RIGHT; + translate_x = new_right - old_right; } - // "No vertical adjustment" usually means that the bottom of the view - // has been pushed up or down. Hence we want the floaters to follow - // the top. if (top_offset < bottom_offset) { - follow_flags |= FOLLOWS_TOP; - } - else - { - follow_flags |= FOLLOWS_BOTTOM; + translate_y = new_top - old_top; } - } - floaterp->setFollows(follow_flags); - - //RN: all dependent floaters copy follow behavior of "parent" - for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin(); - dependent_it != floaterp->mDependents.end(); ++dependent_it) - { - LLFloater* dependent_floaterp = dependent_it->get(); - if (dependent_floaterp) + floaterp->translate(translate_x, translate_y); + BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { - dependent_floaterp->setFollows(follow_flags); + if (dependent_floater.get()) + { + dependent_floater.get()->translate(translate_x, translate_y); + } } } } - - LLView::reshape(width, height, called_from_parent); } @@ -2631,6 +2621,12 @@ void LLFloaterView::shiftFloaters(S32 x_offset, S32 y_offset) void LLFloaterView::refresh() { + LLRect snap_rect = getSnapRect(); + if (snap_rect != mLastSnapRect) + { + reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + } + // Constrain children to be entirely on the screen for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 73e9c9e831..4e8c539144 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -537,6 +537,7 @@ public: private: void hiddenFloaterClosed(LLFloater* floater); + LLRect mLastSnapRect; LLHandle mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index f6d7ceeec3..4240a38326 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -167,9 +167,9 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, // static bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string& nav_type, bool right_mouse) { - if(slurl.getType() != LLSLURL::LOCATION) + if(slurl.getType() != LLSLURL::LOCATION) { - return false; + return false; } // Before we're logged in, need to update the startup screen // to tell the user where they are going. -- cgit v1.2.3 From 28db67c3952f65d9c3ee23ce85851ba8ab29fc50 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 14 Nov 2011 17:16:34 -0800 Subject: Removed unused variable to fix the mac build --- indra/llui/llfloater.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 05bd7fb67f..c5d7d1db56 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2185,9 +2185,6 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) continue; } - // Make if follow the edge it is closest to - U32 follow_flags = 0x0; - if (!floaterp->isMinimized()) { LLRect r = floaterp->getRect(); -- cgit v1.2.3 From 59a7cc2e0fdba593c6bd444d01ff5ac0bd2fc9cd Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 15 Nov 2011 20:07:58 +0200 Subject: EXP-1590 FIXED Success / Failure message now appears on top, overlaying the preview image. --- indra/newview/llfloatersnapshot.cpp | 46 +++++++++++++--- indra/newview/llfloatersnapshot.h | 1 + .../skins/default/xui/en/floater_snapshot.xml | 64 ++++++++++++++++++++++ .../default/xui/en/panel_snapshot_options.xml | 64 ---------------------- 4 files changed, 103 insertions(+), 72 deletions(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 8e346d3e7a..d0d681132b 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1543,6 +1543,7 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; if (previewp && view) { + view->impl.setStatus(Impl::STATUS_READY); previewp->updateSnapshot(TRUE); } } @@ -1568,6 +1569,7 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data) LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; if (view) { + view->impl.setStatus(Impl::STATUS_READY); gSavedSettings.setBOOL("AdvanceSnapshot", !visible); #if 0 view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); @@ -1709,6 +1711,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde return ; } +// Show/hide upload progress indicators. // static void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool working) { @@ -1724,7 +1727,7 @@ void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool workin working_lbl->setValue(progress_text); } - // All controls should be disable while posting. + // All controls should be disabled while posting. floater->setCtrlsEnabled(!working); LLPanelSnapshot* active_panel = getActivePanel(floater); if (active_panel) @@ -1733,11 +1736,12 @@ void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool workin } } +// Show/hide upload status message. // static void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finished, bool ok, const std::string& msg) { - floater->getChild("succeeded_panel")->setVisible(finished && ok); - floater->getChild("failed_panel")->setVisible(finished && !ok); + floater->mSucceessLblPanel->setVisible(finished && ok); + floater->mFailureLblPanel->setVisible(finished && !ok); if (finished) { @@ -2163,6 +2167,8 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key) : LLFloater(key), mRefreshBtn(NULL), mRefreshLabel(NULL), + mSucceessLblPanel(NULL), + mFailureLblPanel(NULL), impl (*(new Impl)) { } @@ -2199,6 +2205,8 @@ BOOL LLFloaterSnapshot::postBuild() mRefreshBtn = getChild("new_snapshot_btn"); childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); mRefreshLabel = getChild("refresh_lbl"); + mSucceessLblPanel = getChild("succeeded_panel"); + mFailureLblPanel = getChild("failed_panel"); childSetAction("advanced_options_btn", Impl::onClickMore, this); @@ -2279,15 +2287,23 @@ void LLFloaterSnapshot::draw() { bool working = impl.getStatus() == Impl::STATUS_WORKING; const LLRect& thumbnail_rect = getThumbnailPlaceholderRect(); - S32 offset_x = thumbnail_rect.mLeft + (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 ; - S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; + const S32 thumbnail_w = previewp->getThumbnailWidth(); + const S32 thumbnail_h = previewp->getThumbnailHeight(); + + // calc preview offset within the preview rect + const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect + + // calc preview offset within the floater rect + S32 offset_x = thumbnail_rect.mLeft + local_offset_x; + S32 offset_y = thumbnail_rect.mBottom + local_offset_y; glMatrixMode(GL_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, - previewp->getThumbnailWidth(), previewp->getThumbnailHeight(), + thumbnail_w, thumbnail_h, previewp->getThumbnailImage(), color % alpha); previewp->drawPreviewRect(offset_x, offset_y) ; @@ -2296,8 +2312,19 @@ void LLFloaterSnapshot::draw() static const S32 PADDING = 5; static const S32 REFRESH_LBL_BG_HEIGHT = 32; + // Reshape and position the posting result message panels at the top of the thumbnail. + // Do this regardless of current posting status (finished or not) to avoid flicker + // when the result message is displayed for the first time. + // if (impl.getStatus() == Impl::STATUS_FINISHED) + { + LLRect result_lbl_rect = mSucceessLblPanel->getRect(); + result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_rect.getHeight()); + mSucceessLblPanel->setRect(result_lbl_rect); + mFailureLblPanel->setRect(result_lbl_rect); + } + // Position the refresh button in the bottom left corner of the thumbnail. - mRefreshBtn->setOrigin(offset_x + PADDING - thumbnail_rect.mLeft, offset_y + PADDING - thumbnail_rect.mBottom); + mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING); if (impl.mNeedRefresh) { @@ -2306,7 +2333,7 @@ void LLFloaterSnapshot::draw() mRefreshLabel->setOrigin(refresh_btn_rect.mLeft + refresh_btn_rect.getWidth() + PADDING, refresh_btn_rect.mBottom); // Draw the refresh hint background. - LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + previewp->getThumbnailWidth() - 1, offset_y); + LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + thumbnail_w - 1, offset_y); gl_rect_2d(refresh_label_bg_rect, LLColor4::white % 0.9f, TRUE); } @@ -2520,6 +2547,9 @@ void LLFloaterSnapshot::postPanelSwitch() { LLFloaterSnapshot* instance = getInstance(); instance->impl.updateControls(instance); + + // Remove the success/failure indicator whenever user presses a snapshot option button. + instance->impl.setStatus(Impl::STATUS_READY); } // static diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 7e5a08b1c6..48015ad4d7 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -72,6 +72,7 @@ public: private: static LLUICtrl* sThumbnailPlaceholder; LLUICtrl *mRefreshBtn, *mRefreshLabel; + LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; class Impl; Impl& impl; diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 96c5c704af..7fd19d0f22 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -83,6 +83,70 @@ top="50" follows="left|top" left="10"> + + + Succeeded + + + + + Failed + + - - - Succeeded - - - - - Failed - - -- cgit v1.2.3 From 73d70b5d4562cf00f810446479918e64cbcb6008 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 15 Nov 2011 12:19:05 -0600 Subject: SH-2240 Make alpha mask cutoff a little less aggressive (err on the side of not creating an alpha mask) --- indra/llrender/llimagegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 7d73888151..789402c4a9 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1853,7 +1853,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h) upperhalftotal += sample[i]; } - if (midrangetotal > length/16 || // lots of midrange, or + if (midrangetotal > length/48 || // lots of midrange, or (lowerhalftotal == length && alphatotal != 0) || // all close to transparent but not all totally transparent, or (upperhalftotal == length && alphatotal != 255*length)) // all close to opaque but not all totally opaque { -- cgit v1.2.3 From 961ce1c4e785103b696a8ec76674aee4c91fe011 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 15 Nov 2011 12:24:31 -0600 Subject: SH-2591 WIP -- fix for UI disappearing, introduces some artifacts in rotation ring, committing to debug elsewhere --- indra/llui/llui.cpp | 2 ++ indra/newview/llmaniprotate.cpp | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index c6f7e28027..33bc247987 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -955,10 +955,12 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor if( render_center ) { gGL.color4fv(center_color.mV); + gGL.diffuseColor4fv(center_color.mV); gl_deep_circle( radius, width, steps ); } else { + gGL.diffuseColor4fv(side_color.mV); gl_washer_2d(radius, radius - width, steps, side_color, side_color); gGL.translateUI(0.f, 0.f, width); gl_washer_2d(radius - width, radius, steps, side_color, side_color); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 04dd2be583..a8da94f75e 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -53,6 +53,7 @@ #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerobject.h" +#include "llviewershadermgr.h" #include "llviewerwindow.h" #include "llworld.h" #include "pipeline.h" @@ -113,7 +114,7 @@ void LLManipRotate::handleSelect() void LLManipRotate::render() { LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); LLGLEnable gls_alpha_test(GL_ALPHA_TEST); @@ -147,6 +148,7 @@ void LLManipRotate::render() gGL.pushMatrix(); { + // are we in the middle of a constrained drag? if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z) { @@ -154,6 +156,11 @@ void LLManipRotate::render() } else { + if (LLGLSLShader::sNoFixedFunction) + { + gDebugProgram.bind(); + } + LLGLEnable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_FALSE); gGL.pushMatrix(); @@ -190,20 +197,27 @@ void LLManipRotate::render() { color.setVec( 0.7f, 0.7f, 0.7f, 0.6f ); } + gGL.diffuseColor4fv(color.mV); gl_washer_2d(mRadiusMeters + width_meters, mRadiusMeters, CIRCLE_STEPS, color, color); if (mManipPart == LL_NO_PART) { gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f ); + gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f); gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, TRUE ); } gGL.flush(); } gGL.popMatrix(); - } + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + } + gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] ); LLQuaternion rot; @@ -219,6 +233,11 @@ void LLManipRotate::render() gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); + if (LLGLSLShader::sNoFixedFunction) + { + gDebugProgram.bind(); + } + if (mManipPart == LL_ROT_Z) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); @@ -270,6 +289,7 @@ void LLManipRotate::render() // First pass: centers. Second pass: sides. for( S32 i=0; i<2; i++ ) { + gGL.pushMatrix(); { if (mHighlightedPart == LL_ROT_Z) @@ -286,7 +306,7 @@ void LLManipRotate::render() } } gGL.popMatrix(); - + gGL.pushMatrix(); { gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); @@ -328,11 +348,20 @@ void LLManipRotate::render() { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } + } + } + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + } gGL.popMatrix(); gGL.popMatrix(); + LLVector3 euler_angles; LLQuaternion object_rot = first_object->getRotationEdit(); -- cgit v1.2.3 From bbac7e9aecf433c1a84515ede954650bd76befbf Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 15 Nov 2011 13:01:23 -0600 Subject: SH-2681 Fix for shader compiler error on GLSL 1.30 and later --- indra/llrender/llshadermgr.cpp | 2 +- indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 947c4443d1..75c584daab 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -618,7 +618,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //backwards compatibility with legacy texture lookup syntax text[count++] = strdup("#define textureCube texture\n"); text[count++] = strdup("#define texture2DLod textureLod\n"); - text[count++] = strdup("#define shadow2D texture\n"); + text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n"); } //copy preprocessor definitions into buffer diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index fc19f15e02..5b207ab558 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -150,7 +150,7 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) stc.xyz /= stc.w; stc.z += spot_shadow_bias*scl; - float cs = shadow2D(shadowMap, stc.xyz); + float cs = shadow2D(shadowMap, stc.xyz).x; float shadow = cs; vec2 off = 1.5/proj_shadow_res; -- cgit v1.2.3 From b493b8cca491c4b7a76f4c98b34272970d3bb58b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 15 Nov 2011 13:56:00 -0600 Subject: SH-2652 Fix for linux compile error --- indra/newview/pipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index af96a042a1..c9e1b44b3f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6569,7 +6569,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { //perform DoF sampling at half-res (preserve alpha channel) mScreen.bindTarget(); - glViewport(0,0,mScreen.getWidth()*CameraDoFResScale, mScreen.getHeight()*CameraDoFResScale); + glViewport(0,0,(GLsizei) (mScreen.getWidth()*CameraDoFResScale), (GLsizei) (mScreen.getHeight()*CameraDoFResScale)); gGL.setColorMask(true, false); shader = &gDeferredPostProgram; -- cgit v1.2.3 From aa909a86cbc613f39cbc6eb395b01b7886171496 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Nov 2011 12:51:07 -0800 Subject: EXP-1561 FIX Preview image looks stretched --- indra/newview/llfloatersnapshot.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index d0d681132b..63fa93b1a1 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -380,7 +380,6 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail { mThumbnailUpToDate = FALSE ; } - setThumbnailImageSize(); } void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) @@ -723,25 +722,19 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) resetThumbnailImage() ; } - LLPointer raw = NULL ; - S32 w , h ; - w = get_lower_power_two(mThumbnailWidth, 512) * 2 ; - h = get_lower_power_two(mThumbnailHeight, 512) * 2 ; - + LLPointer raw = new LLImageRaw; + if(!gViewerWindow->thumbnailSnapshot(raw, + mThumbnailWidth, mThumbnailHeight, + gSavedSettings.getBOOL("RenderUIInSnapshot"), + FALSE, + mSnapshotBufferType) ) { - raw = new LLImageRaw ; - if(!gViewerWindow->thumbnailSnapshot(raw, - w, h, - gSavedSettings.getBOOL("RenderUIInSnapshot"), - FALSE, - mSnapshotBufferType) ) - { - raw = NULL ; - } + raw = NULL ; } if(raw) { + raw->expandToPowerOfTwo(); mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); mThumbnailUpToDate = TRUE ; } @@ -791,6 +784,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) } // time to produce a snapshot + previewp->setThumbnailImageSize(); lldebugs << "producing snapshot" << llendl; if (!previewp->mPreviewImage) -- cgit v1.2.3 From df221246c46b22663864d831bcc3488b707c247c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 16 Nov 2011 00:01:18 +0200 Subject: EXP-1589 FIXED Centered Post/Save/Send and Cancel buttons. --- indra/newview/skins/default/xui/en/panel_postcard_message.xml | 2 +- indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml | 2 +- indra/newview/skins/default/xui/en/panel_snapshot_local.xml | 2 +- indra/newview/skins/default/xui/en/panel_snapshot_profile.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_postcard_message.xml b/indra/newview/skins/default/xui/en/panel_postcard_message.xml index e9f322f590..6e346d8ecc 100644 --- a/indra/newview/skins/default/xui/en/panel_postcard_message.xml +++ b/indra/newview/skins/default/xui/en/panel_postcard_message.xml @@ -104,7 +104,7 @@ label="Cancel" layout="topleft" name="cancel_btn" - right="-10" + right="-32" top="350" width="100"> Date: Wed, 16 Nov 2011 00:40:23 +0200 Subject: EXP-1574 FIXED Decreased Snapshot floater height. --- indra/newview/skins/default/xui/en/floater_snapshot.xml | 4 ++-- indra/newview/skins/default/xui/en/panel_postcard_message.xml | 4 ++-- indra/newview/skins/default/xui/en/panel_snapshot_profile.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 7fd19d0f22..b8d368ec52 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -5,7 +5,7 @@ can_minimize="true" can_close="true" follows="left|top" - height="600" + height="500" layout="topleft" name="Snapshot" help_topic="snapshot" @@ -242,7 +242,7 @@ Date: Tue, 15 Nov 2011 15:04:27 -0800 Subject: WIP INTL-82 further LQA changes for Russian --- .../skins/default/xui/ru/floater_about_land.xml | 34 ++-- .../skins/default/xui/ru/floater_bulk_perms.xml | 2 +- .../skins/default/xui/ru/floater_buy_currency.xml | 2 +- .../skins/default/xui/ru/floater_color_picker.xml | 2 +- .../skins/default/xui/ru/floater_destinations.xml | 2 +- .../default/xui/ru/floater_edit_day_cycle.xml | 18 +-- .../default/xui/ru/floater_edit_sky_preset.xml | 8 +- .../default/xui/ru/floater_edit_water_preset.xml | 2 +- .../skins/default/xui/ru/floater_god_tools.xml | 4 +- .../skins/default/xui/ru/floater_image_preview.xml | 2 +- .../skins/default/xui/ru/floater_joystick.xml | 2 +- .../skins/default/xui/ru/floater_lagmeter.xml | 2 +- .../skins/default/xui/ru/floater_land_holdings.xml | 2 +- .../skins/default/xui/ru/floater_model_wizard.xml | 8 +- .../skins/default/xui/ru/floater_select_key.xml | 2 +- .../skins/default/xui/ru/floater_snapshot.xml | 2 +- .../newview/skins/default/xui/ru/floater_tools.xml | 46 +++--- .../skins/default/xui/ru/floater_toybox.xml | 2 +- .../default/xui/ru/floater_voice_controls.xml | 2 +- .../default/xui/ru/floater_windlight_options.xml | 2 +- .../skins/default/xui/ru/floater_world_map.xml | 4 +- .../skins/default/xui/ru/menu_attachment_other.xml | 2 +- .../skins/default/xui/ru/menu_gesture_gear.xml | 2 +- .../default/xui/ru/menu_inventory_gear_default.xml | 2 +- .../newview/skins/default/xui/ru/menu_landmark.xml | 2 +- .../xui/ru/menu_model_import_gear_default.xml | 2 +- .../skins/default/xui/ru/menu_participant_list.xml | 2 +- .../default/xui/ru/menu_places_gear_landmark.xml | 2 +- indra/newview/skins/default/xui/ru/menu_viewer.xml | 4 +- .../newview/skins/default/xui/ru/notifications.xml | 12 +- .../skins/default/xui/ru/panel_edit_alpha.xml | 4 +- .../skins/default/xui/ru/panel_edit_shape.xml | 2 +- .../default/xui/ru/panel_im_control_panel.xml | 2 +- .../skins/default/xui/ru/panel_landmarks.xml | 2 +- .../skins/default/xui/ru/panel_navigation_bar.xml | 2 +- indra/newview/skins/default/xui/ru/panel_notes.xml | 2 +- .../skins/default/xui/ru/panel_outfit_edit.xml | 4 +- .../newview/skins/default/xui/ru/panel_people.xml | 10 +- .../default/xui/ru/panel_preferences_move.xml | 6 +- .../newview/skins/default/xui/ru/panel_profile.xml | 4 +- .../skins/default/xui/ru/panel_region_estate.xml | 6 +- .../skins/default/xui/ru/panel_region_general.xml | 6 +- .../skins/default/xui/ru/panel_region_terrain.xml | 28 ++-- .../skins/default/xui/ru/panel_region_texture.xml | 24 +-- indra/newview/skins/default/xui/ru/strings.xml | 176 ++++++++++----------- 45 files changed, 229 insertions(+), 229 deletions(-) diff --git a/indra/newview/skins/default/xui/ru/floater_about_land.xml b/indra/newview/skins/default/xui/ru/floater_about_land.xml index 488d2cda17..3c278fce52 100644 --- a/indra/newview/skins/default/xui/ru/floater_about_land.xml +++ b/indra/newview/skins/default/xui/ru/floater_about_land.xml @@ -141,16 +141,16 @@ - ÐŸÑ€Ð¸Ð¾Ð±Ñ€ÐµÑ‚ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð¼Ð¾Ð¶ÐµÑ‚ быть перепродана. + ÐšÑƒÐ¿Ð»ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð¼Ð¾Ð¶ÐµÑ‚ быть перепродана. - ÐŸÑ€Ð¸Ð¾Ð±Ñ€ÐµÑ‚ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð½Ðµ может быть перепродана. + ÐšÑƒÐ¿Ð»ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð½Ðµ может быть перепродана. - ÐŸÑ€Ð¸Ð¾Ð±Ñ€ÐµÑ‚ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð¼Ð¾Ð¶ÐµÑ‚ быть объединена или разделена. + ÐšÑƒÐ¿Ð»ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð¼Ð¾Ð¶ÐµÑ‚ быть объединена или разделена. - ÐŸÑ€Ð¸Ð¾Ð±Ñ€ÐµÑ‚ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð½Ðµ может быть объединена или разделена. + ÐšÑƒÐ¿Ð»ÐµÐ½Ð½Ð°Ñ Ð² Ñтом регионе Ð·ÐµÐ¼Ð»Ñ Ð½Ðµ может быть объединена или разделена. Землевладение: @@ -270,7 +270,7 @@ - + @@ -286,10 +286,10 @@ Этот параметр недоÑтупен, потому что вы не можете изменÑÑ‚ÑŒ его на Ñтом учаÑтке. - Moderate-контент + Умеренный контент - Содержимое Ð´Ð»Ñ Ð²Ð·Ñ€Ð¾Ñлых + Контент Ð´Ð»Ñ Ð²Ð·Ñ€Ð¾Ñлых Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸Ð»Ð¸ Ñодержимое вашего учаÑтка раÑцениваетÑÑ ÐºÐ°Ðº moderate. @@ -366,7 +366,7 @@ - + Снимок: @@ -374,7 +374,7 @@ Позволить жителÑм Ñ Ð´Ñ€ÑƒÐ³Ð¸Ñ… учаÑтков: - + Ð’ точку телепортации: [LANDING] @@ -395,7 +395,7 @@ - ДомашнÑÑ Ñтраница: + Дом. Ñтраница:
@@ -203,7 +203,7 @@ - + diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml index 87ae9d06dd..d43d907164 100644 --- a/indra/newview/skins/default/xui/ru/notifications.xml +++ b/indra/newview/skins/default/xui/ru/notifications.xml @@ -724,13 +724,13 @@ Ð¢ÐµÐ»ÐµÐ¿Ð¾Ñ€Ñ‚Ð°Ñ†Ð¸Ñ ÑÐµÐ¹Ñ‡Ð°Ñ Ð·Ð°Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²Ð°Ð½Ð°. Повторите попытку позже. ЕÑли вÑе равно не удаетÑÑ Ñ‚ÐµÐ»ÐµÐ¿Ð¾Ñ€Ñ‚Ð¸Ñ€Ð¾Ð²Ð°Ñ‚ÑŒÑÑ, выйдите из программы и войдите Ñнова, чтобы уÑтранить проблему. - СиÑтеме не удалоÑÑŒ определить меÑто Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ¸. + СиÑтеме не удалоÑÑŒ определить пункт Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ¸. СиÑтеме не удалоÑÑŒ выполнить подключение телепорта. Повторите попытку позже. - У Ð²Ð°Ñ Ð½ÐµÑ‚ доÑтупа к точке Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñтого телепорта. + У Ð²Ð°Ñ Ð½ÐµÑ‚ доÑтупа в пункт Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñтого телепорта. Ваши приÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ ÐµÑ‰Ðµ не доÑтавлены. Подождите неÑколько Ñекунд либо выйдите из программы и войдите Ñнова, прежде чем повторить попытку телепортации. @@ -745,7 +745,7 @@ СиÑтеме не удалоÑÑŒ Ñвоевременно выполнить ваше переÑечение границы. Повторите попытку через неÑколько минут. - Ðе удалоÑÑŒ найти точку Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñ‚ÐµÐ»ÐµÐ¿Ð¾Ñ€Ñ‚Ð°. Возможно, меÑто Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð¾ недоÑтупно или уже не ÑущеÑтвует. Повторите попытку через неÑколько минут. + Ðе удалоÑÑŒ найти точку Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñ‚ÐµÐ»ÐµÐ¿Ð¾Ñ€Ñ‚Ð°. Возможно, пункт Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð¾ недоÑтупен или уже не ÑущеÑтвует. Повторите попытку через неÑколько минут. СиÑтема Ð¸Ð½Ð²ÐµÐ½Ñ‚Ð°Ñ€Ñ ÑÐµÐ¹Ñ‡Ð°Ñ Ð½ÐµÐ´Ð¾Ñтупна. @@ -2381,7 +2381,7 @@ http://secondlife.com/download. Ðе найден регион назначениÑ. - Вам не разрешен доÑтуп к меÑту назначениÑ. + Вам не разрешен доÑтуп в пункт назначениÑ. ÐÐµÐ»ÑŒÐ·Ñ Ð¿ÐµÑ€ÐµÑечь границу региона по пути на забаненный учаÑток. Выберите другой путь. @@ -2390,7 +2390,7 @@ http://secondlife.com/download. Ð’Ñ‹ перенаправлены на телехаб. - Ðе удалоÑÑŒ телепортироватьÑÑ Ð±Ð»Ð¸Ð¶Ðµ к меÑту назначениÑ. + Ðе удалоÑÑŒ телепортироватьÑÑ Ð±Ð»Ð¸Ð¶Ðµ к пункту назначениÑ. Ð¢ÐµÐ»ÐµÐ¿Ð¾Ñ€Ñ‚Ð°Ñ†Ð¸Ñ Ð¾Ñ‚Ð¼ÐµÐ½ÐµÐ½Ð°. @@ -2904,7 +2904,7 @@ http://secondlife.com/download. При Ñкрытии кнопки «Говорить» голоÑÐ¾Ð²Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð¾Ñ‚ÐºÐ»ÑŽÑ‡Ð°ÐµÑ‚ÑÑ. - Путеводитель по меÑтам Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñодержит Ñ‚Ñ‹ÑÑчи новых меÑÑ‚, в которых вы можете побывать. Выберите меÑто и нажмите кнопку «ТелепортациÑ», чтобы начать иÑÑледование. + Путеводитель по пунктам Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñодержит Ñ‚Ñ‹ÑÑчи новых меÑÑ‚, в которых вы можете побывать. Выберите меÑто и нажмите кнопку «ТелепортациÑ», чтобы начать иÑÑледование. БыÑтрый доÑтуп к вашему инвентарю, коÑтюмам, профилю и многому другому открываетÑÑ Ð½Ð° боковой панели. diff --git a/indra/newview/skins/default/xui/ru/panel_edit_alpha.xml b/indra/newview/skins/default/xui/ru/panel_edit_alpha.xml index 38789c1c5e..7cde4099ef 100644 --- a/indra/newview/skins/default/xui/ru/panel_edit_alpha.xml +++ b/indra/newview/skins/default/xui/ru/panel_edit_alpha.xml @@ -2,8 +2,8 @@ - - + + diff --git a/indra/newview/skins/default/xui/ru/panel_edit_shape.xml b/indra/newview/skins/default/xui/ru/panel_edit_shape.xml index b185ce1d45..312ad593a1 100644 --- a/indra/newview/skins/default/xui/ru/panel_edit_shape.xml +++ b/indra/newview/skins/default/xui/ru/panel_edit_shape.xml @@ -1,7 +1,7 @@ - метров + м футов diff --git a/indra/newview/skins/default/xui/ru/panel_im_control_panel.xml b/indra/newview/skins/default/xui/ru/panel_im_control_panel.xml index f1cba0d3be..2a23cdb800 100644 --- a/indra/newview/skins/default/xui/ru/panel_im_control_panel.xml +++ b/indra/newview/skins/default/xui/ru/panel_im_control_panel.xml @@ -17,7 +17,7 @@ diff --git a/indra/newview/skins/default/xui/en/floater_translation_settings.xml b/indra/newview/skins/default/xui/en/floater_translation_settings.xml index c03f751265..a212ce7889 100644 --- a/indra/newview/skins/default/xui/en/floater_translation_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_translation_settings.xml @@ -4,7 +4,7 @@ height="310" layout="topleft" name="floater_translation_settings" - help_topic="environment_editor_floater" + help_topic="translation_settings" save_rect="true" title="CHAT TRANSLATION SETTINGS" width="485"> diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index 80e310a873..8ac1ac9e09 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -167,13 +167,6 @@ function="Floater.Show" parameter="message_critical" /> - - - diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml index 7384114d7d..fbe40a7244 100644 --- a/indra/newview/skins/default/xui/en/menu_toolbars.xml +++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml @@ -3,9 +3,15 @@ layout="topleft" name="Toolbars Popup" visible="false"> + + + + + name="Choose Buttons"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 9c44d90a6e..263d961be1 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -538,13 +538,13 @@ + label="Environment Settings..." + name="Environment Settings"> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ed8c30ca8..e4458f33b1 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4636,7 +4636,21 @@ Are you sure you want to quit? name="ConfirmRestoreToybox" type="alertmodal"> -Are you sure you want to restore your default buttons and toolbars? +This action will restore your default buttons and toolbars. + +You cannot undo this action. + + + + + +This action will return all buttons to the toolbox and your toolbars will be empty. You cannot undo this action. - + + width="75" > diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 3835cd17b6..6521bf2a4e 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -22,17 +22,17 @@ top="600" + trusted_content="true" + bg_opaque_color="Black" + border_visible="false" + bottom="600" + follows="all" + left="0" + name="login_html" + start_url="" + top="0" + height="600" + width="980"/> Wrap Preview Normal + + + Very Low + Low + Medium + High + Very High + diff --git a/indra/newview/skins/default/xui/en/teleport_strings.xml b/indra/newview/skins/default/xui/en/teleport_strings.xml index bae821d3b5..dce6b8dd6d 100644 --- a/indra/newview/skins/default/xui/en/teleport_strings.xml +++ b/indra/newview/skins/default/xui/en/teleport_strings.xml @@ -19,6 +19,10 @@ If you still cannot teleport, please log out and log back in to resolve the prob Sorry, but system was unable to complete the teleport connection. Try again in a moment. + + +You cannot teleport back to Welcome Island. +Go to 'Welcome Island Public' to repeat the tutorial. Sorry, you do not have access to that teleport destination. diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml index 413ca1d1ef..0e29ed0d0b 100644 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml +++ b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml @@ -12,13 +12,20 @@ tab_stop="false" width="25" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + bottom="1" + name="speaker" + visible="false" + width="20" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + bottom="1" + name="speaker" + visible="false" + width="20" /> + image_mute="Parcel_VoiceNo_Light" + image_off="VoicePTT_Off_Dark" + image_on="VoicePTT_On_Dark" + image_level_1="VoicePTT_Lvl1_Dark" + image_level_2="VoicePTT_Lvl2_Dark" + image_level_3="VoicePTT_Lvl3_Dark" + auto_update="true" + draw_border="false" + height="24" + left="25" + bottom="1" + name="speaker" + visible="false" + width="20" /> - + diff --git a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml index 95ce14c9a7..5a852a6711 100644 --- a/indra/newview/skins/default/xui/es/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/es/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml index 4625075aa5..e822585566 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Usar en el chat el traductor automático de Google + Usar en el chat el traductor automático Traducir el chat al: diff --git a/indra/newview/skins/default/xui/es/teleport_strings.xml b/indra/newview/skins/default/xui/es/teleport_strings.xml index e0e0061729..e785a7ac40 100644 --- a/indra/newview/skins/default/xui/es/teleport_strings.xml +++ b/indra/newview/skins/default/xui/es/teleport_strings.xml @@ -18,6 +18,10 @@ Si sigues recibiendo este mensaje, por favor, acude al [SUPPORT_SITE]. Lo sentimos, pero el sistema no ha podido completar el teleporte. Vuelva a intentarlo en un momento. + + + No puede teleportarse de vuelta a la Welcome Island ('Isla de Ayuda'). +Vaya a la 'Welcome Island Public' ('Isla Pública de Ayuda') para repetir el tutorial. Lo sentimos, pero no tienes acceso al destino de este teleporte. diff --git a/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml b/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml index 9b1b21c434..8bbd34baae 100644 --- a/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/fr/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml index 98eddf196b..31cb3308e3 100644 --- a/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/fr/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml index 646f53704c..fa026d8106 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Utiliser la traduction automatique lors des chats (fournie par Google) + Utiliser la traduction automatique lors des chats Traduire le chat en : diff --git a/indra/newview/skins/default/xui/fr/teleport_strings.xml b/indra/newview/skins/default/xui/fr/teleport_strings.xml index 7c291c0984..401b272c81 100644 --- a/indra/newview/skins/default/xui/fr/teleport_strings.xml +++ b/indra/newview/skins/default/xui/fr/teleport_strings.xml @@ -19,6 +19,10 @@ Si vous ne parvenez toujours pas à être téléporté, déconnectez-vous puis r Désolé, la connexion vers votre lieu de téléportation n'a pas abouti. Veuillez réessayer dans un moment. + + + Vous ne pouvez pas retourner sur Welcome Island. +Pour répéter le didacticiel, veuillez aller sur Welcome Island Public. Désolé, vous n'avez pas accès à cette destination. diff --git a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml index 4c41df8a62..9e81899880 100644 --- a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml index 7afc3cd7e7..1b529e2737 100644 --- a/indra/newview/skins/default/xui/it/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/it/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml index 72e687b6d1..1a0a1d8434 100644 --- a/indra/newview/skins/default/xui/it/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/it/panel_preferences_chat.xml @@ -29,9 +29,9 @@ - + - Usa la traduzione meccanica durante le chat (tecnologia Google) + Usa la traduzione meccanica durante le chat Traduci chat in: diff --git a/indra/newview/skins/default/xui/it/teleport_strings.xml b/indra/newview/skins/default/xui/it/teleport_strings.xml index 7a1046abd3..a0b324d8fb 100644 --- a/indra/newview/skins/default/xui/it/teleport_strings.xml +++ b/indra/newview/skins/default/xui/it/teleport_strings.xml @@ -18,6 +18,10 @@ Se si continua a visualizzare questo messaggio, consulta la pagina [SUPPORT_SITE Spiacenti, il sistema non riesce a completare il teletrasporto. Riprova tra un attimo. + + Non è possibile per te ritornare all'Welcome Island. +Vai alla 'Welcome Island Public' per ripetere il tutorial. + Spiacenti, ma non hai accesso nel luogo di destinazione richiesto. diff --git a/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml b/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml index a29c6a0630..bcddcc6907 100644 --- a/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ja/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml index 4334659557..aca055bb43 100644 --- a/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ja/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml index c8584ccaae..1502442a06 100644 --- a/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/ja/panel_preferences_chat.xml @@ -29,9 +29,9 @@ - + - ãƒãƒ£ãƒƒãƒˆä¸­ã«å†…容を機械翻訳ã™ã‚‹ï¼ˆGoogle翻訳) + ãƒãƒ£ãƒƒãƒˆä¸­ã«å†…容を機械翻訳ã™ã‚‹ 翻訳ã™ã‚‹è¨€èªžï¼š diff --git a/indra/newview/skins/default/xui/ja/teleport_strings.xml b/indra/newview/skins/default/xui/ja/teleport_strings.xml index 2f67d43707..04ea1c2438 100644 --- a/indra/newview/skins/default/xui/ja/teleport_strings.xml +++ b/indra/newview/skins/default/xui/ja/teleport_strings.xml @@ -19,6 +19,10 @@ 申ã—訳ã”ã–ã„ã¾ã›ã‚“ãŒã€ã‚·ã‚¹ãƒ†ãƒ ã¯ãƒ†ãƒ¬ãƒãƒ¼ãƒˆã®æŽ¥ç¶šã‚’完了ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ ã‚‚ã†å°‘ã—後ã§ã‚„ã‚Šç›´ã—ã¦ãã ã•ã„。 + + + Welcome Islandã«ã¯æˆ»ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“。 +「Welcome Island Publicã€ã«è¡Œã〠残念ãªãŒã‚‰ã€ãã®ãƒ†ãƒ¬ãƒãƒ¼ãƒˆç›®çš„地ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒã‚ã‚Šã¾ã›ã‚“。 diff --git a/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml b/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml index 7dc3e1f22e..214d465f1c 100644 --- a/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pl/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml index be730eb73f..7fd1029e6a 100644 --- a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Użyj translatora podczas rozmowy (wspierany przez Google) + Użyj translatora podczas rozmowy PrzetÅ‚umacz czat na: diff --git a/indra/newview/skins/default/xui/pl/teleport_strings.xml b/indra/newview/skins/default/xui/pl/teleport_strings.xml index 57fb55bf4c..0366c3fdbc 100644 --- a/indra/newview/skins/default/xui/pl/teleport_strings.xml +++ b/indra/newview/skins/default/xui/pl/teleport_strings.xml @@ -19,6 +19,10 @@ JeÅ›li nadal nie możesz siÄ™ teleportować wyloguj siÄ™ i ponownie zaloguj. Przepraszamy, ale nie udaÅ‚o siÄ™ przeprowadzić teleportacji. Spróbuj jeszcze raz. + + Brak możliwoÅ›ci ponownej teleportacji do Welcome Island. +Odwiedź 'Welcome Island Public' by powtórzyć szkolenie. + Przepraszamy, ale nie masz dostÄ™pu do miejsca docelowego. diff --git a/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml b/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml index 60edfa505f..653861f7d8 100644 --- a/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pt/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml index 9d44c7f62d..15470dc94a 100644 --- a/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/pt/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml index e5aa42aae0..f98659aa73 100644 --- a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml @@ -31,7 +31,7 @@ - Traduzir bate-papo automaticamente (via Google) + Traduzir bate-papo automaticamente Traduzir bate-papo para: diff --git a/indra/newview/skins/default/xui/pt/teleport_strings.xml b/indra/newview/skins/default/xui/pt/teleport_strings.xml index 11ea0f4195..f8ded1ce69 100644 --- a/indra/newview/skins/default/xui/pt/teleport_strings.xml +++ b/indra/newview/skins/default/xui/pt/teleport_strings.xml @@ -18,6 +18,10 @@ Se você continuar a receber esta mensagem, por favor consulte o [SUPPORT_SITE]. Desculpe, não foi possível para o sistema executar o teletransporte. Tente novamente dentro de alguns instantes. + + Você não pode se tele-transportar de volta à Ilha de Welcome. +Vá para a Ilha de Welcome Pública para repetir este tutorial. + Desculpe, você não tem acesso ao destino deste teletransporte. diff --git a/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml b/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml index fd3c9f3512..184c753e40 100644 --- a/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ru/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml index a371040b74..1d26eecf87 100644 --- a/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/ru/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml index fa08c134ad..a3ee5b7815 100644 --- a/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/ru/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - ИÑпользовать машинный перевод при общении (Ñ‚ÐµÑ…Ð½Ð¾Ð»Ð¾Ð³Ð¸Ñ Google) + ИÑпользовать машинный перевод при общении Переводить чат на: diff --git a/indra/newview/skins/default/xui/ru/teleport_strings.xml b/indra/newview/skins/default/xui/ru/teleport_strings.xml index 6a7a181046..296562e6f1 100644 --- a/indra/newview/skins/default/xui/ru/teleport_strings.xml +++ b/indra/newview/skins/default/xui/ru/teleport_strings.xml @@ -19,6 +19,10 @@ СиÑтеме не удалоÑÑŒ выполнить подключение телепорта. Повторите попытку позже. + + + Ð’Ñ‹ не можете телепортироватьÑÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð¾ на ОÑтров Помощи. +ТелепортируйтеÑÑŒ на ОбщеÑтвенный ОÑтров Помощи, чтобы повторить обучение У Ð²Ð°Ñ Ð½ÐµÑ‚ доÑтупа к точке Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñтого телепорта. diff --git a/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml b/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml index 6570c4379c..6b12ad0ef5 100644 --- a/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/tr/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml index 73da726cb2..c405105e00 100644 --- a/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/tr/panel_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml index aeef737420..9c9e960715 100644 --- a/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/tr/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - Sohbet ederken makine çevirisi kullanılsın (Google tarafından desteklenir) + Sohbet ederken makine çevirisi kullanılsın Sohbeti ÅŸu dile çevir: diff --git a/indra/newview/skins/default/xui/tr/teleport_strings.xml b/indra/newview/skins/default/xui/tr/teleport_strings.xml index c0c4be1393..c506bb8a58 100644 --- a/indra/newview/skins/default/xui/tr/teleport_strings.xml +++ b/indra/newview/skins/default/xui/tr/teleport_strings.xml @@ -19,6 +19,10 @@ Hala ışınlanamıyorsanız, sorunu çözmek için lütfen çıkış yapıp otu Ãœzgünüz fakat sistem ışınlama baÄŸlantısını tamamlayamadı. Bir dakika sonra tekrar deneyin. + + +You cannot teleport back to Welcome Island. +Go to 'Welcome Island Public' to repeat the tutorial. Ãœzgünüz, bu ışınlanma hedef konumuna eriÅŸim hakkına sahip deÄŸilsiniz. diff --git a/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml b/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml index f0c34acb06..38a5dab523 100644 --- a/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/zh/floater_nearby_chat.xml @@ -1,4 +1,4 @@ - + diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml b/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml index fc326c2ce2..738c77fd08 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_chat.xml @@ -30,7 +30,7 @@ - èŠå¤©æ™‚使用機器自動進行翻譯(由 Google 所æ供) + èŠå¤©æ™‚使用機器自動進行翻譯 èŠå¤©ç¿»è­¯ç‚ºï¼š diff --git a/indra/newview/skins/default/xui/zh/teleport_strings.xml b/indra/newview/skins/default/xui/zh/teleport_strings.xml index ffb4c903bb..bfdb107810 100644 --- a/indra/newview/skins/default/xui/zh/teleport_strings.xml +++ b/indra/newview/skins/default/xui/zh/teleport_strings.xml @@ -19,6 +19,10 @@ 抱歉,ä¸éŽç³»çµ±ç„¡æ³•å®Œæˆçž¬é–“傳é€çš„è¯æŽ¥ã€‚ è«‹ç¨å¾Œå†è©¦ã€‚ + + + 您ä¸èƒ½çž¬é—´è½¬ç§»å›žâ€œæ´åŠ©å²›â€ã€‚ +去“公共æ´åŠ©å²›â€é‡å¤æ‚¨çš„教程。 抱歉,你並沒有權é™é€²å…¥è¦çž¬é–“傳é€çš„目的地。 -- cgit v1.2.3 From 30beda590a93aca9b2a27edb9be94665290c2e7c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Nov 2011 16:40:31 -0800 Subject: EXP-1588 FIX Floaters do not snap to edge made non-movable floaters not use auto-follow logic toasts will now use own layout logic --- indra/llui/llfloater.cpp | 14 ++++++++++++-- indra/llui/llfloater.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c5d7d1db56..a5fd3ea552 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1951,6 +1951,12 @@ void LLFloater::setCanDrag(BOOL can_drag) } } +bool LLFloater::getCanDrag() +{ + return mDragHandle->getEnabled(); +} + + void LLFloater::updateTitleButtons() { static LLUICachedControl floater_close_box_size ("UIFloaterCloseBoxSize", 0); @@ -2181,7 +2187,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) LLFloater* floaterp = (LLFloater*)viewp; if (floaterp->isDependent()) { - // dependents use same follow flags as their "dependee" + // dependents are moved with their "dependee" continue; } @@ -2209,7 +2215,11 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) translate_y = new_top - old_top; } - floaterp->translate(translate_x, translate_y); + // don't reposition immovable floaters + if (floaterp->getCanDrag()) + { + floaterp->translate(translate_x, translate_y); + } BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { if (dependent_floater.get()) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4e8c539144..8886ae3393 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -234,6 +234,7 @@ public: void setCanTearOff(BOOL can_tear_off); virtual void setCanResize(BOOL can_resize); void setCanDrag(BOOL can_drag); + bool getCanDrag(); void setHost(LLMultiFloater* host); BOOL isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); -- cgit v1.2.3 From d71736f3d92f1a276d4aafcbf70c6a8597457220 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 15 Nov 2011 17:32:09 -0800 Subject: SH-1865 PROGRESS -- Disable the anti-aliasing control on hardware our code doesn't support for anti-aliasing --- indra/llui/llspinctrl.h | 3 ++ indra/newview/llfloaterhardwaresettings.cpp | 38 ++++++++++++++++++---- indra/newview/pipeline.cpp | 4 ++- .../default/xui/en/floater_hardware_settings.xml | 2 +- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index d197084e38..87814f838e 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -96,6 +96,9 @@ public: void onUpBtn(const LLSD& data); void onDownBtn(const LLSD& data); + + const LLColor4& getEnabledTextColor() const { return mTextEnabledColor.get(); } + const LLColor4& getDisabledTextColor() const { return mTextDisabledColor.get(); } private: void updateLabelColor(); diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 42ec7d765b..f9a403cf9f 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -34,7 +34,9 @@ #include "llviewercontrol.h" #include "llviewertexturelist.h" #include "llfeaturemanager.h" +#include "llspinctrl.h" #include "llstartup.h" +#include "lltextbox.h" #include "pipeline.h" // Linden library includes @@ -98,18 +100,40 @@ void LLFloaterHardwareSettings::refreshEnabledState() } // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - getChildView("gamma")->setEnabled(!gPipeline.canUseWindLightShaders()); + LLSpinCtrl* gamma_ctrl = getChild("gamma"); + gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("fsaa")->setEnabled(gPipeline.canUseAntiAliasing()); - getChildView("antialiasing restart")->setVisible(!gSavedSettings.getBOOL("RenderDeferred")); - /* Enable to reset fsaa value to disabled when feature is not available. - if (!gPipeline.canUseAntiAliasing()) + // anti-aliasing { - getChild("fsaa")->setValue((LLSD::Integer) 0); + LLUICtrl* fsaa_ctrl = getChild("fsaa"); + LLTextBox* fsaa_text = getChild("antialiasing label"); + LLView* fsaa_restart = getChildView("antialiasing restart"); + + // Enable or disable the control, the "Antialiasing:" label and the restart warning + // based on code support for the feature on the current hardware. + + if (gPipeline.canUseAntiAliasing()) + { + fsaa_ctrl->setEnabled(TRUE); + + // borrow the text color from the gamma control for consistency + fsaa_text->setColor(gamma_ctrl->getEnabledTextColor()); + + fsaa_restart->setVisible(!gSavedSettings.getBOOL("RenderDeferred")); + } + else + { + fsaa_ctrl->setEnabled(FALSE); + fsaa_ctrl->setValue((LLSD::Integer) 0); + + // borrow the text color from the gamma control for consistency + fsaa_text->setColor(gamma_ctrl->getDisabledTextColor()); + + fsaa_restart->setVisible(FALSE); + } } - */ } //============================================================================ diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c9e1b44b3f..230bf0e9fd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1165,7 +1165,9 @@ BOOL LLPipeline::canUseWindLightShadersOnObjects() const BOOL LLPipeline::canUseAntiAliasing() const { - return TRUE; + // We can use anti-aliasing if the GL manager can support some multisampling + BOOL can_fsaa = (gGLManager.getNumFBOFSAASamples(2) > 1); + return can_fsaa; } void LLPipeline::unloadShaders() diff --git a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml index 05f4c52b95..66bb9d3cea 100644 --- a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml @@ -35,7 +35,7 @@ height="12" layout="topleft" left="10" - name="Antialiasing:" + name="antialiasing label" top_pad="7" width="188"> Antialiasing: -- cgit v1.2.3 From 557a64f8076666be767eea7567e3375aa71aa1e4 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 16 Nov 2011 18:03:49 +0200 Subject: EXP-1560 FIXED Removed misleading "Constrain proportions" checkbox from the "Save to My Inventory" panel. --- indra/newview/llpanelsnapshotinventory.cpp | 7 ++++--- indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 63ccbc1b02..aca0ee6700 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -70,6 +70,7 @@ LLPanelSnapshotInventory::LLPanelSnapshotInventory() // virtual BOOL LLPanelSnapshotInventory::postBuild() { + getChild(getAspectRatioCBName())->setVisible(FALSE); // we don't keep aspect ratio for inventory textures return LLPanelSnapshot::postBuild(); } @@ -89,10 +90,10 @@ void LLPanelSnapshotInventory::updateCustomResControls() getChild(getWidthSpinnerName())->setVisible(show); getChild(getHeightSpinnerName())->setVisible(show); - getChild(getAspectRatioCBName())->setVisible(show); - // enable controls if possible - LLPanelSnapshot::updateCustomResControls(); + // Editing gets often enable elsewhere in common snapshot panel code. Override that. + getChild(getWidthSpinnerName())->setAllowEdit(FALSE); + getChild(getHeightSpinnerName())->setAllowEdit(FALSE); } // virtual diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml index 662cd5c3bc..9057ebb65e 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml @@ -118,7 +118,8 @@ label="Constrain proportions" layout="topleft" left="10" - name="inventory_keep_aspect_check" /> + name="inventory_keep_aspect_check" + visible="false" /> - + + + -- cgit v1.2.3 From 6343c769ce402c31ae10944b5fef72fb70e6758a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 16 Nov 2011 10:00:41 -0800 Subject: SH-1865 FIX -- removed some old non-deferred rendering code that was preventing anti-aliasing from working when GL_ARB_texture_multisample is unsupported --- indra/llrender/llgl.cpp | 8 -------- indra/llrender/llgl.h | 1 - indra/newview/pipeline.cpp | 6 ++---- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 20ca189e7f..946e602fee 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -835,14 +835,6 @@ std::string LLGLManager::getRawGLString() return gl_string; } -U32 LLGLManager::getNumFBOFSAASamples(U32 samples) -{ - samples = llmin(samples, (U32) mMaxColorTextureSamples); - samples = llmin(samples, (U32) mMaxDepthTextureSamples); - samples = llmin(samples, (U32) 4); - return samples; -} - void LLGLManager::shutdownGL() { if (mInited) diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index dee7ec0739..6a147b8e19 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -150,7 +150,6 @@ public: void printGLInfoString(); void getGLInfo(LLSD& info); - U32 getNumFBOFSAASamples(U32 desired_samples = 32); // In ALL CAPS std::string mGLVendor; std::string mGLVendorShort; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 230bf0e9fd..5e9f0e3efe 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -658,7 +658,7 @@ void LLPipeline::allocatePhysicsBuffer() void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { refreshCachedSettings(); - U32 samples = gGLManager.getNumFBOFSAASamples(RenderFSAASamples); + U32 samples = RenderFSAASamples; //try to allocate screen buffers at requested resolution and samples // - on failure, shrink number of samples and try again @@ -1165,9 +1165,7 @@ BOOL LLPipeline::canUseWindLightShadersOnObjects() const BOOL LLPipeline::canUseAntiAliasing() const { - // We can use anti-aliasing if the GL manager can support some multisampling - BOOL can_fsaa = (gGLManager.getNumFBOFSAASamples(2) > 1); - return can_fsaa; + return TRUE; } void LLPipeline::unloadShaders() -- cgit v1.2.3 From bd0bd119c0bdae7e7d02014a5a843b927b9d226f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 16 Nov 2011 20:07:55 +0200 Subject: EXP-1594 FIXED Stop the upload progress indicator if inventory texture upoload fails. --- indra/newview/llassetuploadresponders.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 40a4d665f8..65bfc990d1 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -295,6 +295,11 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content) { // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); + LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot"); + if (floater_snapshot) + { + floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory"))); + } std::string reason = content["state"]; // deal with L$ errors -- cgit v1.2.3 From dbef1616dc22ba8623a53f7d4d4daeabaeafa78a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Nov 2011 12:40:51 -0600 Subject: SH-2240 Make alpha mask cutoff even less aggressive (fix for eyes on Curious Ringtail avatar) --- indra/llrender/llimagegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 789402c4a9..78591ddd38 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1838,7 +1838,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h) // this to be an intentional effect and don't treat as a mask. U32 midrangetotal = 0; - for (U32 i = 4; i < 11; i++) + for (U32 i = 2; i < 13; i++) { midrangetotal += sample[i]; } -- cgit v1.2.3 From f1719459d5ed2164fe56aa86c1a33ff5cd87ccb1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 16 Nov 2011 21:39:55 +0200 Subject: EXP-1597 FIXED Reshape save status messages correctly. --- indra/newview/llfloatersnapshot.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 5b26e93898..ad571451f3 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2306,8 +2306,11 @@ void LLFloaterSnapshot::draw() // if (impl.getStatus() == Impl::STATUS_FINISHED) { LLRect result_lbl_rect = mSucceessLblPanel->getRect(); - result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_rect.getHeight()); + const S32 result_lbl_h = result_lbl_rect.getHeight(); + result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_h); + mSucceessLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); mSucceessLblPanel->setRect(result_lbl_rect); + mFailureLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); mFailureLblPanel->setRect(result_lbl_rect); } -- cgit v1.2.3 From 2ee4bae1a39814467e4bd361211f7836266af880 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 16 Nov 2011 12:28:10 -0800 Subject: support for assignment of named values to params, works with string-typed params as well as () operator --- indra/llxuixml/llinitparam.h | 93 +++++++++++++++++++++++++++++++++++------- indra/llxuixml/llxuiparser.cpp | 4 +- 2 files changed, 80 insertions(+), 17 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index ec14bc2fdc..575e8231bd 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -572,7 +572,7 @@ namespace LLInitParam static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } }; - class Param + class Param { public: void setProvided(bool is_provided = true) @@ -580,6 +580,12 @@ namespace LLInitParam mIsProvided = is_provided; enclosingBlock().paramChanged(*this, is_provided); } + + Param& operator =(const Param& other) + { + setProvided(other.mIsProvided); + return *this; + } protected: bool anyProvided() const { return mIsProvided; } @@ -671,7 +677,7 @@ namespace LLInitParam self_t& operator =(const self_t& other) { mValue = other.mValue; - static_cast(*this) = other; + NAME_VALUE_LOOKUP::operator =(other); return *this; } @@ -742,8 +748,8 @@ namespace LLInitParam self_t& operator =(const self_t& other) { - static_cast(*this) = other; - static_cast(*this) = other; + T::operator = (other); + NAME_VALUE_LOOKUP::operator =(other); mValidatedVersion = other.mValidatedVersion; mValidated = other.mValidated; return *this; @@ -753,6 +759,54 @@ namespace LLInitParam mutable bool mValidated; // lazy validation flag }; + template + class ParamValue + : public NAME_VALUE_LOOKUP + { + public: + typedef const std::string& value_assignment_t; + typedef ParamValue self_t; + + ParamValue(): mValue() {} + ParamValue(value_assignment_t other) : mValue(other) {} + + void setValue(value_assignment_t val) + { + if (NAME_VALUE_LOOKUP::getValueFromName(val, mValue)) + { + setValueName(val); + } + else + { + mValue = val; + } + } + + value_assignment_t getValue() const + { + return mValue; + } + + std::string& getValue() + { + return mValue; + } + + operator value_assignment_t() const + { + return mValue; + } + + value_assignment_t operator()() const + { + return mValue; + } + + protected: + std::string mValue; + }; + + template > struct ParamIterator { @@ -776,6 +830,8 @@ namespace LLInitParam typedef NAME_VALUE_LOOKUP name_value_lookup_t; typedef ParamValue param_value_t; + using param_value_t::operator(); + TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr) { @@ -877,11 +933,6 @@ namespace LLInitParam } } - self_t& operator =(typename const name_value_lookup_t::name_t& name) - { - return static_cast(param_value_t::operator =(name)); - } - void set(value_assignment_t val, bool flag_as_provided = true) { param_value_t::clearValueName(); @@ -889,6 +940,11 @@ namespace LLInitParam setProvided(flag_as_provided); } + self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) + { + return static_cast(param_value_t::operator =(name)); + } + protected: static bool mergeWith(Param& dst, const Param& src, bool overwrite) { @@ -919,6 +975,8 @@ namespace LLInitParam typedef NAME_VALUE_LOOKUP name_value_lookup_t; typedef ParamValue param_value_t; + using param_value_t::operator(); + TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr), param_value_t(value) @@ -1023,6 +1081,11 @@ namespace LLInitParam setProvided(flag_as_provided); } + self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) + { + return static_cast(param_value_t::operator =(name)); + } + // propagate changed status up to enclosing block /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) { @@ -1189,7 +1252,9 @@ namespace LLInitParam void add(const value_t& item) { - mValues.push_back(param_value_t(item)); + param_value_t param_value; + param_value.setValue(item); + mValues.push_back(param_value); setProvided(); } @@ -1537,7 +1602,7 @@ namespace LLInitParam typedef TypedParam >::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; - using super_t::param_value_t::operator =; + using super_t::operator =; explicit Alternative(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), @@ -1656,8 +1721,8 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator(); - using super_t::param_value_t::operator =; - + using super_t::operator =; + explicit Optional(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) { @@ -1686,7 +1751,7 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator(); - using super_t::param_value_t::operator =; + using super_t::operator =; // mandatory parameters require a name to be parseable explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue()) diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index cdf578113a..90c2671242 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -61,8 +61,6 @@ const S32 LINE_NUMBER_HERE = 0; struct MaxOccursValues : public LLInitParam::TypeValuesHelper { - using TypeValuesHelper::operator =; - typedef std::string name_t; static void declareValues() { declare("unbounded", U32_MAX); @@ -73,11 +71,11 @@ struct Occurs : public LLInitParam::Block { Optional minOccurs; Optional maxOccurs; - Multiple foo; Occurs() : minOccurs("minOccurs", 0), maxOccurs("maxOccurs", U32_MAX) + {} }; -- cgit v1.2.3 From 986dccbeafa3fe0ddd9a05e0916a414e4abc51d6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Nov 2011 15:08:17 -0600 Subject: SH-2690 Fix for spammy triangle death on GeForce 7800 Go when selecting flexi attachments. --- indra/llrender/llrender.cpp | 11 +++++++++++ indra/newview/llselectmgr.cpp | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 97aeae548a..010d3df9b7 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1887,6 +1887,17 @@ void LLRender::flush() void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] + if (mCount > 2048) + { + switch (mMode) + { + case LLRender::POINTS: flush(); break; + case LLRender::TRIANGLES: if (mCount%3==0) flush(); break; + case LLRender::QUADS: if(mCount%4 == 0) flush(); break; + case LLRender::LINES: if (mCount%2 == 0) flush(); break; + } + } + if (mCount > 4094) { // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 830a7778ac..036e428415 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5713,6 +5713,14 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) return; } + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader) + { + gSolidColorProgram.bind(); + } + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.pushUIMatrix(); @@ -5835,6 +5843,11 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) } gGL.popMatrix(); gGL.popUIMatrix(); + + if (shader) + { + shader->bind(); + } } // -- cgit v1.2.3 From b2824aa21dc52aa4db5374fa3b8084e34a280747 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Nov 2011 15:25:09 -0600 Subject: SH-2690 Add comments per Vir's review feedback --- indra/llrender/llrender.cpp | 2 +- indra/newview/llselectmgr.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 010d3df9b7..812fa7024b 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1888,7 +1888,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] if (mCount > 2048) - { + { //break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below switch (mMode) { case LLRender::POINTS: flush(); break; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 036e428415..5d0d1ef9a3 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5717,7 +5717,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; if (shader) - { + { //switch to "solid color" program for SH-2690 -- works around driver bug causing bad triangles when rendering silhouettes gSolidColorProgram.bind(); } -- cgit v1.2.3 From e822ecc8035fe2624270c0c81ace9f74dcc8a8e1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Nov 2011 18:56:25 -0600 Subject: SH-2675 Fix for shadow appearing on terrain at midday when terrain is totally flat and there are no prims visible --- indra/newview/llvosurfacepatch.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 0108690538..c3a2e6a712 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -1035,6 +1035,8 @@ void LLVOSurfacePatch::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newM { LLVector3 posAgent = getPositionAgent(); LLVector3 scale = getScale(); + //make z-axis scale at least 1 to avoid shadow artifacts on totally flat land + scale.mV[VZ] = llmax(scale.mV[VZ], 1.f); newMin.load3( (posAgent-scale*0.5f).mV); // Changing to 2.f makes the culling a -little- better, but still wrong newMax.load3( (posAgent+scale*0.5f).mV); LLVector4a pos; -- cgit v1.2.3 From c79c4f1477cae232a033e33cc1722b4658cf6634 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 16 Nov 2011 17:14:28 -0800 Subject: SH-1618 FIX SH-1619 FIX SH-1620 FIX SH-2621 FIX * Got lighting, shadows, and ambient occlusion working on ATI macs. * Re-enabled ambient occlusion on ATI macs. * Re-enabled depth of field on ATI macs. Reviewed by Runitai Linden. --- .../shaders/class1/deferred/blurLightF.glsl | 24 ++++++++---- .../shaders/class2/deferred/sunLightSSAOF.glsl | 43 +++++++++++++--------- indra/newview/featuretable_mac.txt | 4 +- 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 7d3b546d3e..60d4dae99f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -44,6 +44,11 @@ VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; +vec3 getKern(int i) +{ + return kern[i]; +} + vec4 getPosition(vec2 pos_screen) { float depth = texture2DRect(depthMap, pos_screen.xy).r; @@ -68,35 +73,38 @@ void main() vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); - vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' + vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' vec4 col = defined_weight.xyxx * ccol; // relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large - tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); + float tc_mod = 0.5*(tc.x + tc.y); // mod(tc.x+tc.y,2) + tc_mod -= floor(tc_mod); + tc_mod *= 2.0; + tc += ( (tc_mod - 0.5) * getKern(1).z * dlt * 0.5 ); for (int i = 1; i < 4; i++) { - vec2 samptc = tc + kern[i].z*dlt; + vec2 samptc = tc + getKern(i).z*dlt; vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DRect(lightMap, samptc)*kern[i].xyxx; - defined_weight += kern[i].xy; + col += texture2DRect(lightMap, samptc)*getKern(i).xyxx; + defined_weight += getKern(i).xy; } } for (int i = 1; i < 4; i++) { - vec2 samptc = tc - kern[i].z*dlt; + vec2 samptc = tc - getKern(i).z*dlt; vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DRect(lightMap, samptc)*kern[i].xyxx; - defined_weight += kern[i].xy; + col += texture2DRect(lightMap, samptc)*getKern(i).xyxx; + defined_weight += getKern(i).xy; } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 5b207ab558..6b420833b9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -40,6 +40,7 @@ uniform sampler2DShadow shadowMap4; uniform sampler2DShadow shadowMap5; uniform sampler2D noiseMap; + // Inputs uniform mat4 shadow_matrix[6]; uniform vec4 shadow_clip; @@ -49,12 +50,12 @@ uniform float ssao_factor; uniform float ssao_factor_inv; VARYING vec2 vary_fragcoord; -uniform vec3 sun_dir; uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 shadow_res; uniform vec2 proj_shadow_res; +uniform vec3 sun_dir; uniform float shadow_bias; uniform float shadow_offset; @@ -75,11 +76,8 @@ vec4 getPosition(vec2 pos_screen) return pos; } -//calculate decreases in ambient lighting when crowded out (SSAO) -float calcAmbientOcclusion(vec4 pos, vec3 norm) +vec2 getKern(int i) { - float ret = 1.0; - vec2 kern[8]; // exponentially (^2) distant occlusion samples spread around origin kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; @@ -90,22 +88,30 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + + return kern[i]; +} + +//calculate decreases in ambient lighting when crowded out (SSAO) +float calcAmbientOcclusion(vec4 pos, vec3 norm) +{ + float ret = 1.0; vec2 pos_screen = vary_fragcoord.xy; vec3 pos_world = pos.xyz; vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; float angle_hidden = 0.0; - int points = 0; + float points = 0; float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) for (int i = 0; i < 8; i++) { - vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); + vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect); vec3 samppos_world = getPosition(samppos_screen).xyz; - + vec3 diff = pos_world - samppos_world; float dist2 = dot(diff, diff); @@ -113,17 +119,21 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) // --> solid angle shrinking by the square of distance //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 //(k should vary inversely with # of samples, but this is taken care of later) - - angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); + + float funky_val = (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) ? 1.0 : 0.0; + angle_hidden = angle_hidden + funky_val * min(1.0/dist2, ssao_factor_inv); // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" - points = points + int(diff.z > -1.0); + float diffz_val = (diff.z > -1.0) ? 1.0 : 0.0; + points = points + diffz_val; } - angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); - - ret = (1.0 - (float(points != 0) * angle_hidden)); + angle_hidden = min(ssao_factor*angle_hidden/points, 1.0); + float points_val = (points > 0.0) ? 1.0 : 0.0; + ret = (1.0 - (points_val * angle_hidden)); + + ret = max(ret, 0.0); return min(ret, 1.0); } @@ -160,7 +170,6 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); - return shadow/5.0; //return shadow; @@ -253,7 +262,7 @@ void main() gl_FragColor[0] = shadow; gl_FragColor[1] = calcAmbientOcclusion(pos, norm); - spos.xyz = shadow_pos+norm*spot_shadow_offset; + spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0); //spotlight shadow 1 vec4 lpos = shadow_matrix[4]*spos; diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 803c22507a..390da2273d 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 30 +version 31 // The version number above should be implemented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -291,7 +291,7 @@ list TexUnit8orLess RenderDeferredSSAO 0 0 list ATI -RenderDeferredSSAO 0 0 +RenderDeferredSSAO 1 0 list Intel RenderAnisotropic 1 0 -- cgit v1.2.3 From 13a7fbc7a0cf460b4f57028b2e46c33426aa3a01 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 16 Nov 2011 17:48:10 -0800 Subject: EXP-1498 : Add a debug setting DebugHideEmptySystemFolders which is OFF by default so that we can control showing or hidding of system folders (this is temporary so we unblock testers). --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewerfoldertype.cpp | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a7dabeb563..e9b4d4d96d 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1893,6 +1893,17 @@ Value 1 + DebugHideEmptySystemFolders + + Comment + Hide empty system folders when on + Persist + 1 + Type + Boolean + Value + 0 + DebugInventoryFilters Comment diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index a179b61cff..c39df7efce 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -30,6 +30,7 @@ #include "lldictionary.h" #include "llmemory.h" #include "llvisualparam.h" +#include "llviewercontrol.h" static const std::string empty_string; @@ -266,7 +267,7 @@ BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type) bool LLViewerFolderType::lookupIsHiddenIfEmpty(LLFolderType::EType folder_type) { const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); - if (entry) + if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders") && entry) { return entry->mHideIfEmpty; } -- cgit v1.2.3 From 87b85b78ef9824222b83334544b9f6c1d720b8a1 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 16 Nov 2011 18:08:21 -0800 Subject: FIX VWR-26744 --- indra/newview/skins/default/xui/es/panel_people.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/es/panel_people.xml b/indra/newview/skins/default/xui/es/panel_people.xml index 2fcbb00aed..a9d38dca25 100644 --- a/indra/newview/skins/default/xui/es/panel_people.xml +++ b/indra/newview/skins/default/xui/es/panel_people.xml @@ -76,7 +76,7 @@ Date: Thu, 17 Nov 2011 19:48:39 -0800 Subject: EXP-1498 : Always create the folder widget, move empty filtering to foltering code. Still update issues though. --- indra/newview/llinventoryfilter.cpp | 13 +++++++++++- indra/newview/llinventorypanel.cpp | 41 ++++++++++--------------------------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 516b47e616..438081c177 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -36,6 +36,7 @@ #include "llviewercontrol.h" #include "llfolderview.h" #include "llinventorybridge.h" +#include "llviewerfoldertype.h" // linden library includes #include "lltrans.h" @@ -117,7 +118,17 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const LLFolderViewEventListener* listener = folder->getListener(); const LLUUID folder_id = listener->getUUID(); - + + const LLInvFVBridge *bridge = dynamic_cast(folder->getListener()); + bool is_system_folder = bridge->isSystemFolder(); + bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType()); + bool is_empty = (gInventory.categoryHasChildren(folder_id) != LLInventoryModel::CHILDREN_YES); + + if (is_system_folder && is_empty && is_hidden_if_empty) + { + return false; + } + if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY) { // Can only filter categories for items in your inventory diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index aff48b1961..a9ec4af4f3 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -618,41 +618,22 @@ LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool u LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge) { - // Create the folder ui widget, unless it's an empty system folder that should be hidden - // Note : we still let the code create a listener for it (in case something shows up in it) - // but we simply skip creating the ui ctrl and adding it. - // *TODO : Need to be verified: if the listener is triggered and something added, will the code - // crash (because it's assuming, wrongly, that the uictrl exists)? - - bool is_system_folder = bridge->isSystemFolder(); - bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(bridge->getPreferredType()); - bool is_empty = (mInventory->categoryHasChildren(bridge->getUUID()) != LLInventoryModel::CHILDREN_YES); - - if (!is_system_folder || !is_empty || !is_hidden_if_empty) - { - LLFolderViewFolder::Params params; + LLFolderViewFolder::Params params; - params.name = bridge->getDisplayName(); - params.icon = bridge->getIcon(); - params.icon_open = bridge->getOpenIcon(); - - if (mShowItemLinkOverlays) // if false, then links show up just like normal items - { - params.icon_overlay = LLUI::getUIImage("Inv_Link"); - } - - params.root = mFolderRoot; - params.listener = bridge; - params.tool_tip = params.name; + params.name = bridge->getDisplayName(); + params.icon = bridge->getIcon(); + params.icon_open = bridge->getOpenIcon(); - return LLUICtrlFactory::create(params); - } - else + if (mShowItemLinkOverlays) // if false, then links show up just like normal items { - // It's an empty system folder that should be hidden -> return NULL - return NULL; + params.icon_overlay = LLUI::getUIImage("Inv_Link"); } + + params.root = mFolderRoot; + params.listener = bridge; + params.tool_tip = params.name; + return LLUICtrlFactory::create(params); } LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge) -- cgit v1.2.3 From ed596077c4eb5b1ba6be4a71824ef220c086d436 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 18 Nov 2011 09:47:55 -0500 Subject: STORM-591 Removed commented out debugging lines --- indra/newview/llvieweraudio.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 10ba54356c..0262da4dee 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -65,12 +65,6 @@ void LLViewerAudio::registerIdleListener() void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) { -/* llinfos << "DBG streamURI: " << streamURI << llendl; - llinfos << "DBG mNextStreamURI: " << mNextStreamURI << llendl; - if (mFadeState == FADE_OUT) {llinfos << "DBG mFadeState: FADE_OUT " << llendl;} - if (mFadeState == FADE_IN) {llinfos << "DBG mFadeState: FADE_IN " << llendl;} - if (mFadeState == FADE_IDLE) {llinfos << "DBG mFadeState: FADE_IDLE " << llendl;} -*/ // Old and new stream are identical if (mNextStreamURI == streamURI) { @@ -86,14 +80,11 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) if (!gAudiop->getInternetStreamURL().empty()) { mFadeState = FADE_OUT; -//llinfos << "DBG new mFadeState: OUT" << llendl; } // Otherwise the new stream can be faded in else { mFadeState = FADE_IN; -//llinfos << "DBG new mFadeState: IN" << llendl; - gAudiop->startInternetStream(mNextStreamURI); startFading(); registerIdleListener(); @@ -123,10 +114,6 @@ bool LLViewerAudio::onIdleUpdate() { if (mDone) { -/* if (mFadeState == FADE_OUT) {llinfos << "DBG mFadeState: FADE_OUT " << llendl;} - if (mFadeState == FADE_IN) {llinfos << "DBG mFadeState: FADE_IN " << llendl;} - if (mFadeState == FADE_IDLE) {llinfos << "DBG mFadeState: FADE_IDLE " << llendl;} -*/ // This should be a rare or never occurring state. if (mFadeState == FADE_IDLE) { @@ -144,7 +131,6 @@ bool LLViewerAudio::onIdleUpdate() if (!mNextStreamURI.empty()) { mFadeState = FADE_IN; -//llinfos << "DBG new mFadeState: IN" << llendl; gAudiop->startInternetStream(mNextStreamURI); startFading(); return false; @@ -152,7 +138,6 @@ bool LLViewerAudio::onIdleUpdate() else { mFadeState = FADE_IDLE; -//llinfos << "DBG new mFadeState: IDLE" << llendl; deregisterIdleListener(); return true; // Stop calling onIdleUpdate } @@ -164,12 +149,10 @@ bool LLViewerAudio::onIdleUpdate() mFadeState = FADE_OUT; startFading(); return false; -//llinfos << "DBG new mFadeState: OUT" << llendl; } else { mFadeState = FADE_IDLE; -//llinfos << "DBG new mFadeState: IDLE" << llendl; deregisterIdleListener(); return true; // Stop calling onIdleUpdate } @@ -181,12 +164,9 @@ bool LLViewerAudio::onIdleUpdate() void LLViewerAudio::stopInternetStreamWithAutoFade() { -//llinfos << "DBG stopping stream" << llendl; mFadeState = FADE_IDLE; -//llinfos << "DBG new mFadeState: IDLE" << llendl; mNextStreamURI = LLStringUtil::null; mDone = true; -//llinfos << "DBG mDone: true" << llendl; gAudiop->startInternetStream(LLStringUtil::null); gAudiop->stopInternetStream(); @@ -194,8 +174,6 @@ void LLViewerAudio::stopInternetStreamWithAutoFade() void LLViewerAudio::startFading() { -//llinfos << "DBG startFading" << llendl; - if(mDone) { // The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not, @@ -208,7 +186,6 @@ void LLViewerAudio::startFading() stream_fade_timer.reset(); stream_fade_timer.setTimerExpirySec(mFadeTime); mDone = false; -//llinfos << "DBG mDone: false" << llendl; } } @@ -349,7 +326,6 @@ void audio_update_volume(bool force_update) F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); -//llinfos << "DBG fade_volume:" << fade_volume << llendl; music_volume = mute_volume * master_volume * music_volume * fade_volume; gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume); -- cgit v1.2.3 From f78dcdf2c4c3ccc7864d5487e748ec7a4e1740fb Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 18 Nov 2011 19:00:48 +0200 Subject: EXP-1582 FIXED (Add "Snapshots" button to 2nd tier default toolbar) - Added "Snapshots" button to 2nd tier default toolbar --- indra/newview/app_settings/toolbars.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index f2192a75ad..30be697436 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -14,6 +14,7 @@ + -- cgit v1.2.3 From df7f4f60b60e7d53060e4d8e3d0ca03bf74bf24e Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 18 Nov 2011 19:32:58 +0200 Subject: EXP-1576 FIXED (Remove old profile window from People panel) - Removed old profile window from People panel with all subpanels and dependencies --- indra/newview/CMakeLists.txt | 2 - indra/newview/llpanelavatar.cpp | 709 --------------------- indra/newview/llpanelavatar.h | 191 +----- indra/newview/llpanelme.cpp | 285 --------- indra/newview/llpanelme.h | 64 +- indra/newview/llpanelprofile.cpp | 2 - indra/newview/llpanelprofileview.cpp | 247 ------- indra/newview/llpanelprofileview.h | 108 ---- .../skins/default/xui/da/panel_my_profile.xml | 31 - indra/newview/skins/default/xui/da/panel_notes.xml | 35 - .../newview/skins/default/xui/da/panel_profile.xml | 59 -- .../skins/default/xui/da/panel_profile_view.xml | 20 - .../skins/default/xui/de/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/de/panel_notes.xml | 35 - .../newview/skins/default/xui/de/panel_profile.xml | 74 --- .../skins/default/xui/de/panel_profile_view.xml | 20 - .../skins/default/xui/en/floater_people.xml | 4 - .../skins/default/xui/en/panel_my_profile.xml | 146 ----- indra/newview/skins/default/xui/en/panel_notes.xml | 236 ------- .../newview/skins/default/xui/en/panel_profile.xml | 458 ------------- .../skins/default/xui/en/panel_profile_view.xml | 162 ----- .../skins/default/xui/es/panel_my_profile.xml | 31 - indra/newview/skins/default/xui/es/panel_notes.xml | 35 - .../newview/skins/default/xui/es/panel_profile.xml | 70 -- .../skins/default/xui/es/panel_profile_view.xml | 20 - .../skins/default/xui/fr/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/fr/panel_notes.xml | 35 - .../newview/skins/default/xui/fr/panel_profile.xml | 74 --- .../skins/default/xui/fr/panel_profile_view.xml | 20 - .../skins/default/xui/it/panel_my_profile.xml | 31 - indra/newview/skins/default/xui/it/panel_notes.xml | 35 - .../newview/skins/default/xui/it/panel_profile.xml | 70 -- .../skins/default/xui/it/panel_profile_view.xml | 22 - .../skins/default/xui/ja/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/ja/panel_notes.xml | 35 - .../newview/skins/default/xui/ja/panel_profile.xml | 74 --- .../skins/default/xui/ja/panel_profile_view.xml | 22 - .../skins/default/xui/pl/panel_my_profile.xml | 31 - indra/newview/skins/default/xui/pl/panel_notes.xml | 35 - .../newview/skins/default/xui/pl/panel_profile.xml | 59 -- .../skins/default/xui/pl/panel_profile_view.xml | 20 - .../skins/default/xui/pt/panel_my_profile.xml | 31 - indra/newview/skins/default/xui/pt/panel_notes.xml | 35 - .../newview/skins/default/xui/pt/panel_profile.xml | 70 -- .../skins/default/xui/pt/panel_profile_view.xml | 20 - .../skins/default/xui/ru/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/ru/panel_notes.xml | 35 - .../newview/skins/default/xui/ru/panel_profile.xml | 67 -- .../skins/default/xui/ru/panel_profile_view.xml | 20 - .../skins/default/xui/tr/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/tr/panel_notes.xml | 35 - .../newview/skins/default/xui/tr/panel_profile.xml | 67 -- .../skins/default/xui/tr/panel_profile_view.xml | 20 - .../skins/default/xui/zh/panel_my_profile.xml | 42 -- indra/newview/skins/default/xui/zh/panel_notes.xml | 35 - .../newview/skins/default/xui/zh/panel_profile.xml | 67 -- .../skins/default/xui/zh/panel_profile_view.xml | 20 - 57 files changed, 3 insertions(+), 4378 deletions(-) delete mode 100644 indra/newview/llpanelprofileview.cpp delete mode 100644 indra/newview/llpanelprofileview.h delete mode 100644 indra/newview/skins/default/xui/da/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/da/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/da/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/da/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/de/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/de/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/de/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/de/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/es/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/es/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/es/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/es/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/fr/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/fr/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/fr/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/fr/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/it/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/it/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/it/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/it/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/ja/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/ja/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/ja/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/ja/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/pl/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/pl/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/pl/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/pl/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/pt/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/pt/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/pt/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/pt/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/ru/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/ru/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/ru/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/ru/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/tr/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/tr/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/tr/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/tr/panel_profile_view.xml delete mode 100644 indra/newview/skins/default/xui/zh/panel_my_profile.xml delete mode 100644 indra/newview/skins/default/xui/zh/panel_notes.xml delete mode 100644 indra/newview/skins/default/xui/zh/panel_profile.xml delete mode 100644 indra/newview/skins/default/xui/zh/panel_profile_view.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ba05f6288b..4760670573 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -393,7 +393,6 @@ set(viewer_SOURCE_FILES llpanelplacestab.cpp llpanelprimmediacontrols.cpp llpanelprofile.cpp - llpanelprofileview.cpp llpanelsnapshot.cpp llpanelsnapshotinventory.cpp llpanelsnapshotlocal.cpp @@ -960,7 +959,6 @@ set(viewer_HEADER_FILES llpanelplacestab.h llpanelprimmediacontrols.h llpanelprofile.h - llpanelprofileview.h llpanelsnapshot.h llpanelteleporthistory.h llpaneltiptoast.h diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 988e801b61..679b1bdcda 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -120,269 +120,6 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, static LLDefaultChildRegistry::Register r("drop_target"); -static LLRegisterPanelClassWrapper t_panel_profile("panel_profile"); -static LLRegisterPanelClassWrapper t_panel_my_profile("panel_my_profile"); -static LLRegisterPanelClassWrapper t_panel_notes("panel_notes"); - -//----------------------------------------------------------------------------- -// LLPanelAvatarNotes() -//----------------------------------------------------------------------------- -LLPanelAvatarNotes::LLPanelAvatarNotes() -: LLPanelProfileTab() -{ - -} - -void LLPanelAvatarNotes::updateData() -{ - LLAvatarPropertiesProcessor::getInstance()-> - sendAvatarNotesRequest(getAvatarId()); -} - -BOOL LLPanelAvatarNotes::postBuild() -{ - childSetCommitCallback("status_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL); - childSetCommitCallback("map_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL); - childSetCommitCallback("objects_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL); - - childSetCommitCallback("add_friend", boost::bind(&LLPanelAvatarNotes::onAddFriendButtonClick, this),NULL); - childSetCommitCallback("im", boost::bind(&LLPanelAvatarNotes::onIMButtonClick, this), NULL); - childSetCommitCallback("call", boost::bind(&LLPanelAvatarNotes::onCallButtonClick, this), NULL); - childSetCommitCallback("teleport", boost::bind(&LLPanelAvatarNotes::onTeleportButtonClick, this), NULL); - childSetCommitCallback("share", boost::bind(&LLPanelAvatarNotes::onShareButtonClick, this), NULL); - childSetCommitCallback("show_on_map_btn", (boost::bind( - &LLPanelAvatarNotes::onMapButtonClick, this)), NULL); - - LLTextEditor* te = getChild("notes_edit"); - te->setCommitCallback(boost::bind(&LLPanelAvatarNotes::onCommitNotes,this)); - te->setCommitOnFocusLost(TRUE); - - resetControls(); - resetData(); - - LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); - - return TRUE; -} - -void LLPanelAvatarNotes::onOpen(const LLSD& key) -{ - LLPanelProfileTab::onOpen(key); - - fillRightsData(); - - //Disable "Add Friend" button for friends. - getChildView("add_friend")->setEnabled(!LLAvatarActions::isFriend(getAvatarId())); -} - -void LLPanelAvatarNotes::fillRightsData() -{ - getChild("status_check")->setValue(FALSE); - getChild("map_check")->setValue(FALSE); - getChild("objects_check")->setValue(FALSE); - - const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - // If true - we are viewing friend's profile, enable check boxes and set values. - if(relation) - { - S32 rights = relation->getRightsGrantedTo(); - - getChild("status_check")->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE); - getChild("map_check")->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); - getChild("objects_check")->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); - - } - - enableCheckboxes(NULL != relation); -} - -void LLPanelAvatarNotes::onCommitNotes() -{ - std::string notes = getChild("notes_edit")->getValue().asString(); - LLAvatarPropertiesProcessor::getInstance()-> sendNotes(getAvatarId(),notes); -} - -void LLPanelAvatarNotes::rightsConfirmationCallback(const LLSD& notification, - const LLSD& response, S32 rights) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) - { - LLAvatarPropertiesProcessor::getInstance()->sendFriendRights( - getAvatarId(), rights); - } - else - { - getChild("objects_check")->setValue( - getChild("objects_check")->getValue().asBoolean() ? FALSE : TRUE); - } -} - -void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights) -{ - LLSD args; - args["NAME"] = LLSLURL("agent", getAvatarId(), "displayname").getSLURLString(); - - if (grant) - { - LLNotificationsUtil::add("GrantModifyRights", args, LLSD(), - boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, - _1, _2, rights)); - } - else - { - LLNotificationsUtil::add("RevokeModifyRights", args, LLSD(), - boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, - _1, _2, rights)); - } -} - -void LLPanelAvatarNotes::onCommitRights() -{ - const LLRelationship* buddy_relationship = - LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - - if (NULL == buddy_relationship) - { - // Lets have a warning log message instead of having a crash. EXT-4947. - llwarns << "Trying to modify rights for non-friend avatar. Skipped." << llendl; - return; - } - - - S32 rights = 0; - - if(getChild("status_check")->getValue().asBoolean()) - rights |= LLRelationship::GRANT_ONLINE_STATUS; - if(getChild("map_check")->getValue().asBoolean()) - rights |= LLRelationship::GRANT_MAP_LOCATION; - if(getChild("objects_check")->getValue().asBoolean()) - rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - - bool allow_modify_objects = getChild("objects_check")->getValue().asBoolean(); - - // if modify objects checkbox clicked - if (buddy_relationship->isRightGrantedTo( - LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects) - { - confirmModifyRights(allow_modify_objects, rights); - } - // only one checkbox can trigger commit, so store the rest of rights - else - { - LLAvatarPropertiesProcessor::getInstance()->sendFriendRights( - getAvatarId(), rights); - } -} - -void LLPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type) -{ - if(APT_NOTES == type) - { - LLAvatarNotes* avatar_notes = static_cast(data); - if(avatar_notes && getAvatarId() == avatar_notes->target_id) - { - getChild("notes_edit")->setValue(avatar_notes->notes); - getChildView("notes edit")->setEnabled(true); - - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); - } - } -} - -void LLPanelAvatarNotes::resetData() -{ - getChild("notes_edit")->setValue(LLStringUtil::null); - // Default value is TRUE - getChild("status_check")->setValue(TRUE); -} - -void LLPanelAvatarNotes::resetControls() -{ - //Disable "Add Friend" button for friends. - getChildView("add_friend")->setEnabled(TRUE); - - enableCheckboxes(false); -} - -void LLPanelAvatarNotes::onAddFriendButtonClick() -{ - LLAvatarActions::requestFriendshipDialog(getAvatarId()); -} - -void LLPanelAvatarNotes::onIMButtonClick() -{ - LLAvatarActions::startIM(getAvatarId()); -} - -void LLPanelAvatarNotes::onTeleportButtonClick() -{ - LLAvatarActions::offerTeleport(getAvatarId()); -} - -void LLPanelAvatarNotes::onCallButtonClick() -{ - LLAvatarActions::startCall(getAvatarId()); -} - -void LLPanelAvatarNotes::onShareButtonClick() -{ - //*TODO not implemented. -} - -void LLPanelAvatarNotes::enableCheckboxes(bool enable) -{ - getChildView("status_check")->setEnabled(enable); - getChildView("map_check")->setEnabled(enable); - getChildView("objects_check")->setEnabled(enable); -} - -LLPanelAvatarNotes::~LLPanelAvatarNotes() -{ - if(getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } - - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); - } -} - -// virtual, called by LLAvatarTracker -void LLPanelAvatarNotes::changed(U32 mask) -{ - getChildView("teleport")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(getAvatarId())); - - // update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947. - fillRightsData(); -} - -// virtual -void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channelURI, bool proximal) -{ - if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) - { - return; - } - - getChildView("call")->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); -} - -void LLPanelAvatarNotes::setAvatarId(const LLUUID& id) -{ - if(id.notNull()) - { - if(getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } - LLPanelProfileTab::setAvatarId(id); - LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this); - } -} - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -461,449 +198,3 @@ void LLPanelProfileTab::updateButtons() || gAgent.isGodlike(); getChildView("show_on_map_btn")->setEnabled(enable_map_btn); } - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -bool enable_god() -{ - return gAgent.isGodlike(); -} - -LLPanelAvatarProfile::LLPanelAvatarProfile() -: LLPanelProfileTab() -{ -} - -BOOL LLPanelAvatarProfile::postBuild() -{ - childSetCommitCallback("see_profile_btn",(boost::bind(&LLPanelAvatarProfile::onSeeProfileBtnClick,this)),NULL); - childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL); - childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); - childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); - childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL); - childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL); - childSetCommitCallback("show_on_map_btn", (boost::bind( - &LLPanelAvatarProfile::onMapButtonClick, this)), NULL); - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - registrar.add("Profile.ShowOnMap", boost::bind(&LLPanelAvatarProfile::onMapButtonClick, this)); - registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); - registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); - registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this)); - registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this)); - registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this)); - registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this)); - registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this)); - - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; - enable.add("Profile.EnableShowOnMap", boost::bind(&LLPanelAvatarProfile::enableShowOnMap, this)); - enable.add("Profile.EnableGod", boost::bind(&enable_god)); - enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this)); - enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this)); - - LLToggleableMenu* profile_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - getChild("overflow_btn")->setMenu(profile_menu, LLMenuButton::MP_TOP_RIGHT); - - LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); - - resetControls(); - resetData(); - - return TRUE; -} - -void LLPanelAvatarProfile::onOpen(const LLSD& key) -{ - LLPanelProfileTab::onOpen(key); - - mGroups.clear(); - - //Disable "Add Friend" button for friends. - getChildView("add_friend")->setEnabled(!LLAvatarActions::isFriend(getAvatarId())); -} - -void LLPanelAvatarProfile::updateData() -{ - if (getAvatarId().notNull()) - { - LLAvatarPropertiesProcessor::getInstance()-> - sendAvatarPropertiesRequest(getAvatarId()); - LLAvatarPropertiesProcessor::getInstance()-> - sendAvatarGroupsRequest(getAvatarId()); - } -} - -void LLPanelAvatarProfile::resetControls() -{ - getChildView("status_panel")->setVisible( true); - getChildView("profile_buttons_panel")->setVisible( true); - getChildView("title_groups_text")->setVisible( true); - getChildView("sl_groups")->setVisible( true); - getChildView("add_friend")->setEnabled(true); - - getChildView("status_me_panel")->setVisible( false); - getChildView("profile_me_buttons_panel")->setVisible( false); - getChildView("account_actions_panel")->setVisible( false); -} - -void LLPanelAvatarProfile::resetData() -{ - mGroups.clear(); - getChild("2nd_life_pic")->setValue(LLUUID::null); - getChild("real_world_pic")->setValue(LLUUID::null); - getChild("online_status")->setValue(LLStringUtil::null); - getChild("status_message")->setValue(LLStringUtil::null); - getChild("sl_description_edit")->setValue(LLStringUtil::null); - getChild("fl_description_edit")->setValue(LLStringUtil::null); - getChild("sl_groups")->setValue(LLStringUtil::null); - getChild("homepage_edit")->setValue(LLStringUtil::null); - getChild("register_date")->setValue(LLStringUtil::null); - getChild("acc_status_text")->setValue(LLStringUtil::null); - getChild("partner_text")->setValue(LLStringUtil::null); -} - -void LLPanelAvatarProfile::processProperties(void* data, EAvatarProcessorType type) -{ - if(APT_PROPERTIES == type) - { - const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && getAvatarId() == avatar_data->avatar_id) - { - processProfileProperties(avatar_data); - } - } - else if(APT_GROUPS == type) - { - LLAvatarGroups* avatar_groups = static_cast(data); - if(avatar_groups && getAvatarId() == avatar_groups->avatar_id) - { - processGroupProperties(avatar_groups); - } - } -} - -void LLPanelAvatarProfile::processProfileProperties(const LLAvatarData* avatar_data) -{ - fillCommonData(avatar_data); - - fillPartnerData(avatar_data); - - fillAccountStatus(avatar_data); -} - -void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_groups) -{ - // *NOTE dzaporozhan - // Group properties may arrive in two callbacks, we need to save them across - // different calls. We can't do that in textbox as textbox may change the text. - - LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); - const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end(); - - for(; it_end != it; ++it) - { - LLAvatarGroups::LLGroupData group_data = *it; - mGroups[group_data.group_name] = group_data.group_id; - } - - // Creating string, containing group list - std::string groups = ""; - for (group_map_t::iterator it = mGroups.begin(); it != mGroups.end(); ++it) - { - if (it != mGroups.begin()) - groups += ", "; - - std::string group_name = LLURI::escape(it->first); - std::string group_url= it->second.notNull() - ? "[secondlife:///app/group/" + it->second.asString() + "/about " + group_name + "]" - : getString("no_group_text"); - - groups += group_url; - } - - getChild("sl_groups")->setValue(groups); -} - -static void got_full_name_callback( LLHandle profile_panel_handle, const std::string& full_name ) -{ - if (profile_panel_handle.isDead() ) return; - - LLPanelAvatarProfile* profile_panel = dynamic_cast(profile_panel_handle.get()); - if ( ! profile_panel ) return; - - LLStringUtil::format_map_t args; - - std::string name; - if (LLAvatarNameCache::useDisplayNames()) - { - name = LLCacheName::buildUsername(full_name); - } - else - { - name = full_name; - } - - args["[NAME]"] = name; - - std::string linden_name = profile_panel->getString("name_text_args", args); - profile_panel->getChild("name_descr_text")->setValue(linden_name); -} - -void LLPanelAvatarProfile::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - LLStringUtil::format_map_t args; - args["[DISPLAY_NAME]"] = av_name.mDisplayName; - - std::string display_name = getString("display_name_text_args", args); - getChild("display_name_descr_text")->setValue(display_name); -} - -void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data) -{ - //remove avatar id from cache to get fresh info - LLAvatarIconIDCache::getInstance()->remove(avatar_data->avatar_id); - - LLStringUtil::format_map_t args; - { - std::string birth_date = LLTrans::getString("AvatarBirthDateFormat"); - LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch())); - args["[REG_DATE]"] = birth_date; - } - - // ask (asynchronously) for the avatar name - LLHandle profile_panel_handle = getHandle(); - std::string full_name; - if (gCacheName->getFullName(avatar_data->agent_id, full_name)) - { - // name in cache, call callback directly - got_full_name_callback( profile_panel_handle, full_name ); - } - else - { - // not in cache, lookup name - gCacheName->get(avatar_data->agent_id, false, boost::bind( got_full_name_callback, profile_panel_handle, _2 )); - } - - // get display name - LLAvatarNameCache::get(avatar_data->avatar_id, - boost::bind(&LLPanelAvatarProfile::onNameCache, this, _1, _2)); - - args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now()); - std::string register_date = getString("RegisterDateFormat", args); - getChild("register_date")->setValue(register_date ); - getChild("sl_description_edit")->setValue(avatar_data->about_text); - getChild("fl_description_edit")->setValue(avatar_data->fl_about_text); - getChild("2nd_life_pic")->setValue(avatar_data->image_id); - getChild("real_world_pic")->setValue(avatar_data->fl_image_id); - getChild("homepage_edit")->setValue(avatar_data->profile_url); - - // Hide home page textbox if no page was set to fix "homepage URL appears clickable without URL - EXT-4734" - getChildView("homepage_edit")->setVisible( !avatar_data->profile_url.empty()); -} - -void LLPanelAvatarProfile::fillPartnerData(const LLAvatarData* avatar_data) -{ - LLTextBox* partner_text = getChild("partner_text"); - if (avatar_data->partner_id.notNull()) - { - partner_text->setText(LLSLURL("agent", avatar_data->partner_id, "inspect").getSLURLString()); - } - else - { - partner_text->setText(getString("no_partner_text")); - } -} - -void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data) -{ - LLStringUtil::format_map_t args; - args["[ACCTTYPE]"] = LLAvatarPropertiesProcessor::accountType(avatar_data); - args["[PAYMENTINFO]"] = LLAvatarPropertiesProcessor::paymentInfo(avatar_data); - // *NOTE: AVATAR_AGEVERIFIED not currently getting set in - // dataserver/lldataavatar.cpp for privacy considerations - args["[AGEVERIFICATION]"] = ""; - std::string caption_text = getString("CaptionTextAcctInfo", args); - getChild("acc_status_text")->setValue(caption_text); -} - -void LLPanelAvatarProfile::pay() -{ - LLAvatarActions::pay(getAvatarId()); -} - -void LLPanelAvatarProfile::share() -{ - LLAvatarActions::share(getAvatarId()); -} - -void LLPanelAvatarProfile::toggleBlock() -{ - LLAvatarActions::toggleBlock(getAvatarId()); -} - -bool LLPanelAvatarProfile::enableShowOnMap() -{ - bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); - - bool enable_map_btn = (is_buddy_online && is_agent_mappable(getAvatarId())) - || gAgent.isGodlike(); - return enable_map_btn; -} - -bool LLPanelAvatarProfile::enableBlock() -{ - return LLAvatarActions::canBlock(getAvatarId()) && !LLAvatarActions::isBlocked(getAvatarId()); -} - -bool LLPanelAvatarProfile::enableUnblock() -{ - return LLAvatarActions::isBlocked(getAvatarId()); -} - -void LLPanelAvatarProfile::kick() -{ - LLAvatarActions::kick(getAvatarId()); -} - -void LLPanelAvatarProfile::freeze() -{ - LLAvatarActions::freeze(getAvatarId()); -} - -void LLPanelAvatarProfile::unfreeze() -{ - LLAvatarActions::unfreeze(getAvatarId()); -} - -void LLPanelAvatarProfile::csr() -{ - std::string name; - gCacheName->getFullName(getAvatarId(), name); - LLAvatarActions::csr(getAvatarId(), name); -} - -void LLPanelAvatarProfile::onAddFriendButtonClick() -{ - LLAvatarActions::requestFriendshipDialog(getAvatarId()); -} - -void LLPanelAvatarProfile::onSeeProfileBtnClick() -{ - LLAvatarActions::showProfile(getAvatarId()); -} - -void LLPanelAvatarProfile::onIMButtonClick() -{ - LLAvatarActions::startIM(getAvatarId()); -} - -void LLPanelAvatarProfile::onTeleportButtonClick() -{ - LLAvatarActions::offerTeleport(getAvatarId()); -} - -void LLPanelAvatarProfile::onCallButtonClick() -{ - LLAvatarActions::startCall(getAvatarId()); -} - -void LLPanelAvatarProfile::onShareButtonClick() -{ - //*TODO not implemented -} - -LLPanelAvatarProfile::~LLPanelAvatarProfile() -{ - if(getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } - - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); - } -} - -// virtual, called by LLAvatarTracker -void LLPanelAvatarProfile::changed(U32 mask) -{ - getChildView("teleport")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(getAvatarId())); -} - -// virtual -void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &channelURI, bool proximal) -{ - if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) - { - return; - } - - getChildView("call")->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); -} - -void LLPanelAvatarProfile::setAvatarId(const LLUUID& id) -{ - if(id.notNull()) - { - if(getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } - LLPanelProfileTab::setAvatarId(id); - LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this); - } -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLPanelMyProfile::LLPanelMyProfile() -: LLPanelAvatarProfile() -{ -} - -BOOL LLPanelMyProfile::postBuild() -{ - LLPanelAvatarProfile::postBuild(); - - childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelMyProfile::onStatusMessageChanged, this), NULL); - - resetControls(); - resetData(); - - return TRUE; -} - -void LLPanelMyProfile::onOpen(const LLSD& key) -{ - LLPanelProfileTab::onOpen(key); -} - -void LLPanelMyProfile::processProfileProperties(const LLAvatarData* avatar_data) -{ - fillCommonData(avatar_data); - - fillPartnerData(avatar_data); - - fillAccountStatus(avatar_data); -} - -void LLPanelMyProfile::resetControls() -{ - getChildView("status_panel")->setVisible( false); - getChildView("profile_buttons_panel")->setVisible( false); - getChildView("title_groups_text")->setVisible( false); - getChildView("sl_groups")->setVisible( false); - getChildView("status_me_panel")->setVisible( true); - getChildView("profile_me_buttons_panel")->setVisible( true); -} - - -void LLPanelMyProfile::onStatusMessageChanged() -{ - updateData(); -} diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index e95441cd58..e33a850cfa 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -36,14 +36,8 @@ class LLComboBox; class LLLineEditor; -enum EOnlineStatus -{ - ONLINE_STATUS_NO = 0, - ONLINE_STATUS_YES = 1 -}; - /** -* Base class for any Profile View or My Profile Panel. +* Base class for any Profile View. */ class LLPanelProfileTab : public LLPanel @@ -111,187 +105,4 @@ private: LLUUID mAvatarId; }; -/** -* Panel for displaying Avatar's first and second life related info. -*/ -class LLPanelAvatarProfile - : public LLPanelProfileTab - , public LLFriendObserver - , public LLVoiceClientStatusObserver -{ -public: - LLPanelAvatarProfile(); - /*virtual*/ ~LLPanelAvatarProfile(); - - /*virtual*/ void onOpen(const LLSD& key); - - /** - * LLFriendObserver trigger - */ - virtual void changed(U32 mask); - - // Implements LLVoiceClientStatusObserver::onChange() to enable the call - // button when voice is available - /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); - - /*virtual*/ void setAvatarId(const LLUUID& id); - - /** - * Processes data received from server. - */ - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - - /*virtual*/ BOOL postBuild(); - - /*virtual*/ void updateData(); - - /*virtual*/ void resetControls(); - - /*virtual*/ void resetData(); - -protected: - - /** - * Process profile related data received from server. - */ - virtual void processProfileProperties(const LLAvatarData* avatar_data); - - /** - * Processes group related data received from server. - */ - virtual void processGroupProperties(const LLAvatarGroups* avatar_groups); - - /** - * Fills common for Avatar profile and My Profile fields. - */ - virtual void fillCommonData(const LLAvatarData* avatar_data); - - /** - * Fills partner data. - */ - virtual void fillPartnerData(const LLAvatarData* avatar_data); - - /** - * Fills account status. - */ - virtual void fillAccountStatus(const LLAvatarData* avatar_data); - - /** - * Opens "Pay Resident" dialog. - */ - void pay(); - - /** - * opens inventory and IM for sharing items - */ - void share(); - - /** - * Add/remove resident to/from your block list. - */ - void toggleBlock(); - - void kick(); - void freeze(); - void unfreeze(); - void csr(); - - bool enableShowOnMap(); - bool enableBlock(); - bool enableUnblock(); - bool enableGod(); - - void onSeeProfileBtnClick(); - void onAddFriendButtonClick(); - void onIMButtonClick(); - void onCallButtonClick(); - void onTeleportButtonClick(); - void onShareButtonClick(); - -private: - void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - - typedef std::map< std::string,LLUUID> group_map_t; - group_map_t mGroups; -}; - -/** - * Panel for displaying own first and second life related info. - */ -class LLPanelMyProfile - : public LLPanelAvatarProfile -{ -public: - LLPanelMyProfile(); - - /*virtual*/ BOOL postBuild(); - -protected: - - /*virtual*/ void onOpen(const LLSD& key); - - /*virtual*/ void processProfileProperties(const LLAvatarData* avatar_data); - - /*virtual*/ void resetControls(); - -protected: - void onStatusMessageChanged(); -}; - -/** - * Panel for displaying Avatar's notes and modifying friend's rights. - */ -class LLPanelAvatarNotes - : public LLPanelProfileTab - , public LLFriendObserver - , public LLVoiceClientStatusObserver -{ -public: - LLPanelAvatarNotes(); - /*virtual*/ ~LLPanelAvatarNotes(); - - virtual void setAvatarId(const LLUUID& id); - - /** - * LLFriendObserver trigger - */ - virtual void changed(U32 mask); - - // Implements LLVoiceClientStatusObserver::onChange() to enable the call - // button when voice is available - /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); - - /*virtual*/ void onOpen(const LLSD& key); - - /*virtual*/ BOOL postBuild(); - - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - - /*virtual*/ void updateData(); - -protected: - - /*virtual*/ void resetControls(); - - /*virtual*/ void resetData(); - - /** - * Fills rights data for friends. - */ - void fillRightsData(); - - void rightsConfirmationCallback(const LLSD& notification, - const LLSD& response, S32 rights); - void confirmModifyRights(bool grant, S32 rights); - void onCommitRights(); - void onCommitNotes(); - - void onAddFriendButtonClick(); - void onIMButtonClick(); - void onCallButtonClick(); - void onTeleportButtonClick(); - void onShareButtonClick(); - void enableCheckboxes(bool enable); -}; - #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 7e47a96f44..a9af56f750 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -48,16 +48,10 @@ #include "lltabcontainer.h" #include "lltexturectrl.h" -#define PICKER_SECOND_LIFE "2nd_life_pic" -#define PICKER_FIRST_LIFE "real_world_pic" -#define PANEL_PROFILE "panel_profile" - -static LLRegisterPanelClassWrapper t_panel_me_profile_edit("edit_profile_panel"); static LLRegisterPanelClassWrapper t_panel_me_profile("panel_me"); LLPanelMe::LLPanelMe(void) : LLPanelProfile() - , mEditPanel(NULL) { setAvatarId(gAgent.getID()); } @@ -73,282 +67,3 @@ void LLPanelMe::onOpen(const LLSD& key) { LLPanelProfile::onOpen(key); } - -void LLPanelMe::buildEditPanel() -{ - if (NULL == mEditPanel) - { - mEditPanel = new LLPanelMyProfileEdit(); - - // Note: Remove support for editing profile through this method. - // All profile editing should go through the web. - //mEditPanel->childSetAction("save_btn", boost::bind(&LLPanelMe::onSaveChangesClicked, this), this); - - //mEditPanel->childSetAction("cancel_btn", boost::bind(&LLPanelMe::onCancelClicked, this), this); - } -} - - -void LLPanelMe::onEditProfileClicked() -{ - buildEditPanel(); -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLPanelMyProfileEdit::LLPanelMyProfileEdit() - : LLPanelMyProfile() -{ - buildFromFile( "panel_edit_profile.xml"); - - setAvatarId(gAgent.getID()); - - LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLPanelMyProfileEdit::onAvatarNameChanged, this)); -} - -void LLPanelMyProfileEdit::onOpen(const LLSD& key) -{ - resetData(); - - // Disable editing until data is loaded, or edited fields will be overwritten when data - // is loaded. - enableEditing(false); - - // force new avatar name fetch so we have latest update time - LLAvatarNameCache::fetch(gAgent.getID()); - LLPanelMyProfile::onOpen(getAvatarId()); - - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames()) - { - if (LLAvatarNameCache::get(gAgent.getID(), &av_name) && av_name.mIsDisplayNameDefault) - { - LLFirstUse::setDisplayName(); - } - else - { - LLFirstUse::setDisplayName(false); - } - } - - if (LLAvatarNameCache::useDisplayNames()) - { - getChild("user_label")->setVisible( true ); - getChild("user_slid")->setVisible( true ); - getChild("display_name_label")->setVisible( true ); - getChild("set_name")->setVisible( true ); - getChild("set_name")->setEnabled( true ); - getChild("solo_user_name")->setVisible( false ); - getChild("solo_username_label")->setVisible( false ); - } - else - { - getChild("user_label")->setVisible( false ); - getChild("user_slid")->setVisible( false ); - getChild("display_name_label")->setVisible( false ); - getChild("set_name")->setVisible( false ); - getChild("set_name")->setEnabled( false ); - getChild("solo_user_name")->setVisible( true ); - getChild("solo_username_label")->setVisible( true ); - } -} - -void LLPanelMyProfileEdit::onClose(const LLSD& key) -{ - if (LLAvatarNameCache::useDisplayNames()) - { - LLFirstUse::setDisplayName(false); - } -} - -void LLPanelMyProfileEdit::processProperties(void* data, EAvatarProcessorType type) -{ - if(APT_PROPERTIES == type) - { - const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && getAvatarId() == avatar_data->avatar_id) - { - // *TODO dzaporozhan - // Workaround for ticket EXT-1099, waiting for fix for ticket EXT-1128 - enableEditing(true); - processProfileProperties(avatar_data); - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); - } - } -} - -void LLPanelMyProfileEdit::processProfileProperties(const LLAvatarData* avatar_data) -{ - fillCommonData(avatar_data); - - // 'Home page' was hidden in LLPanelAvatarProfile::fillCommonData() to fix EXT-4734 - // Show 'Home page' in Edit My Profile (EXT-4873) - getChildView("homepage_edit")->setVisible( true); - - fillPartnerData(avatar_data); - - fillAccountStatus(avatar_data); - - getChild("show_in_search_checkbox")->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH)); - - LLAvatarNameCache::get(avatar_data->avatar_id, - boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2)); -} - -void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - getChild("user_name")->setValue( av_name.mDisplayName ); - getChild("user_slid")->setValue( av_name.mUsername ); - getChild("user_name_small")->setValue( av_name.mDisplayName ); - getChild("solo_user_name")->setValue( av_name.mDisplayName ); - - - if (LLAvatarNameCache::useDisplayNames()) - { - getChild("user_label")->setVisible( true ); - getChild("user_slid")->setVisible( true ); - getChild("display_name_label")->setVisible( true ); - getChild("set_name")->setVisible( true ); - getChild("set_name")->setEnabled( true ); - - getChild("solo_user_name")->setVisible( false ); - getChild("solo_username_label")->setVisible( false ); - - // show smaller display name if too long to display in regular size - if (getChild("user_name")->getTextPixelWidth() > getChild("user_name")->getRect().getWidth()) - { - getChild("user_name_small")->setVisible( true ); - getChild("user_name")->setVisible( false ); - } - else - { - getChild("user_name_small")->setVisible( false ); - getChild("user_name")->setVisible( true ); - } - } - else - { - getChild("user_label")->setVisible( false ); - getChild("user_slid")->setVisible( false ); - getChild("display_name_label")->setVisible( false ); - getChild("set_name")->setVisible( false ); - getChild("set_name")->setEnabled( false ); - - getChild("solo_user_name")->setVisible( true ); - getChild("user_name_small")->setVisible( false ); - getChild("user_name")->setVisible( false ); - getChild("solo_username_label")->setVisible( true ); - } -} - - -void LLPanelMyProfileEdit::onAvatarNameChanged() -{ - LLAvatarNameCache::get(getAvatarId(), - boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2)); -} - -BOOL LLPanelMyProfileEdit::postBuild() -{ - initTexturePickerMouseEvents(); - - getChild("partner_edit_link")->setTextArg("[URL]", getString("partner_edit_link_url")); - getChild("my_account_link")->setTextArg("[URL]", getString("my_account_link_url")); - - getChild("set_name")->setCommitCallback( - boost::bind(&LLPanelMyProfileEdit::onClickSetName, this)); - - LLHints::registerHintTarget("set_display_name", getChild("set_name")->getHandle()); - LLViewerDisplayName::addNameChangedCallback(boost::bind(&LLPanelMyProfileEdit::onAvatarNameChanged, this)); - return LLPanelAvatarProfile::postBuild(); -} -/** - * Inits map with texture picker and appropriate edit icon. - * Sets callbacks of Mouse Enter and Mouse Leave signals of Texture Pickers - */ -void LLPanelMyProfileEdit::initTexturePickerMouseEvents() -{ - LLTextureCtrl* text_pic = getChild(PICKER_SECOND_LIFE); - LLIconCtrl* text_icon = getChild("2nd_life_edit_icon"); - mTextureEditIconMap[text_pic->getName()] = text_icon; - text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1)); - text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1)); - text_icon->setVisible(FALSE); - - text_pic = getChild(PICKER_FIRST_LIFE); - text_icon = getChild("real_world_edit_icon"); - mTextureEditIconMap[text_pic->getName()] = text_icon; - text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1)); - text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1)); - text_icon->setVisible(FALSE); -} - -void LLPanelMyProfileEdit::resetData() -{ - LLPanelMyProfile::resetData(); - - //childSetTextArg("name_text", "[FIRST]", LLStringUtil::null); - //childSetTextArg("name_text", "[LAST]", LLStringUtil::null); - getChild("user_name")->setValue( LLSD() ); - getChild("user_slid")->setValue( LLSD() ); - getChild("solo_user_name")->setValue( LLSD() ); - getChild("user_name_small")->setValue( LLSD() ); -} - -void LLPanelMyProfileEdit::onTexturePickerMouseEnter(LLUICtrl* ctrl) -{ - mTextureEditIconMap[ctrl->getName()]->setVisible(TRUE); -} -void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl) -{ - mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE); -} - -void LLPanelMyProfileEdit::onClickSetName() -{ - LLAvatarNameCache::get(getAvatarId(), - boost::bind(&LLPanelMyProfileEdit::onAvatarNameCache, - this, _1, _2)); - - LLFirstUse::setDisplayName(false); -} - -void LLPanelMyProfileEdit::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - if (av_name.mDisplayName.empty()) - { - // something is wrong, tell user to try again later - LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); - return; - } - - llinfos << "name-change now " << LLDate::now() << " next_update " - << LLDate(av_name.mNextUpdate) << llendl; - F64 now_secs = LLDate::now().secondsSinceEpoch(); - - if (now_secs < av_name.mNextUpdate) - { - // if the update time is more than a year in the future, it means updates have been blocked - // show a more general message - const int YEAR = 60*60*24*365; - if (now_secs + YEAR < av_name.mNextUpdate) - { - LLNotificationsUtil::add("SetDisplayNameBlocked"); - return; - } - } - - LLFloaterReg::showInstance("display_name"); -} - -void LLPanelMyProfileEdit::enableEditing(bool enable) -{ - getChildView("2nd_life_pic")->setEnabled(enable); - getChildView("real_world_pic")->setEnabled(enable); - getChildView("sl_description_edit")->setEnabled(enable); - getChildView("fl_description_edit")->setEnabled(enable); - getChildView("homepage_edit")->setEnabled(enable); - getChildView("show_in_search_checkbox")->setEnabled(enable); -} diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h index b0f5d184cc..60e9d4317d 100644 --- a/indra/newview/llpanelme.h +++ b/indra/newview/llpanelme.h @@ -30,15 +30,9 @@ #include "llpanel.h" #include "llpanelprofile.h" -class LLAvatarName; -class LLPanelMyProfileEdit; -class LLPanelProfile; -class LLIconCtrl; - /** -* Panel for displaying Agent's profile, it consists of two sub panels - Profile -* and Picks. -* LLPanelMe allows user to edit his profile and picks. +* Panel for displaying Agent's Picks and Classifieds panel. +* LLPanelMe allows user to edit his picks and classifieds. */ class LLPanelMe : public LLPanelProfile { @@ -51,60 +45,6 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ BOOL postBuild(); - -private: - - void buildEditPanel(); - - void onEditProfileClicked(); - - LLPanelMyProfileEdit * mEditPanel; - -}; - -class LLPanelMyProfileEdit : public LLPanelMyProfile -{ - LOG_CLASS(LLPanelMyProfileEdit); - -public: - - LLPanelMyProfileEdit(); - - /*virtual*/void processProperties(void* data, EAvatarProcessorType type); - - /*virtual*/BOOL postBuild(); - - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(const LLSD& key); - - void onAvatarNameChanged(); - -protected: - - /*virtual*/void resetData(); - - void processProfileProperties(const LLAvatarData* avatar_data); - void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - -private: - void initTexturePickerMouseEvents(); - void onTexturePickerMouseEnter(LLUICtrl* ctrl); - void onTexturePickerMouseLeave(LLUICtrl* ctrl); - void onClickSetName(); - void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); - - /** - * Enabled/disables controls to prevent overwriting edited data upon receiving - * current data from server. - */ - void enableEditing(bool enable); - - - -private: - // map TexturePicker name => Edit Icon pointer should be visible while hovering Texture Picker - typedef std::map texture_edit_icon_map_t; - texture_edit_icon_map_t mTextureEditIconMap; }; #endif // LL_LLPANELMEPROFILE_H diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 5ce59d8959..c237bf1d06 100755 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -38,7 +38,6 @@ #include "llviewernetwork.h" static const std::string PANEL_PICKS = "panel_picks"; -static const std::string PANEL_PROFILE = "panel_profile"; std::string getProfileURL(const std::string& agent_name) { @@ -272,7 +271,6 @@ BOOL LLPanelProfile::postBuild() panel_picks->setProfilePanel(this); getTabContainer()[PANEL_PICKS] = panel_picks; - getTabContainer()[PANEL_PROFILE] = findChild(PANEL_PROFILE); return TRUE; } diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp deleted file mode 100644 index 7635aedf58..0000000000 --- a/indra/newview/llpanelprofileview.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/** -* @file llpanelprofileview.cpp -* @brief Side tray "Profile View" panel -* -* $LicenseInfo:firstyear=2009&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" - -#include "llpanelprofileview.h" - -#include "llavatarconstants.h" -#include "llavatarnamecache.h" // IDEVO -#include "llclipboard.h" -#include "lluserrelations.h" - -#include "llavatarpropertiesprocessor.h" -#include "llcallingcard.h" -#include "llpanelavatar.h" -#include "llpanelpicks.h" -#include "llpanelprofile.h" -#include "llsidetraypanelcontainer.h" - -static LLRegisterPanelClassWrapper t_panel_target_profile("panel_profile_view"); - -static std::string PANEL_NOTES = "panel_notes"; -static const std::string PANEL_PROFILE = "panel_profile"; -static const std::string PANEL_PICKS = "panel_picks"; - - -class AvatarStatusObserver : public LLAvatarPropertiesObserver -{ -public: - AvatarStatusObserver(LLPanelProfileView* profile_view) - { - mProfileView = profile_view; - } - - void processProperties(void* data, EAvatarProcessorType type) - { - if(APT_PROPERTIES != type) return; - const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && mProfileView->getAvatarId() == avatar_data->avatar_id) - { - mProfileView->processOnlineStatus(avatar_data->flags & AVATAR_ONLINE); - LLAvatarPropertiesProcessor::instance().removeObserver(mProfileView->getAvatarId(), this); - } - } - - void subscribe() - { - LLAvatarPropertiesProcessor::instance().addObserver(mProfileView->getAvatarId(), this); - } - -private: - LLPanelProfileView* mProfileView; -}; - -LLPanelProfileView::LLPanelProfileView() -: LLPanelProfile() -, mStatusText(NULL) -, mAvatarStatusObserver(NULL) -{ - mAvatarStatusObserver = new AvatarStatusObserver(this); -} - -LLPanelProfileView::~LLPanelProfileView(void) -{ - delete mAvatarStatusObserver; -} - -/*virtual*/ -void LLPanelProfileView::onOpen(const LLSD& key) -{ - LLUUID id; - if(key.has("id")) - { - id = key["id"]; - } - - if(id.notNull() && getAvatarId() != id) - { - setAvatarId(id); - - // clear name fields, which might have old data - getChild("user_name")->setValue( LLSD() ); - getChild("user_slid")->setValue( LLSD() ); - } - - // Update the avatar name. - LLAvatarNameCache::get(getAvatarId(), - boost::bind(&LLPanelProfileView::onAvatarNameCache, this, _1, _2)); - - updateOnlineStatus(); - - - LLPanelProfile::onOpen(key); -} - -BOOL LLPanelProfileView::postBuild() -{ - LLPanelProfile::postBuild(); - - getTabContainer()[PANEL_NOTES] = findChild(PANEL_NOTES); - - //*TODO remove this, according to style guide we don't use status combobox - getTabContainer()[PANEL_PROFILE]->getChildView("online_me_status_text")->setVisible( FALSE); - getTabContainer()[PANEL_PROFILE]->getChildView("status_combo")->setVisible( FALSE); - - mStatusText = getChild("status"); - mStatusText->setVisible(false); - - childSetCommitCallback("back",boost::bind(&LLPanelProfileView::onBackBtnClick,this),NULL); - childSetCommitCallback("copy_to_clipboard",boost::bind(&LLPanelProfileView::onCopyToClipboard,this),NULL); - - return TRUE; -} - - -//private - -void LLPanelProfileView::onBackBtnClick() -{ - // Set dummy value to make picks panel dirty, - // This will make Picks reload on next open. - getTabContainer()[PANEL_PICKS]->setValue(LLSD()); - - LLSideTrayPanelContainer* parent = dynamic_cast(getParent()); - if(parent) - { - parent->openPreviousPanel(); - } -} - -void LLPanelProfileView::onCopyToClipboard() -{ - std::string name = getChild("user_name")->getValue().asString() + " (" + getChild("user_slid")->getValue().asString() + ")"; - gClipboard.copyFromString(utf8str_to_wstring(name)); -} - -bool LLPanelProfileView::isGrantedToSeeOnlineStatus() -{ - const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - if (NULL == relationship) - return false; - - // *NOTE: GRANT_ONLINE_STATUS is always set to false while changing any other status. - // When avatar disallow me to see her online status processOfflineNotification Message is received by the viewer - // see comments for ChangeUserRights template message. EXT-453. - // If GRANT_ONLINE_STATUS flag is changed it will be applied when viewer restarts. EXT-3880 - return relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS); -} - -// method was disabled according to EXT-2022. Re-enabled & improved according to EXT-3880 -void LLPanelProfileView::updateOnlineStatus() -{ - // set text box visible to show online status for non-friends who has not set in Preferences - // "Only Friends & Groups can see when I am online" - mStatusText->setVisible(TRUE); - - const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - if (NULL == relationship) - { - // this is non-friend avatar. Status will be updated from LLAvatarPropertiesProcessor. - // in LLPanelProfileView::processOnlineStatus() - - // subscribe observer to get online status. Request will be sent by LLPanelAvatarProfile itself. - // do not subscribe for friend avatar because online status can be wrong overridden - // via LLAvatarData::flags if Preferences: "Only Friends & Groups can see when I am online" is set. - mAvatarStatusObserver->subscribe(); - return; - } - // For friend let check if he allowed me to see his status - - // status should only show if viewer has permission to view online/offline. EXT-453, EXT-3880 - mStatusText->setVisible(isGrantedToSeeOnlineStatus()); - - bool online = relationship->isOnline(); - processOnlineStatus(online); -} - -void LLPanelProfileView::processOnlineStatus(bool online) -{ - std::string status = getString(online ? "status_online" : "status_offline"); - - mStatusText->setValue(status); -} - -void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) -{ - getChild("user_name")->setValue( av_name.mDisplayName ); - getChild("user_name_small")->setValue( av_name.mDisplayName ); - getChild("user_slid")->setValue( av_name.mUsername ); - - // show smaller display name if too long to display in regular size - if (getChild("user_name")->getTextPixelWidth() > getChild("user_name")->getRect().getWidth()) - { - getChild("user_name_small")->setVisible( true ); - getChild("user_name")->setVisible( false ); - } - else - { - getChild("user_name_small")->setVisible( false ); - getChild("user_name")->setVisible( true ); - } - - if (LLAvatarNameCache::useDisplayNames()) - { - getChild("user_label")->setVisible( true ); - getChild("user_slid")->setVisible( true ); - getChild("display_name_label")->setVisible( true ); - getChild("copy_to_clipboard")->setVisible( true ); - getChild("copy_to_clipboard")->setEnabled( true ); - getChild("solo_username_label")->setVisible( false ); - } - else - { - getChild("user_label")->setVisible( false ); - getChild("user_slid")->setVisible( false ); - getChild("display_name_label")->setVisible( false ); - getChild("copy_to_clipboard")->setVisible( false ); - getChild("copy_to_clipboard")->setEnabled( false ); - getChild("solo_username_label")->setVisible( true ); - } -} - -// EOF diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h deleted file mode 100644 index c6d921fdc4..0000000000 --- a/indra/newview/llpanelprofileview.h +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @file llpanelprofileview.h -* @brief Side tray "Profile View" panel -* -* $LicenseInfo:firstyear=2009&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#ifndef LL_LLPANELPROFILEVIEW_H -#define LL_LLPANELPROFILEVIEW_H - -#include "llpanel.h" -#include "llpanelprofile.h" -#include "llavatarpropertiesprocessor.h" -#include "llagent.h" -#include "lltooldraganddrop.h" - -class LLAvatarName; -class LLPanelProfile; -class LLPanelProfileTab; -class LLTextBox; -class AvatarStatusObserver; - -/** -* Panel for displaying Avatar's profile. It consists of three sub panels - Profile, -* Picks and Notes. -*/ -class LLPanelProfileView : public LLPanelProfile -{ - LOG_CLASS(LLPanelProfileView); - friend class LLUICtrlFactory; - friend class AvatarStatusObserver; - -public: - - LLPanelProfileView(); - - /*virtual*/ ~LLPanelProfileView(); - - /*virtual*/ void onOpen(const LLSD& key); - - /*virtual*/ BOOL postBuild(); - - BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, - std::string& tooltip_msg) - { - LLToolDragAndDrop::handleGiveDragAndDrop(getAvatarId(), gAgent.getSessionID(), drop, - cargo_type, cargo_data, accept); - - return TRUE; - } - - -protected: - - void onBackBtnClick(); - void onCopyToClipboard(); - bool isGrantedToSeeOnlineStatus(); - - /** - * Displays avatar's online status if possible. - * - * Requirements from EXT-3880: - * For friends: - * - Online when online and privacy settings allow to show - * - Offline when offline and privacy settings allow to show - * - Else: nothing - * For other avatars: - * - Online when online and was not set in Preferences/"Only Friends & Groups can see when I am online" - * - Else: Offline - */ - void updateOnlineStatus(); - void processOnlineStatus(bool online); - -private: - // LLCacheName will call this function when avatar name is loaded from server. - // This is required to display names that have not been cached yet. -// void onNameCache( -// const LLUUID& id, -// const std::string& full_name, -// bool is_group); - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - - LLTextBox* mStatusText; - AvatarStatusObserver* mAvatarStatusObserver; -}; - -#endif //LL_LLPANELPROFILEVIEW_H diff --git a/indra/newview/skins/default/xui/da/panel_my_profile.xml b/indra/newview/skins/default/xui/da/panel_my_profile.xml deleted file mode 100644 index 94da58389f..0000000000 --- a/indra/newview/skins/default/xui/da/panel_my_profile.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - [REG_DATE] ([AGE]) - - - [NAME] - - - [DISPLAY_NAME] - - - - - - - - Brugernavn - - - Visningsnavn - - -- cgit v1.2.3 From 6e2c76221e9cc933eb6f40e71af359c3cf6c2063 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 21 Nov 2011 09:28:39 -0500 Subject: update build params --- BuildParams | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BuildParams b/BuildParams index 5068edb21f..3f5d6f8c6b 100755 --- a/BuildParams +++ b/BuildParams @@ -136,14 +136,6 @@ viewer-mesh.login_channel = "Project Viewer - Mesh" viewer-mesh.viewer_grid = aditi viewer-mesh.email = shining@lists.lindenlab.com - -# ======================================== -# CG -# ======================================== - -cg_viewer-development_lenny.show_changes_since = 4b140ce7839d -cg_viewer-development_lenny.email = cg@lindenlab.com - # ================ # oz # ================ @@ -151,20 +143,29 @@ cg_viewer-development_lenny.email = cg@lindenlab.com oz_viewer-devreview.build_debug_release_separately = true oz_viewer-devreview.codeticket_add_context = false oz_viewer-devreview.build_enforce_coding_policy = true +oz_viewer-devreview.email = oz@lindenlab.com oz_project-1.build_debug_release_separately = true oz_project-1.codeticket_add_context = false +oz_project-1.email = oz@lindenlab.com oz_project-2.build_debug_release_separately = true oz_project-2.codeticket_add_context = false +oz_project-2.email = oz@lindenlab.com oz_project-3.build_debug_release_separately = true oz_project-3.codeticket_add_context = false +oz_project-3.email = oz@lindenlab.com oz_project-4.build_debug_release_separately = true oz_project-4.codeticket_add_context = false +oz_project-4.email = oz@lindenlab.com +oz_project-5.build_debug_release_separately = true +oz_project-5.codeticket_add_context = false +oz_project-5.email = oz@lindenlab.com oz_viewer-beta-review.build_debug_release_separately = true oz_viewer-beta-review.codeticket_add_context = false oz_viewer-beta-review.viewer_channel = "Second Life Beta Viewer" oz_viewer-beta-review.login_channel = "Second Life Beta Viewer" +oz_viewer-beta-review.email = oz@lindenlab.com # ================================================================= # asset delivery 2010 projects -- cgit v1.2.3 From 8448f9d727a5cb4d6c9610684e1001fee8982ce2 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 21 Nov 2011 12:38:43 -0800 Subject: Moved snapshot to the bottom of the left toolbar per wolf --- indra/newview/app_settings/toolbars.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index 30be697436..8862355bfd 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -14,12 +14,12 @@ - + -- cgit v1.2.3 From b4766d2fde6b74c5a4a50cdde4373b5261a020e2 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 21 Nov 2011 14:42:21 -0700 Subject: fix for sh-2601: [crashhunters] crash in LLBufferArray::countAfter() sh-2602: [crashhunters] crash on exit in ~LLPumpIO() --- indra/llmessage/llcurl.cpp | 356 +++++++++++++++++++++------------- indra/llmessage/llcurl.h | 105 +++++++--- indra/llmessage/llurlrequest.cpp | 6 +- indra/newview/llappviewer.cpp | 5 + indra/newview/llxmlrpctransaction.cpp | 16 +- 5 files changed, 308 insertions(+), 180 deletions(-) diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 330028c926..7f61e1ac04 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -86,9 +86,7 @@ S32 gCurlMultiCount = 0; std::vector LLCurl::sSSLMutex; std::string LLCurl::sCAPath; std::string LLCurl::sCAFile; - -bool LLCurl::sMultiThreaded = false; -static U32 sMainThreadID = 0; +LLCurlThread* LLCurl::sCurlThread = NULL ; void check_curl_code(CURLcode code) { @@ -221,14 +219,11 @@ namespace boost std::set LLCurl::Easy::sFreeHandles; std::set LLCurl::Easy::sActiveHandles; -LLMutex* LLCurl::Easy::sHandleMutex = NULL; -LLMutex* LLCurl::Easy::sMultiMutex = NULL; //static CURL* LLCurl::Easy::allocEasyHandle() { CURL* ret = NULL; - LLMutexLock lock(sHandleMutex); if (sFreeHandles.empty()) { ret = curl_easy_init(); @@ -256,8 +251,6 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) llerrs << "handle cannot be NULL!" << llendl; } - LLMutexLock lock(sHandleMutex); - if (sActiveHandles.find(handle) != sActiveHandles.end()) { sActiveHandles.erase(handle); @@ -521,23 +514,13 @@ void LLCurl::Easy::prepRequest(const std::string& url, //////////////////////////////////////////////////////////////////////////// LLCurl::Multi::Multi() - : LLThread("Curl Multi"), - mQueued(0), + : mQueued(0), mErrorCount(0), - mPerformState(PERFORM_STATE_READY) + mState(STATE_READY), + mDead(FALSE), + mMutexp(NULL), + mDeletionMutexp(NULL) { - mQuitting = false; - - mThreaded = LLCurl::sMultiThreaded && LLThread::currentID() == sMainThreadID; - if (mThreaded) - { - mSignal = new LLCondition(NULL); - } - else - { - mSignal = NULL; - } - mCurlMultiHandle = curl_multi_init(); if (!mCurlMultiHandle) { @@ -545,22 +528,20 @@ LLCurl::Multi::Multi() mCurlMultiHandle = curl_multi_init(); } - llassert_always(mCurlMultiHandle); - ++gCurlMultiCount; -} - -LLCurl::Multi::~Multi() -{ - llassert(isStopped()); + llassert_always(mCurlMultiHandle); - if (LLCurl::sMultiThreaded) + if(LLCurl::getCurlThread()->getThreaded()) { - LLCurl::Easy::sMultiMutex->lock(); + mMutexp = new LLMutex(NULL) ; + mDeletionMutexp = new LLMutex(NULL) ; } + LLCurl::getCurlThread()->addMulti(this) ; - delete mSignal; - mSignal = NULL; + ++gCurlMultiCount; +} +LLCurl::Multi::~Multi() +{ // Clean up active for(easy_active_list_t::iterator iter = mEasyActiveList.begin(); iter != mEasyActiveList.end(); ++iter) @@ -577,75 +558,149 @@ LLCurl::Multi::~Multi() mEasyFreeList.clear(); check_curl_multi_code(curl_multi_cleanup(mCurlMultiHandle)); + + delete mMutexp ; + mMutexp = NULL ; + delete mDeletionMutexp ; + mDeletionMutexp = NULL ; + --gCurlMultiCount; +} - if (LLCurl::sMultiThreaded) +void LLCurl::Multi::lock() +{ + if(mMutexp) { - LLCurl::Easy::sMultiMutex->unlock(); + mMutexp->lock() ; } } -CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) +void LLCurl::Multi::unlock() { - CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue); - return curlmsg; + if(mMutexp) + { + mMutexp->unlock() ; + } } -void LLCurl::Multi::perform() +void LLCurl::Multi::markDead() { - if (mThreaded) + if(mDeletionMutexp) { - if (mPerformState == PERFORM_STATE_READY) - { - mSignal->signal(); - } + mDeletionMutexp->lock() ; } - else + + mDead = TRUE ; + + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } +} + +void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) +{ + lock() ; + mState = state ; + if(mState == STATE_READY) { - doPerform(); + LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ; } + unlock() ; } -void LLCurl::Multi::run() +LLCurl::Multi::ePerformState LLCurl::Multi::getState() { - llassert(mThreaded); + ePerformState state ; + + lock() ; + state = mState ; + unlock() ; + + return state ; +} + +bool LLCurl::Multi::isCompleted() +{ + return STATE_COMPLETED == getState() ; +} - while (!mQuitting) +bool LLCurl::Multi::waitToComplete() +{ + if(!mMutexp) //not threaded { - mSignal->wait(); - mPerformState = PERFORM_STATE_PERFORMING; - if (!mQuitting) - { - LLMutexLock lock(LLCurl::Easy::sMultiMutex); - doPerform(); - } + doPerform() ; + return true ; + } + + bool completed ; + + lock() ; + completed = (STATE_COMPLETED == mState) ; + if(!completed) + { + LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; } + unlock() ; + + return completed; } -void LLCurl::Multi::doPerform() +CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) { - S32 q = 0; - for (S32 call_count = 0; - call_count < MULTI_PERFORM_CALL_REPEAT; - call_count += 1) + CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue); + return curlmsg; +} + +//return true if dead +bool LLCurl::Multi::doPerform() +{ + if(mDeletionMutexp) + { + mDeletionMutexp->lock() ; + } + bool dead = mDead ; + + if(mDead) { - CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); - if (CURLM_CALL_MULTI_PERFORM != code || q == 0) + setState(STATE_COMPLETED); + mQueued = 0 ; + } + else if(getState() != STATE_COMPLETED) + { + setState(STATE_PERFORMING); + + S32 q = 0; + for (S32 call_count = 0; + call_count < MULTI_PERFORM_CALL_REPEAT; + call_count++) { - check_curl_multi_code(code); - break; + CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); + if (CURLM_CALL_MULTI_PERFORM != code || q == 0) + { + check_curl_multi_code(code); + + break; + } } - + + mQueued = q; + setState(STATE_COMPLETED) ; } - mQueued = q; - mPerformState = PERFORM_STATE_COMPLETED; + + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } + + return dead ; } S32 LLCurl::Multi::process() { - perform(); + waitToComplete() ; - if (mPerformState != PERFORM_STATE_COMPLETED) + if (getState() != STATE_COMPLETED) { return 0; } @@ -681,7 +736,8 @@ S32 LLCurl::Multi::process() } } - mPerformState = PERFORM_STATE_READY; + setState(STATE_READY); + return processed; } @@ -739,6 +795,75 @@ void LLCurl::Multi::removeEasy(Easy* easy) easyFree(easy); } +//------------------------------------------------------------ +//LLCurlThread +LLCurlThread::CurlRequest::CurlRequest(handle_t handle, LLCurl::Multi* multi) : + LLQueuedThread::QueuedRequest(handle, LLQueuedThread::PRIORITY_NORMAL, FLAG_AUTO_COMPLETE), + mMulti(multi) +{ +} + +LLCurlThread::CurlRequest::~CurlRequest() +{ + if(mMulti) + { + delete mMulti ; + mMulti = NULL ; + } +} + +bool LLCurlThread::CurlRequest::processRequest() +{ + bool completed = true ; + if(mMulti) + { + completed = mMulti->doPerform() ; + setPriority(LLQueuedThread::PRIORITY_LOW) ; + } + + return completed ; +} + +void LLCurlThread::CurlRequest::finishRequest(bool completed) +{ + delete mMulti ; + mMulti = NULL ; +} + +LLCurlThread::LLCurlThread(bool threaded) : + LLQueuedThread("curlthread", threaded) +{ +} + +//virtual +LLCurlThread::~LLCurlThread() +{ +} + +S32 LLCurlThread::update(U32 max_time_ms) +{ + return LLQueuedThread::update(max_time_ms); +} + +void LLCurlThread::addMulti(LLCurl::Multi* multi) +{ + multi->mHandle = generateHandle() ; + + CurlRequest* req = new CurlRequest(multi->mHandle, multi) ; + + if (!addRequest(req)) + { + llwarns << "curl request added when the thread is quitted" << llendl; + } +} + +void LLCurlThread::deleteMulti(LLCurl::Multi* multi) +{ + multi->markDead() ; +} + +//------------------------------------------------------------ + //static std::string LLCurl::strerror(CURLcode errorcode) { @@ -753,39 +878,23 @@ LLCurlRequest::LLCurlRequest() : mActiveMulti(NULL), mActiveRequestCount(0) { - mThreadID = LLThread::currentID(); mProcessing = FALSE; } LLCurlRequest::~LLCurlRequest() { - llassert_always(mThreadID == LLThread::currentID()); - //stop all Multi handle background threads for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ++iter) { - LLCurl::Multi* multi = *iter; - multi->mQuitting = true; - if (multi->mThreaded) - { - while (!multi->isStopped()) - { - multi->mSignal->signal(); - apr_sleep(1000); - } - } + LLCurl::getCurlThread()->deleteMulti(*iter) ; } - for_each(mMultiSet.begin(), mMultiSet.end(), DeletePointer()); + mMultiSet.clear() ; } void LLCurlRequest::addMulti() { - llassert_always(mThreadID == LLThread::currentID()); LLCurl::Multi* multi = new LLCurl::Multi(); - if (multi->mThreaded) - { - multi->start(); - } + mMultiSet.insert(multi); mActiveMulti = multi; mActiveRequestCount = 0; @@ -901,7 +1010,6 @@ bool LLCurlRequest::post(const std::string& url, // Note: call once per frame S32 LLCurlRequest::process() { - llassert_always(mThreadID == LLThread::currentID()); S32 res = 0; mProcessing = TRUE; @@ -915,17 +1023,7 @@ S32 LLCurlRequest::process() if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0) { mMultiSet.erase(curiter); - multi->mQuitting = true; - if (multi->mThreaded) - { - while (!multi->isStopped()) - { - multi->mSignal->signal(); - apr_sleep(1000); - } - } - - delete multi; + LLCurl::getCurlThread()->deleteMulti(multi); } } mProcessing = FALSE; @@ -934,7 +1032,6 @@ S32 LLCurlRequest::process() S32 LLCurlRequest::getQueued() { - llassert_always(mThreadID == LLThread::currentID()); S32 queued = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) @@ -942,7 +1039,7 @@ S32 LLCurlRequest::getQueued() curlmulti_set_t::iterator curiter = iter++; LLCurl::Multi* multi = *curiter; queued += multi->mQueued; - if (multi->mPerformState != LLCurl::Multi::PERFORM_STATE_READY) + if (multi->getState() != LLCurl::Multi::STATE_READY) { ++queued; } @@ -959,10 +1056,7 @@ LLCurlEasyRequest::LLCurlEasyRequest() mResultReturned(false) { mMulti = new LLCurl::Multi(); - if (mMulti->mThreaded) - { - mMulti->start(); - } + mEasy = mMulti->allocEasy(); if (mEasy) { @@ -975,16 +1069,7 @@ LLCurlEasyRequest::LLCurlEasyRequest() LLCurlEasyRequest::~LLCurlEasyRequest() { - mMulti->mQuitting = true; - if (mMulti->mThreaded) - { - while (!mMulti->isStopped()) - { - mMulti->mSignal->signal(); - apr_sleep(1000); - } - } - delete mMulti; + LLCurl::getCurlThread()->deleteMulti(mMulti) ; } void LLCurlEasyRequest::setopt(CURLoption option, S32 value) @@ -1080,19 +1165,14 @@ void LLCurlEasyRequest::requestComplete() } } -void LLCurlEasyRequest::perform() -{ - mMulti->perform(); -} - // Usage: Call getRestult until it returns false (no more messages) bool LLCurlEasyRequest::getResult(CURLcode* result, LLCurl::TransferInfo* info) { - if (mMulti->mPerformState != LLCurl::Multi::PERFORM_STATE_COMPLETED) + if (!mMulti->isCompleted()) { //we're busy, try again later return false; } - mMulti->mPerformState = LLCurl::Multi::PERFORM_STATE_READY; + mMulti->setState(LLCurl::Multi::STATE_READY) ; if (!mEasy) { @@ -1180,8 +1260,6 @@ unsigned long LLCurl::ssl_thread_id(void) void LLCurl::initClass(bool multi_threaded) { - sMainThreadID = LLThread::currentID(); - sMultiThreaded = multi_threaded; // Do not change this "unless you are familiar with and mean to control // internal operations of libcurl" // - http://curl.haxx.se/libcurl/c/curl_global_init.html @@ -1189,9 +1267,6 @@ void LLCurl::initClass(bool multi_threaded) check_curl_code(code); - Easy::sHandleMutex = new LLMutex(NULL); - Easy::sMultiMutex = new LLMutex(NULL); - #if SAFE_SSL S32 mutex_count = CRYPTO_num_locks(); for (S32 i=0; iupdate(1)) //finish all tasks + { + break ; + } + } + sCurlThread->shutdown() ; + delete sCurlThread ; + sCurlThread = NULL ; + #if SAFE_SSL CRYPTO_set_locking_callback(NULL); for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer()); #endif - delete Easy::sHandleMutex; - Easy::sHandleMutex = NULL; - delete Easy::sMultiMutex; - Easy::sMultiMutex = NULL; - for (std::set::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter) { CURL* curl = *iter; diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 87de202717..23a6ca67e3 100755 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -42,8 +42,10 @@ #include "lliopipe.h" #include "llsd.h" #include "llthread.h" +#include "llqueuedthread.h" class LLMutex; +class LLCurlThread; // For whatever reason, this is not typedef'd in curl.h typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream); @@ -56,8 +58,6 @@ public: class Easy; class Multi; - static bool sMultiThreaded; - struct TransferInfo { TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {} @@ -181,10 +181,12 @@ public: static void ssl_locking_callback(int mode, int type, const char *file, int line); static unsigned long ssl_thread_id(void); + static LLCurlThread* getCurlThread() { return sCurlThread ;} private: static std::string sCAPath; static std::string sCAFile; static const unsigned int MAX_REDIRECTS; + static LLCurlThread* sCurlThread; }; class LLCurl::Easy @@ -216,7 +218,7 @@ public: U32 report(CURLcode); void getTransferInfo(LLCurl::TransferInfo* info); - void prepRequest(const std::string& url, const std::vector& headers, ResponderPtr, S32 time_out = 0, bool post = false); + void prepRequest(const std::string& url, const std::vector& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false); const char* getErrorBuffer(); @@ -247,64 +249,105 @@ private: // Note: char*'s not strings since we pass pointers to curl std::vector mStrings; - ResponderPtr mResponder; + LLCurl::ResponderPtr mResponder; static std::set sFreeHandles; static std::set sActiveHandles; - static LLMutex* sHandleMutex; - static LLMutex* sMultiMutex; }; -class LLCurl::Multi : public LLThread +class LLCurl::Multi { LOG_CLASS(Multi); + + friend class LLCurlThread ; + +private: + ~Multi(); + + void markDead() ; + bool doPerform(); + public: typedef enum { - PERFORM_STATE_READY=0, - PERFORM_STATE_PERFORMING=1, - PERFORM_STATE_COMPLETED=2 + STATE_READY=0, + STATE_PERFORMING=1, + STATE_COMPLETED=2 } ePerformState; - Multi(); - ~Multi(); + Multi(); - Easy* allocEasy(); - bool addEasy(Easy* easy); + LLCurl::Easy* allocEasy(); + bool addEasy(LLCurl::Easy* easy); + void removeEasy(LLCurl::Easy* easy); - void removeEasy(Easy* easy); + void lock() ; + void unlock() ; + + void setState(ePerformState state) ; + ePerformState getState() ; + bool isCompleted() ; + + bool waitToComplete() ; S32 process(); - void perform(); - void doPerform(); - virtual void run(); - CURLMsg* info_read(S32* msgs_in_queue); S32 mQueued; S32 mErrorCount; - S32 mPerformState; - - LLCondition* mSignal; - bool mQuitting; - bool mThreaded; - private: - void easyFree(Easy*); + void easyFree(LLCurl::Easy*); CURLM* mCurlMultiHandle; - typedef std::set easy_active_list_t; + typedef std::set easy_active_list_t; easy_active_list_t mEasyActiveList; - typedef std::map easy_active_map_t; + typedef std::map easy_active_map_t; easy_active_map_t mEasyActiveMap; - typedef std::set easy_free_list_t; + typedef std::set easy_free_list_t; easy_free_list_t mEasyFreeList; + + LLQueuedThread::handle_t mHandle ; + ePerformState mState; + + BOOL mDead ; + LLMutex* mMutexp ; + LLMutex* mDeletionMutexp ; }; +class LLCurlThread : public LLQueuedThread +{ +public: + + class CurlRequest : public LLQueuedThread::QueuedRequest + { + protected: + virtual ~CurlRequest(); // use deleteRequest() + + public: + CurlRequest(handle_t handle, LLCurl::Multi* multi); + + /*virtual*/ bool processRequest(); + /*virtual*/ void finishRequest(bool completed); + + private: + // input + LLCurl::Multi* mMulti; + }; + +public: + LLCurlThread(bool threaded = true) ; + virtual ~LLCurlThread() ; + + S32 update(U32 max_time_ms); + + void addMulti(LLCurl::Multi* multi) ; + void deleteMulti(LLCurl::Multi* multi) ; +} ; + namespace boost { void intrusive_ptr_add_ref(LLCurl::Responder* p); @@ -339,7 +382,6 @@ private: LLCurl::Multi* mActiveMulti; S32 mActiveRequestCount; BOOL mProcessing; - U32 mThreadID; // debug }; class LLCurlEasyRequest @@ -357,9 +399,10 @@ public: void slist_append(const char* str); void sendRequest(const std::string& url); void requestComplete(); - void perform(); bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL); std::string getErrorString(); + bool isCompleted() {return mMulti->isCompleted() ;} + bool wait() { return mMulti->waitToComplete(); } LLCurl::Easy* getEasy() const { return mEasy; } diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index fa03bb7512..a3a2b2b1b8 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -170,6 +170,7 @@ LLURLRequest::~LLURLRequest() { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); delete mDetail; + mDetail = NULL ; } void LLURLRequest::setURL(const std::string& url) @@ -344,7 +345,10 @@ LLIOPipe::EStatus LLURLRequest::process_impl( static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform"); { LLFastTimer t(FTM_URL_PERFORM); - mDetail->mCurlRequest->perform(); + if(!mDetail->mCurlRequest->wait()) + { + return status ; + } } while(1) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c937f604fc..8b7108e1e2 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1417,6 +1417,11 @@ bool LLAppViewer::mainLoop() } } gMeshRepo.update() ; + + if(!LLCurl::getCurlThread()->update(1)) + { + LLCurl::getCurlThread()->pause() ; //nothing in the curl thread. + } if(!total_work_pending) //pause texture fetching threads if nothing to process. { diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index f483ba5af8..920a9a3752 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -382,19 +382,11 @@ bool LLXMLRPCTransaction::Impl::process() // continue onward } } - - //const F32 MAX_PROCESSING_TIME = 0.05f; - //LLTimer timer; - - mCurlRequest->perform(); - - /*while (mCurlRequest->perform() > 0) + + if(!mCurlRequest->wait()) { - if (timer.getElapsedTimeF32() >= MAX_PROCESSING_TIME) - { - return false; - } - }*/ + return false ; + } while(1) { -- cgit v1.2.3 From 08f364bfc9aaeb771145d660287427c41b1dc0bf Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 21 Nov 2011 16:00:52 -0600 Subject: SH-2708 Fix for broken shadows on alpha objects --- .../shaders/class1/deferred/shadowAlphaMaskF.glsl | 2 +- .../shaders/class1/deferred/shadowAlphaMaskV.glsl | 5 +++- indra/newview/lldrawpool.h | 1 - indra/newview/llviewershadermgr.cpp | 1 + indra/newview/llvovolume.cpp | 5 ---- indra/newview/pipeline.cpp | 27 ++++++++++++++++++---- indra/newview/pipeline.h | 3 +-- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 46d42d2a4a..c1fb7b55d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -37,7 +37,7 @@ VARYING vec2 vary_texcoord0; void main() { - float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a; + float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a; if (alpha < minimum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 6a3cba771b..7d3b06c56e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -34,15 +34,18 @@ VARYING vec4 post_pos; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +void passTextureIndex(); + void main() { //transform vertex vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0); - post_pos = pos; gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); + passTextureIndex(); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vertex_color = diffuse_color; } diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index c7acbb42c6..5a2981e749 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -133,7 +133,6 @@ public: PASS_ALPHA, PASS_ALPHA_MASK, PASS_FULLBRIGHT_ALPHA_MASK, - PASS_ALPHA_SHADOW, NUM_RENDER_TYPES, }; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 18ae83e3b6..bddc07b395 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1338,6 +1338,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader"; + gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredShadowAlphaMaskProgram.mShaderFiles.clear(); gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB)); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index baab191cb6..3d013f286c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4896,11 +4896,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { registerFace(group, facep, LLRenderPass::PASS_ALPHA); } - - if (LLPipeline::sRenderDeferred) - { - registerFace(group, facep, LLRenderPass::PASS_ALPHA_SHADOW); - } } else if (gPipeline.canUseVertexShaders() && group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d8e271811a..f3d5f94813 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6159,13 +6159,13 @@ void LLPipeline::resetVertexBuffers() LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping); } -void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture) +void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture) { LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS); assertInitialized(); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; - mSimplePool->pushBatches(type, mask); + mSimplePool->pushBatches(type, mask, texture, batch_texture); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; } @@ -8195,7 +8195,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera } LLPipeline::sShadowRender = TRUE; - U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP, LLRenderPass::PASS_FULLBRIGHT_SHINY }; + U32 types[] = { + LLRenderPass::PASS_SIMPLE, + LLRenderPass::PASS_FULLBRIGHT, + LLRenderPass::PASS_SHINY, + LLRenderPass::PASS_BUMP, + LLRenderPass::PASS_FULLBRIGHT_SHINY + }; + LLGLEnable cull(GL_CULL_FACE); if (use_shader) @@ -8267,7 +8274,15 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LLFastTimer ftm(FTM_SHADOW_ALPHA); gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f); - renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); + + U32 mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR | + LLVertexBuffer::MAP_TEXTURE_INDEX; + + renderObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE); + renderObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE); + renderObjects(LLRenderPass::PASS_ALPHA, mask, TRUE, TRUE); gDeferredTreeShadowProgram.bind(); gDeferredTreeShadowProgram.setMinimumAlpha(0.598f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); @@ -8589,7 +8604,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW, + LLPipeline::RENDER_TYPE_PASS_ALPHA, + LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK, + LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SIMPLE, LLPipeline::RENDER_TYPE_PASS_BUMP, diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 8b6532ca25..c6b2e20fa5 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -231,7 +231,7 @@ public: void postSort(LLCamera& camera); void forAllVisibleDrawables(void (*func)(LLDrawable*)); - void renderObjects(U32 type, U32 mask, BOOL texture = TRUE); + void renderObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE); void renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture); void grabReferences(LLCullResult& result); @@ -408,7 +408,6 @@ public: RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA, RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK, RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, - RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW, // Following are object types (only used in drawable mRenderType) RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES, RENDER_TYPE_VOLUME, -- cgit v1.2.3 From 1dd24cfcf85f4807410bb8d5320a692e2d7e121c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 21 Nov 2011 17:40:12 -0500 Subject: SH-2614 FIX, SH-2684 FIX - fixed buggy state management in onPhysicsUseLOD --- indra/newview/llfloatermodelpreview.cpp | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) mode change 100644 => 100755 indra/newview/llfloatermodelpreview.cpp diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp old mode 100644 new mode 100755 index 881f087d7b..49e29e7447 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -995,38 +995,38 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) //static void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { - S32 num_modes = 4; - S32 which_mode = 3; - static S32 previous_mode = which_mode; + S32 num_lods = 4; + S32 which_mode; LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo"); if (iface) { which_mode = iface->getFirstSelectedIndex(); } + else + { + llwarns << "no iface" << llendl; + return; + } - S32 file_mode = iface->getItemCount() - 1; - bool file_browse = which_mode == file_mode; - bool lod_to_file = file_browse && (previous_mode != file_mode); - bool file_to_lod = !file_browse && (previous_mode == file_mode); - - if (!lod_to_file) + if (which_mode <= 0) { - which_mode = num_modes - which_mode; - sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + llwarns << "which_mode out of range, " << which_mode << llendl; } - if (lod_to_file || file_to_lod) + S32 file_mode = iface->getItemCount() - 1; + if (which_mode < file_mode) { - LLModelPreview *model_preview = sInstance->mModelPreview; - if (model_preview) - { - model_preview->refresh(); - model_preview->updateStatusMessages(); - } + S32 which_lod = num_lods - which_mode; + sInstance->mModelPreview->setPhysicsFromLOD(which_lod); } - previous_mode = which_mode; + LLModelPreview *model_preview = sInstance->mModelPreview; + if (model_preview) + { + model_preview->refresh(); + model_preview->updateStatusMessages(); + } } //static -- cgit v1.2.3 From abf39f788609f65d1b2b3ac1548f7146aa5c8584 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 21 Nov 2011 15:15:26 -0800 Subject: Greatly reduced the number of memcpy operations done on the media plug-in message output pipe by removing 's = s.substr()' type operations. The output string is now cleared via 's.clear()' when its entire contents have been pumped and the beginning of the data is stored as an index when necessary, rather than modifying the initial string. Reviewed by davep. --- indra/llplugin/llpluginmessagepipe.cpp | 51 ++++++++++++++++++++++------------ indra/llplugin/llpluginmessagepipe.h | 1 + 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 8d13e38ad5..091e93ea4b 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -94,10 +94,10 @@ void LLPluginMessagePipeOwner::killMessagePipe(void) LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket): mInputMutex(gAPRPoolp), mOutputMutex(gAPRPoolp), + mOutputStartIndex(0), mOwner(owner), mSocket(socket) { - mOwner->setMessagePipe(this); } @@ -113,6 +113,14 @@ bool LLPluginMessagePipe::addMessage(const std::string &message) { // queue the message for later output LLMutexLock lock(&mOutputMutex); + + // If we're starting to use up too much memory, clear + if (mOutputStartIndex > 1024 * 1024) + { + mOutput = mOutput.substr(mOutputStartIndex); + mOutputStartIndex = 0; + } + mOutput += message; mOutput += MESSAGE_DELIMITER; // message separator @@ -165,35 +173,44 @@ bool LLPluginMessagePipe::pumpOutput() if(mSocket) { apr_status_t status; - apr_size_t size; + apr_size_t in_size, out_size; LLMutexLock lock(&mOutputMutex); - if(!mOutput.empty()) + + const char * output_data = &(mOutput.data()[mOutputStartIndex]); + if(*output_data != '\0') { // write any outgoing messages - size = (apr_size_t)mOutput.size(); + in_size = (apr_size_t) (mOutput.size() - mOutputStartIndex); + out_size = in_size; setSocketTimeout(0); // LL_INFOS("Plugin") << "before apr_socket_send, size = " << size << LL_ENDL; - status = apr_socket_send( - mSocket->getSocket(), - (const char*)mOutput.data(), - &size); + status = apr_socket_send(mSocket->getSocket(), + output_data, + &out_size); // LL_INFOS("Plugin") << "after apr_socket_send, size = " << size << LL_ENDL; - if(status == APR_SUCCESS) + if((status == APR_SUCCESS) || APR_STATUS_IS_EAGAIN(status)) { - // success - mOutput = mOutput.substr(size); - } - else if(APR_STATUS_IS_EAGAIN(status)) - { - // Socket buffer is full... - // remove the written part from the buffer and try again later. - mOutput = mOutput.substr(size); + // Success or Socket buffer is full... + + // If we've pumped the entire string, clear it + if (out_size == in_size) + { + mOutputStartIndex = 0; + mOutput.clear(); + } + else + { + llassert(in_size > out_size); + + // Remove the written part from the buffer and try again later. + mOutputStartIndex += out_size; + } } else if(APR_STATUS_IS_EOF(status)) { diff --git a/indra/llplugin/llpluginmessagepipe.h b/indra/llplugin/llpluginmessagepipe.h index beb942c0fe..059943cc90 100644 --- a/indra/llplugin/llpluginmessagepipe.h +++ b/indra/llplugin/llpluginmessagepipe.h @@ -86,6 +86,7 @@ protected: std::string mInput; LLMutex mOutputMutex; std::string mOutput; + std::string::size_type mOutputStartIndex; LLPluginMessagePipeOwner *mOwner; LLSocket::ptr_t mSocket; -- cgit v1.2.3 From 13ece17f1d177a90b09e66d81fd9b4a99496de11 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 21 Nov 2011 16:24:49 -0800 Subject: sync with viewer-development --- .../skins/default/xui/en/floater_model_preview.xml | 5 +- .../skins/default/xui/en/floater_snapshot.xml | 132 +++++++++++++++------ .../default/xui/en/panel_postcard_message.xml | 6 +- .../default/xui/en/panel_snapshot_inventory.xml | 5 +- .../skins/default/xui/en/panel_snapshot_local.xml | 17 ++- .../default/xui/en/panel_snapshot_options.xml | 64 ---------- .../default/xui/en/panel_snapshot_profile.xml | 4 +- 7 files changed, 120 insertions(+), 113 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index fbaf4f0a8a..eebc5ddc72 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -6,6 +6,7 @@ Error: Dae parsing issue - see log for details. + Error: Material of model is not a subset of reference model. Loading... Generating Meshes... Error: Vertex number is more than 65534, aborted! @@ -789,7 +790,7 @@ -->
- + - Step 2: Analyse + Step 2: Analyze - Your Profile Feed has been updated! + Profile feed updated! @@ -65,45 +65,15 @@ name="local_failed_str"> Failed to save to computer. - - - - + + +
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml index 792f6dbec8..d2f29ade44 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -81,68 +81,4 @@ - - - Succeeded - - - - - Failed - -
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml index 0760a33f82..ee79a4b3b8 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml @@ -119,7 +119,7 @@ Date: Mon, 21 Nov 2011 16:36:14 -0800 Subject: FIX INTL-82 LQA changes for Turkish and French --- .../default/xui/fr/panel_preferences_privacy.xml | 2 +- .../default/xui/fr/panel_preferences_sound.xml | 6 +- .../skins/default/xui/fr/panel_region_debug.xml | 2 +- indra/newview/skins/default/xui/fr/strings.xml | 2 +- .../newview/skins/default/xui/tr/floater_about.xml | 6 +- .../skins/default/xui/tr/floater_about_land.xml | 16 ++-- .../skins/default/xui/tr/floater_buy_land.xml | 4 +- .../default/xui/tr/floater_edit_day_cycle.xml | 4 +- .../xui/tr/floater_environment_settings.xml | 2 +- .../skins/default/xui/tr/floater_god_tools.xml | 2 +- .../skins/default/xui/tr/floater_joystick.xml | 8 +- .../skins/default/xui/tr/floater_preferences.xml | 2 +- .../default/xui/tr/floater_preview_gesture.xml | 2 +- .../skins/default/xui/tr/floater_report_abuse.xml | 2 +- .../newview/skins/default/xui/tr/floater_tools.xml | 6 +- indra/newview/skins/default/xui/tr/menu_viewer.xml | 4 +- .../newview/skins/default/xui/tr/notifications.xml | 2 +- .../newview/skins/default/xui/tr/panel_people.xml | 6 +- .../default/xui/tr/panel_preferences_advanced.xml | 4 +- .../default/xui/tr/panel_preferences_chat.xml | 4 +- .../default/xui/tr/panel_preferences_general.xml | 2 +- .../default/xui/tr/panel_preferences_graphics1.xml | 4 +- .../default/xui/tr/panel_preferences_privacy.xml | 2 +- .../skins/default/xui/tr/panel_region_debug.xml | 4 +- .../default/xui/tr/panel_region_environment.xml | 2 +- .../skins/default/xui/tr/panel_region_terrain.xml | 2 +- .../newview/skins/default/xui/tr/role_actions.xml | 2 +- .../skins/default/xui/tr/sidepanel_task_info.xml | 2 +- indra/newview/skins/default/xui/tr/strings.xml | 92 +++++++++++----------- 29 files changed, 99 insertions(+), 99 deletions(-) diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml index 3123a4c6fe..b122db9502 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml @@ -20,7 +20,7 @@ - Emplacement : + Emplacement des journaux : @@ -107,7 +107,7 @@ layout="topleft" left="335" name="btn_restore_defaults" - top="285" + top="330" width="130"> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index befcc5dd87..105c6095e6 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3675,6 +3675,7 @@ Try enclosing path to the editor with double quotes. Marketplace Mini-map Move + Merchant outbox People Picks Places @@ -3700,6 +3701,7 @@ Try enclosing path to the editor with double quotes. Go shopping Show nearby people Moving your avatar + Transfer items to your marketplace for sale Friends, groups, and nearby people Places to show as favorites in your profile Places you've saved -- cgit v1.2.3 From f2f90b6ed8e493a42aff805135527d6a7a345e3e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 30 Nov 2011 08:03:20 +0200 Subject: EXP-1636 FIXED Extend menubar label changes to floater titles and FUI button labels. --- indra/newview/llfloatercamera.cpp | 21 --------------------- indra/newview/llfloatercamera.h | 3 --- .../newview/skins/default/xui/da/floater_camera.xml | 9 --------- .../newview/skins/default/xui/de/floater_camera.xml | 9 --------- .../newview/skins/default/xui/en/floater_avatar.xml | 2 +- .../newview/skins/default/xui/en/floater_camera.xml | 14 +------------- .../skins/default/xui/en/floater_moveview.xml | 2 +- indra/newview/skins/default/xui/en/strings.xml | 4 ++-- .../newview/skins/default/xui/es/floater_camera.xml | 9 --------- .../newview/skins/default/xui/fr/floater_camera.xml | 9 --------- .../newview/skins/default/xui/it/floater_camera.xml | 9 --------- .../newview/skins/default/xui/ja/floater_camera.xml | 9 --------- .../newview/skins/default/xui/pl/floater_camera.xml | 9 --------- .../newview/skins/default/xui/pt/floater_camera.xml | 9 --------- .../newview/skins/default/xui/ru/floater_camera.xml | 9 --------- .../newview/skins/default/xui/tr/floater_camera.xml | 9 --------- .../newview/skins/default/xui/zh/floater_camera.xml | 9 --------- 17 files changed, 5 insertions(+), 140 deletions(-) diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index b33dea4890..313256e5ef 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -433,26 +433,6 @@ void LLFloaterCamera::setMode(ECameraControlMode mode) updateState(); } -void LLFloaterCamera::setModeTitle(const ECameraControlMode mode) -{ - std::string title; - switch(mode) - { - case CAMERA_CTRL_MODE_MODES: - title = getString("camera_modes_title"); - break; - case CAMERA_CTRL_MODE_PAN: - title = getString("pan_mode_title"); - break; - case CAMERA_CTRL_MODE_PRESETS: - title = getString("presets_mode_title"); - break; - default: - break; - } - setTitle(title); -} - void LLFloaterCamera::switchMode(ECameraControlMode mode) { setMode(mode); @@ -532,7 +512,6 @@ void LLFloaterCamera::updateState() { iter->second->setToggleState(iter->first == mCurrMode); } - setModeTitle(mCurrMode); } void LLFloaterCamera::updateItemsSelection() diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 4572932853..4d6d03f22d 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -102,9 +102,6 @@ private: /* sets a new mode preserving previous one and updates ui*/ void setMode(ECameraControlMode mode); - /** set title appropriate to passed mode */ - void setModeTitle(const ECameraControlMode mode); - /* updates the state (UI) according to the current mode */ void updateState(); diff --git a/indra/newview/skins/default/xui/da/floater_camera.xml b/indra/newview/skins/default/xui/da/floater_camera.xml index 5b7ef6db54..b5d5e8bc08 100644 --- a/indra/newview/skins/default/xui/da/floater_camera.xml +++ b/indra/newview/skins/default/xui/da/floater_camera.xml @@ -9,15 +9,6 @@ Flyt kamera op og ned, til venstre og højre - - Kamera valg - - - Kredsløb zoom panorering - - - Forvalg - Se objekt diff --git a/indra/newview/skins/default/xui/de/floater_camera.xml b/indra/newview/skins/default/xui/de/floater_camera.xml index bbf1c8af60..7e9ebdb643 100644 --- a/indra/newview/skins/default/xui/de/floater_camera.xml +++ b/indra/newview/skins/default/xui/de/floater_camera.xml @@ -9,15 +9,6 @@ Kamera nach oben, unten, links und rechts bewegen - - Kameramodi - - - Kreisen - Zoomen - Schwenken - - - Ansichten - Objekt ansehen diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml index 6009821f7f..82c3403008 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar.xml @@ -15,7 +15,7 @@ help_topic="avatar" save_rect="true" save_visibility="true" - title="AVATAR PICKER" + title="CHOOSE AN AVATAR" width="700"> @@ -29,18 +29,6 @@ name="move_tooltip"> Move Camera Up and Down, Left and Right - - Camera modes - - - Orbit Zoom Pan - - - Preset Views - View Object diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml index e96039a3e1..6ba812abff 100644 --- a/indra/newview/skins/default/xui/en/floater_moveview.xml +++ b/indra/newview/skins/default/xui/en/floater_moveview.xml @@ -16,7 +16,7 @@ save_visibility="true" single_instance="true" chrome="true" - title="MOVE" + title="WALK / RUN / FLY" width="133"> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index befcc5dd87..c25d1f57d6 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3674,7 +3674,7 @@ Try enclosing path to the editor with double quotes. Map Marketplace Mini-map - Move + Walk / run / fly People Picks Places @@ -3683,7 +3683,7 @@ Try enclosing path to the editor with double quotes. Search Snapshot Speak - View + Camera controls Voice settings Information about the land you're visiting diff --git a/indra/newview/skins/default/xui/es/floater_camera.xml b/indra/newview/skins/default/xui/es/floater_camera.xml index cdcb9a146b..f8911f3a4a 100644 --- a/indra/newview/skins/default/xui/es/floater_camera.xml +++ b/indra/newview/skins/default/xui/es/floater_camera.xml @@ -9,15 +9,6 @@ Mover la cámara arriba y abajo, izquierda y derecha - - Modos de cámara - - - Orbital - Zoom - Panorámica - - - Vistas predefinidas - Centrar el objeto diff --git a/indra/newview/skins/default/xui/fr/floater_camera.xml b/indra/newview/skins/default/xui/fr/floater_camera.xml index 97ff246c4d..77d3c2cfe4 100644 --- a/indra/newview/skins/default/xui/fr/floater_camera.xml +++ b/indra/newview/skins/default/xui/fr/floater_camera.xml @@ -9,15 +9,6 @@ Déplacer la caméra vers le haut et le bas, la gauche et la droite - - Modes - - - Rotation - Zoom - Panoramique - - - Préréglages - Voir l'objet diff --git a/indra/newview/skins/default/xui/it/floater_camera.xml b/indra/newview/skins/default/xui/it/floater_camera.xml index be4b8e210d..7e6ca4307e 100644 --- a/indra/newview/skins/default/xui/it/floater_camera.xml +++ b/indra/newview/skins/default/xui/it/floater_camera.xml @@ -9,15 +9,6 @@ Muovi la telecamera su e giù e a sinistra e destra - - Modalità della fotocamera - - - Ruota visuale - Ingrandisci - Panoramica - - - Visuali predefinite - Vedi oggetto diff --git a/indra/newview/skins/default/xui/ja/floater_camera.xml b/indra/newview/skins/default/xui/ja/floater_camera.xml index 5d3a048975..0661e17309 100644 --- a/indra/newview/skins/default/xui/ja/floater_camera.xml +++ b/indra/newview/skins/default/xui/ja/floater_camera.xml @@ -9,15 +9,6 @@ カメラを上下左å³ã«ç§»å‹• - - カメラモード - - - 旋回 - ズーム - 水平・垂直移動 - - - 事å‰è¨­å®šã®è¦–野 - オブジェクトを見る diff --git a/indra/newview/skins/default/xui/pl/floater_camera.xml b/indra/newview/skins/default/xui/pl/floater_camera.xml index 5b9dd47616..60f3cd0fff 100644 --- a/indra/newview/skins/default/xui/pl/floater_camera.xml +++ b/indra/newview/skins/default/xui/pl/floater_camera.xml @@ -9,15 +9,6 @@ Poruszaj kamerÄ… w dół/górÄ™ oraz w prawo/lewo - - Ustawienia - - - W prawo lub w lewo - - - Ustaw widok - Zobacz obiekt diff --git a/indra/newview/skins/default/xui/pt/floater_camera.xml b/indra/newview/skins/default/xui/pt/floater_camera.xml index 0e4fc1b455..6b66d01781 100644 --- a/indra/newview/skins/default/xui/pt/floater_camera.xml +++ b/indra/newview/skins/default/xui/pt/floater_camera.xml @@ -9,15 +9,6 @@ Mover a Câmera para Cima e para Baixo, para a Esquerda e para a Direita - - Modos de câmera - - - Pan zoom orbital - - - Ângulos predefinidos - Visualizar objeto diff --git a/indra/newview/skins/default/xui/ru/floater_camera.xml b/indra/newview/skins/default/xui/ru/floater_camera.xml index 7a1f530668..945a63c0eb 100644 --- a/indra/newview/skins/default/xui/ru/floater_camera.xml +++ b/indra/newview/skins/default/xui/ru/floater_camera.xml @@ -9,15 +9,6 @@ ПеремеÑтить камеру вверх, вниз, влево или вправо - - Режимы камеры - - - Вращение, приближение, Ñдвиг - - - Стандартные наÑтройки - Смотреть на объект diff --git a/indra/newview/skins/default/xui/tr/floater_camera.xml b/indra/newview/skins/default/xui/tr/floater_camera.xml index 4161e6ea52..c92d4e9db4 100644 --- a/indra/newview/skins/default/xui/tr/floater_camera.xml +++ b/indra/newview/skins/default/xui/tr/floater_camera.xml @@ -9,15 +9,6 @@ Kamerayı Yukarı ve AÅŸağı, Sola ve SaÄŸa Hareket Ettir - - Kamera modları - - - Yörünge - YakınlÅŸ. - Kamerayı Çvr. - - - Ön Ayarlı Görünümler - Nesneyi Göster diff --git a/indra/newview/skins/default/xui/zh/floater_camera.xml b/indra/newview/skins/default/xui/zh/floater_camera.xml index f4db20684c..b75474340c 100644 --- a/indra/newview/skins/default/xui/zh/floater_camera.xml +++ b/indra/newview/skins/default/xui/zh/floater_camera.xml @@ -9,15 +9,6 @@ Move Camera Up and Down, Left and Right - - æ”å½±æ©Ÿæ¨¡å¼ - - - 環繞縮放平移 - - - é è¨­è¦–角 - 視角物件 -- cgit v1.2.3 From 9771733ac9d2a624ac5fd4e84d60edffdcfd9ee3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 30 Nov 2011 08:18:52 +0200 Subject: EXP-1640 FIXED Fixed weirdly looking Snapshot floater in Italian and French locales. --- indra/newview/skins/default/xui/fr/floater_snapshot.xml | 2 +- indra/newview/skins/default/xui/it/floater_snapshot.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/skins/default/xui/fr/floater_snapshot.xml b/indra/newview/skins/default/xui/fr/floater_snapshot.xml index 34d0957b46..365ff77ff9 100644 --- a/indra/newview/skins/default/xui/fr/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/fr/floater_snapshot.xml @@ -1,5 +1,5 @@ - + inconnu diff --git a/indra/newview/skins/default/xui/it/floater_snapshot.xml b/indra/newview/skins/default/xui/it/floater_snapshot.xml index 5bff19e8d7..f1c5cc4caf 100644 --- a/indra/newview/skins/default/xui/it/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/it/floater_snapshot.xml @@ -1,5 +1,5 @@ - + sconosciuto -- cgit v1.2.3 From 19545f58ad868470ff04b452697161cd57025220 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 30 Nov 2011 08:35:25 +0200 Subject: EXP-1641 FIXED Snapshot floater doesn't persist between sessions anymore to avoid capturing login screen. --- indra/newview/skins/default/xui/en/floater_snapshot.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 85f65dedd3..61f2e7e72d 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -10,7 +10,7 @@ name="Snapshot" help_topic="snapshot" save_rect="true" - save_visibility="true" + save_visibility="false" title="SNAPSHOT PREVIEW" width="470"> Date: Tue, 29 Nov 2011 23:53:28 -0800 Subject: fix for crash on startup (font system not initialized when first creating fonts) --- indra/llrender/llfontfreetype.cpp | 7 +++++-- indra/newview/llviewerwindow.cpp | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 91c8a37022..66d4ad2d87 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -55,7 +55,10 @@ FT_Library gFTLibrary = NULL; //static void LLFontManager::initClass() { - gFontManagerp = new LLFontManager; + if (!gFontManagerp) + { + gFontManagerp = new LLFontManager; + } } //static @@ -136,7 +139,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v FT_Done_Face(mFTFace); mFTFace = NULL; } - + int error; error = FT_New_Face( gFTLibrary, diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2479006eeb..22076417a6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4745,6 +4745,9 @@ void LLViewerWindow::initFonts(F32 zoom_factor) { LLFontGL::destroyAllGL(); // Initialize with possibly different zoom factor + + LLFontManager::initClass(); + LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), mDisplayScale.mV[VX] * zoom_factor, mDisplayScale.mV[VY] * zoom_factor, -- cgit v1.2.3 From 93dbcb4dc8b22ebbdd7c97854b3559502c68ed43 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 30 Nov 2011 05:26:07 -0500 Subject: STORM-1719 notifications.xml has two instances where a button shows as "Ok" and Not "OK" --- doc/contributions.txt | 1 + indra/newview/skins/default/xui/en/notifications.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 9f6de781b4..ce1dc07c49 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -589,6 +589,7 @@ Jonathan Yap STORM-1659 STORM-1674 STORM-1685 + STORM-1719 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index e4458f33b1..4e4eea0354 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6939,7 +6939,7 @@ With the following Residents: + yestext="OK"/> -- cgit v1.2.3 From ac762b0426bf5b5e0edd5d725ba6c01a39cb0248 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 30 Nov 2011 19:37:12 +0200 Subject: EXP-1634 FIXED Removed the "exchange rates" link from the L$ Buy Dialog. --- indra/newview/skins/default/xui/da/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/de/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/en/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/es/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/fr/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/it/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/ja/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/pl/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/pt/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/ru/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/tr/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/zh/floater_buy_currency.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/indra/newview/skins/default/xui/da/floater_buy_currency.xml b/indra/newview/skins/default/xui/da/floater_buy_currency.xml index ec47b2f445..3c0428b2b0 100644 --- a/indra/newview/skins/default/xui/da/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/da/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Indtast beløbet for at se nyeste valutakurs. diff --git a/indra/newview/skins/default/xui/de/floater_buy_currency.xml b/indra/newview/skins/default/xui/de/floater_buy_currency.xml index 38321b7906..e766b622f7 100644 --- a/indra/newview/skins/default/xui/de/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/de/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT] L$ - [http://www.secondlife.com/my/account/payment_method_management.php?lang=de-DE Zahlungsart] | [http://www.secondlife.com/my/account/currency.php?lang=de-DE Währung] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=de-DE Umtauschrate] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=de-DE Zahlungsart] | [http://www.secondlife.com/my/account/currency.php?lang=de-DE Währung] Geben Sie den Betrag erneut ein, um die aktuellste Umtauschrate anzuzeigen. diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml index 49ca6cc8ba..6afa24d04a 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml @@ -224,7 +224,7 @@ width="300" height="30" name="currency_links"> - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] - [http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda] | [http://www.secondlife.com/my/account/exchange_rates.php tipo de cambio] + [http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda] Vuelve a escribir la cantidad para ver el tipo de cambio más reciente. diff --git a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml index b3acc83078..d9e8e8821d 100644 --- a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml @@ -47,7 +47,7 @@ le Lindex... [AMT] L$ - [http://www.secondlife.com/my/account/payment_method_management.php?lang=fr-FR mode de paiement] | [http://www.secondlife.com/my/account/currency.php?lang=fr-FR devise] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=fr-FR taux de change] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=fr-FR mode de paiement] | [http://www.secondlife.com/my/account/currency.php?lang=fr-FR devise] Saisissez à nouveau le montant pour voir le taux de change actuel. diff --git a/indra/newview/skins/default/xui/it/floater_buy_currency.xml b/indra/newview/skins/default/xui/it/floater_buy_currency.xml index 635b56d37a..d985ad2b3c 100644 --- a/indra/newview/skins/default/xui/it/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/it/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT]L$ - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Riscrivi l'importo per vedere l'ultimo tasso al cambio. diff --git a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml index 22af6e0ea2..e447eefe0e 100644 --- a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php?lang=ja-JP 支払方法] | [http://www.secondlife.com/my/account/currency.php?lang=ja-JP 通貨] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=ja-JP æ›ç®—レート] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=ja-JP 支払方法] | [http://www.secondlife.com/my/account/currency.php?lang=ja-JP 通貨] 金é¡ã‚’å†å…¥åŠ›ã—ã¦æœ€æ–°æ›ç®—レートを確èªã—ã¾ã™ã€‚ diff --git a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml index f2a6579dc3..3e51761b37 100644 --- a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT]L$ - [http://www.secondlife.com/my/account/payment_method_management.php metoda pÅ‚atnoÅ›ci] | [http://www.secondlife.com/my/account/currency.php waluta] | [http://www.secondlife.com/my/account/exchange_rates.php kurs wymiany] + [http://www.secondlife.com/my/account/payment_method_management.php metoda pÅ‚atnoÅ›ci] | [http://www.secondlife.com/my/account/currency.php waluta] Wpisz ponownie kwotÄ™ aby zobaczyć ostatni kurs wymiany. diff --git a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml index a737212b50..b5ba477fe5 100644 --- a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Digite o valor novamente para ver o câmbio atual. diff --git a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml index 7690ff2a6c..7d34ca3274 100644 --- a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php ÑпоÑоб оплаты] | [http://www.secondlife.com/my/account/currency.php валюта] | [http://www.secondlife.com/my/account/exchange_rates.php обменный курÑ] + [http://www.secondlife.com/my/account/payment_method_management.php ÑпоÑоб оплаты] | [http://www.secondlife.com/my/account/currency.php валюта] Повторно введите Ñумму, чтобы увидеть новый обменный курÑ. diff --git a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml index 48cd93ccf9..6608fd72e1 100644 --- a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi | [http://www.secondlife.com/my/account/exchange_rates.php döviz kurları] + [http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi En son döviz kurunu görmek için miktarı yeniden girin. diff --git a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml index d63e73c6f1..9f6591faf9 100644 --- a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Re-enter amount to see the latest exchange rate. -- cgit v1.2.3 From 83c3d378275e4da6f4aa0b148853abf770f73e86 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 30 Nov 2011 11:20:26 -0700 Subject: trivial: change a log info for memory failure for LLImageBase --- indra/llimage/llimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c239e3df88..56e01ac851 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -195,7 +195,7 @@ U8* LLImageBase::allocateData(S32 size) mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); if (!mData) { - llwarns << "allocate image data: " << size << llendl; + llwarns << "Failed to allocate image data size [" << size << "]" << llendl; size = 0 ; mWidth = mHeight = 0 ; mBadBufferAllocation = true ; -- cgit v1.2.3 From e6f5a57395a64b8dcfe85f20b0a63402c77a3c5f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 30 Nov 2011 11:21:22 -0700 Subject: fix for SH-2668: "ocean" water is always 20m high instead of the Region Water Height --- indra/newview/llworld.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6f6e0d2334..676287c0ad 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -818,14 +818,11 @@ void LLWorld::updateWaterObjects() max_x = (S32)region_x + range; max_y = (S32)region_y + range; - F32 height = 0.f; - for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; LLVOWater* waterp = regionp->getLand().getWaterObj(); - height += regionp->getWaterHeight(); if (waterp) { gObjectList.updateActive(waterp); @@ -842,6 +839,7 @@ void LLWorld::updateWaterObjects() // Now, get a list of the holes S32 x, y; + F32 water_height = gAgent.getRegion()->getWaterHeight() + 256.f; for (x = min_x; x <= max_x; x += rwidth) { for (y = min_y; y <= max_y; y += rwidth) @@ -853,7 +851,7 @@ void LLWorld::updateWaterObjects() waterp->setUseTexture(FALSE); waterp->setPositionGlobal(LLVector3d(x + rwidth/2, y + rwidth/2, - 256.f+DEFAULT_WATER_HEIGHT)); + water_height)); waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f)); gPipeline.createObject(waterp); mHoleWaterObjects.push_back(waterp); @@ -910,8 +908,7 @@ void LLWorld::updateWaterObjects() } waterp->setRegion(gAgent.getRegion()); - LLVector3d water_pos(water_center_x, water_center_y, - DEFAULT_WATER_HEIGHT+256.f); + LLVector3d water_pos(water_center_x, water_center_y, water_height) ; LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f); //stretch out to horizon -- cgit v1.2.3 From 8294179dbc7e2376fa7773a77e536e9a31479b87 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 30 Nov 2011 15:26:09 -0500 Subject: Added tag 3.2.4-start for changeset 3fe994349fae --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b863bbe37b..168ff66cf9 100644 --- a/.hgtags +++ b/.hgtags @@ -228,3 +228,4 @@ c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start 80f3e30d8aa4d8f674a48bd742aaa6d8e9eae0b5 3.2.3-start a8c7030d6845186fac7c188be4323a0e887b4184 DRTVWR-99_3.2.1-release a8c7030d6845186fac7c188be4323a0e887b4184 3.2.1-release +3fe994349fae64fc40874bb59db387131eb35a41 3.2.4-start -- cgit v1.2.3 From f5a94e0f8196c5c068995090cd57bb27e97aaac9 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 30 Nov 2011 15:27:00 -0500 Subject: increment viewer version to 3.2.5 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index b50405421d..deac3d1780 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 4; +const S32 LL_VERSION_PATCH = 5; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From d05e8361ccc60cfc0f269d63a5a0e6b0a06ec7c1 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 30 Nov 2011 15:01:54 -0800 Subject: sync with viewer-development --- indra/newview/skins/default/xui/da/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/de/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/en/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/en/floater_snapshot.xml | 2 +- indra/newview/skins/default/xui/es/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/fr/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/fr/floater_snapshot.xml | 2 +- indra/newview/skins/default/xui/it/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/it/floater_snapshot.xml | 2 +- indra/newview/skins/default/xui/ja/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/pl/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/pt/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/ru/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/tr/floater_buy_currency.xml | 2 +- indra/newview/skins/default/xui/zh/floater_buy_currency.xml | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/indra/newview/skins/default/xui/da/floater_buy_currency.xml b/indra/newview/skins/default/xui/da/floater_buy_currency.xml index ec47b2f445..3c0428b2b0 100644 --- a/indra/newview/skins/default/xui/da/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/da/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Indtast beløbet for at se nyeste valutakurs. diff --git a/indra/newview/skins/default/xui/de/floater_buy_currency.xml b/indra/newview/skins/default/xui/de/floater_buy_currency.xml index 38321b7906..e766b622f7 100644 --- a/indra/newview/skins/default/xui/de/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/de/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT] L$ - [http://www.secondlife.com/my/account/payment_method_management.php?lang=de-DE Zahlungsart] | [http://www.secondlife.com/my/account/currency.php?lang=de-DE Währung] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=de-DE Umtauschrate] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=de-DE Zahlungsart] | [http://www.secondlife.com/my/account/currency.php?lang=de-DE Währung] Geben Sie den Betrag erneut ein, um die aktuellste Umtauschrate anzuzeigen. diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml index 49ca6cc8ba..6afa24d04a 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml @@ -224,7 +224,7 @@ width="300" height="30" name="currency_links"> - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] - [http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda] | [http://www.secondlife.com/my/account/exchange_rates.php tipo de cambio] + [http://www.secondlife.com/my/account/payment_method_management.php método de pago] | [http://www.secondlife.com/my/account/currency.php moneda] Vuelve a escribir la cantidad para ver el tipo de cambio más reciente. diff --git a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml index b3acc83078..d9e8e8821d 100644 --- a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml @@ -47,7 +47,7 @@ le Lindex... [AMT] L$ - [http://www.secondlife.com/my/account/payment_method_management.php?lang=fr-FR mode de paiement] | [http://www.secondlife.com/my/account/currency.php?lang=fr-FR devise] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=fr-FR taux de change] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=fr-FR mode de paiement] | [http://www.secondlife.com/my/account/currency.php?lang=fr-FR devise] Saisissez à nouveau le montant pour voir le taux de change actuel. diff --git a/indra/newview/skins/default/xui/fr/floater_snapshot.xml b/indra/newview/skins/default/xui/fr/floater_snapshot.xml index 34d0957b46..365ff77ff9 100644 --- a/indra/newview/skins/default/xui/fr/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/fr/floater_snapshot.xml @@ -1,5 +1,5 @@ - + inconnu diff --git a/indra/newview/skins/default/xui/it/floater_buy_currency.xml b/indra/newview/skins/default/xui/it/floater_buy_currency.xml index 635b56d37a..d985ad2b3c 100644 --- a/indra/newview/skins/default/xui/it/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/it/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT]L$ - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Riscrivi l'importo per vedere l'ultimo tasso al cambio. diff --git a/indra/newview/skins/default/xui/it/floater_snapshot.xml b/indra/newview/skins/default/xui/it/floater_snapshot.xml index 5bff19e8d7..f1c5cc4caf 100644 --- a/indra/newview/skins/default/xui/it/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/it/floater_snapshot.xml @@ -1,5 +1,5 @@ - + sconosciuto diff --git a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml index 22af6e0ea2..e447eefe0e 100644 --- a/indra/newview/skins/default/xui/ja/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/ja/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php?lang=ja-JP 支払方法] | [http://www.secondlife.com/my/account/currency.php?lang=ja-JP 通貨] | [http://www.secondlife.com/my/account/exchange_rates.php?lang=ja-JP æ›ç®—レート] + [http://www.secondlife.com/my/account/payment_method_management.php?lang=ja-JP 支払方法] | [http://www.secondlife.com/my/account/currency.php?lang=ja-JP 通貨] 金é¡ã‚’å†å…¥åŠ›ã—ã¦æœ€æ–°æ›ç®—レートを確èªã—ã¾ã™ã€‚ diff --git a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml index f2a6579dc3..3e51761b37 100644 --- a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml @@ -46,7 +46,7 @@ [AMT]L$ - [http://www.secondlife.com/my/account/payment_method_management.php metoda pÅ‚atnoÅ›ci] | [http://www.secondlife.com/my/account/currency.php waluta] | [http://www.secondlife.com/my/account/exchange_rates.php kurs wymiany] + [http://www.secondlife.com/my/account/payment_method_management.php metoda pÅ‚atnoÅ›ci] | [http://www.secondlife.com/my/account/currency.php waluta] Wpisz ponownie kwotÄ™ aby zobaczyć ostatni kurs wymiany. diff --git a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml index a737212b50..b5ba477fe5 100644 --- a/indra/newview/skins/default/xui/pt/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/pt/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Digite o valor novamente para ver o câmbio atual. diff --git a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml index 7690ff2a6c..7d34ca3274 100644 --- a/indra/newview/skins/default/xui/ru/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/ru/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php ÑпоÑоб оплаты] | [http://www.secondlife.com/my/account/currency.php валюта] | [http://www.secondlife.com/my/account/exchange_rates.php обменный курÑ] + [http://www.secondlife.com/my/account/payment_method_management.php ÑпоÑоб оплаты] | [http://www.secondlife.com/my/account/currency.php валюта] Повторно введите Ñумму, чтобы увидеть новый обменный курÑ. diff --git a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml index 48cd93ccf9..6608fd72e1 100644 --- a/indra/newview/skins/default/xui/tr/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/tr/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi | [http://www.secondlife.com/my/account/exchange_rates.php döviz kurları] + [http://www.secondlife.com/my/account/payment_method_management.php ödeme yöntemi] | [http://www.secondlife.com/my/account/currency.php para birimi En son döviz kurunu görmek için miktarı yeniden girin. diff --git a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml index d63e73c6f1..9f6591faf9 100644 --- a/indra/newview/skins/default/xui/zh/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/zh/floater_buy_currency.xml @@ -46,7 +46,7 @@ L$ [AMT] - [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate] + [http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] Re-enter amount to see the latest exchange rate. -- cgit v1.2.3 From 0c54cf51db0c1a6e0b2ac91d69b2646570b168eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 30 Nov 2011 18:32:28 -0800 Subject: gcc fix attempt --- indra/llxuixml/llinitparam.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 80b6504c4f..7927f84cba 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -598,7 +598,7 @@ namespace LLInitParam } private: - friend BaseBlock; + friend class BaseBlock; U32 mEnclosingBlockOffset:31; U32 mIsProvided:1; @@ -736,7 +736,7 @@ namespace LLInitParam self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) { - if (NAME_VALUE_LOOKUP::getValueFromName(name, mValue)) + if (NAME_VALUE_LOOKUP::getValueFromName(name, *this)) { setValueName(name); } @@ -817,7 +817,7 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef param_value_t::value_assignment_t value_assignment_t; + typedef typename param_value_t::value_assignment_t value_assignment_t; typedef NAME_VALUE_LOOKUP name_value_lookup_t; using param_value_t::operator(); @@ -1261,7 +1261,7 @@ namespace LLInitParam setProvided(); } - void add(typename const name_value_lookup_t::name_t& name) + void add(const typename name_value_lookup_t::name_t& name) { value_t value; @@ -1447,7 +1447,7 @@ namespace LLInitParam setProvided(); } - void add(typename const name_value_lookup_t::name_t& name) + void add(const typename name_value_lookup_t::name_t& name) { value_t value; -- cgit v1.2.3 From 5535722ea5c2f64a25ca569c930e969f2e989af9 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 1 Dec 2011 12:31:56 +0000 Subject: STORM-1708 Linux UI additions --- indra/newview/llfilepicker.cpp | 14 +++++++++++++- indra/newview/skins/default/xui/en/strings.xml | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 3cbc4e5648..d259e02452 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -1197,7 +1197,12 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker) add_common_filters_to_gtkchooser(gfilter, picker, filtername); return filtername; } - + +static std::string add_script_filter_to_gtkchooser(GtkWindow *picker) +{ + return add_simple_mime_filter_to_gtkchooser(picker, "text/plain", + LLTrans::getString("script_files") + " (*.lsl)"); +} BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) { @@ -1263,6 +1268,10 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename LLTrans::getString("compressed_image_files") + " (*.j2c)"); suggest_ext = ".j2c"; break; + case FFSAVE_SCRIPT: + caption += add_script_filter_to_gtkchooser(picker); + suggest_ext = ".lsl"; + break; default:; break; } @@ -1328,6 +1337,9 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) case FFLOAD_IMAGE: filtername = add_imageload_filter_to_gtkchooser(picker); break; + case FFLOAD_SCRIPT: + filtername = add_script_filter_to_gtkchooser(picker); + break; default:; break; } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index befcc5dd87..0d26465dfa 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -427,9 +427,10 @@ Please try logging in again in a minute. Compressed Images Load Files Choose Directory + Scripts - - + Sleeps script for [SLEEP_TIME] seconds. -- cgit v1.2.3 From 47e493f5f8ed6b06d4920b7679b1e00c2e3a9229 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 1 Dec 2011 09:49:06 -0500 Subject: STORM-1721 Set UI Size to Default Option Duplicated in Advanced Menu --- doc/contributions.txt | 1 + indra/newview/skins/default/xui/en/menu_viewer.xml | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 9f6de781b4..ec329b0171 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -589,6 +589,7 @@ Jonathan Yap STORM-1659 STORM-1674 STORM-1685 + STORM-1721 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index c8c1922bf6..3a581e7e6e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1723,12 +1723,6 @@ function="Tools.EnableReleaseKeys" parameter="" /> - - - Date: Thu, 1 Dec 2011 18:14:22 +0200 Subject: EXP-1639 WIP Added debugging messages. --- indra/newview/llfloatersnapshot.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index ad571451f3..80fc5fcdfc 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1416,7 +1416,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards - //lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; @@ -1872,6 +1872,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL getPreviewView(view)->updateSnapshot(FALSE, TRUE); if(do_update) { + lldebugs << "Will update controls" << llendl; updateControls(view); setNeedRefresh(view, true); } @@ -2427,6 +2428,7 @@ void LLFloaterSnapshot::update() { changed |= LLSnapshotLivePreview::onIdle(*iter); } + lldebugs << "changed: " << changed << llendl; if(changed) { inst->impl.updateControls(inst); -- cgit v1.2.3 From c1e306b83e0dc8c24dc23f32a1df0700ed9bef3c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 1 Dec 2011 13:15:24 -0500 Subject: storm-1686: make "Neck" and "Avatar Center" attach points available in context menus --- indra/newview/character/avatar_lad.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 6641c80b94..99dbfcae51 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -395,7 +395,7 @@ Date: Thu, 1 Dec 2011 10:42:15 -0800 Subject: Build fixes for mac, hopefully Linux too --- indra/llui/llhandle.h | 2 +- indra/llxuixml/llinitparam.h | 2 +- indra/llxuixml/llxuiparser.cpp | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index e6390ee599..37c657dd92 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -166,7 +166,7 @@ protected: } template - typename LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const + LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const { LLHandle downcast_handle; downcast_handle.mTombStone = getHandle().mTombStone; diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 7927f84cba..ab20957760 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -764,7 +764,7 @@ namespace LLInitParam { if (NAME_VALUE_LOOKUP::getValueFromName(val, mValue)) { - setValueName(val); + NAME_VALUE_LOOKUP::setValueName(val); } else { diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 90c2671242..58654dcc21 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -129,7 +129,7 @@ struct Any : public LLInitParam::Block struct All : public LLInitParam::Block { - Multiple> elements; + Multiple< Lazy > elements; All() : elements("element") @@ -140,11 +140,11 @@ struct All : public LLInitParam::Block struct Choice : public LLInitParam::ChoiceBlock { - Alternative> element; - Alternative> group; - Alternative> choice; - Alternative> sequence; - Alternative> any; + Alternative< Lazy > element; + Alternative< Lazy > group; + Alternative< Lazy > choice; + Alternative< Lazy > sequence; + Alternative< Lazy > any; Choice() : element("element"), @@ -158,11 +158,11 @@ struct Choice : public LLInitParam::ChoiceBlock struct Sequence : public LLInitParam::ChoiceBlock { - Alternative> element; - Alternative> group; - Alternative> choice; - Alternative> sequence; - Alternative> any; + Alternative< Lazy > element; + Alternative< Lazy > group; + Alternative< Lazy > choice; + Alternative< Lazy > sequence; + Alternative< Lazy > any; }; struct GroupContents : public LLInitParam::ChoiceBlock @@ -247,7 +247,7 @@ struct ComplexType : public LLInitParam::Block Optional mixed; Multiple attribute; - Multiple> elements; + Multiple< Lazy > elements; ComplexType() : name("name"), -- cgit v1.2.3 From 03eca4ac461927e9d053941982d774690ffed176 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Dec 2011 10:44:21 -0800 Subject: EXP-1588 FIX Floaters do not snap to edge --- indra/newview/lltoolbarview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 5ff0ccfeb2..3872444e8f 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -530,6 +530,11 @@ void LLToolBarView::draw() } } + for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++) + { + mToolbars[i]->getParent()->setVisible(mToolbars[i]->hasButtons() || isToolDragged()); + } + // Draw drop zones if drop of a tool is active if (isToolDragged()) { -- cgit v1.2.3 From 8aa0ef2636b15e0e8a4e15df3169a17b2d15e8d2 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 1 Dec 2011 12:06:47 -0700 Subject: fix for SH-2560: Nearby avatar textures fail to load and SH-2671: sometimes other avatar textures don't load --- indra/newview/llviewertexture.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 786e2b73b1..b0f5361a79 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2269,6 +2269,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: } } mPauseLoadedCallBacks = FALSE ; + mLastCallBackActiveTime = sCurrentTime ; if(need_raw) { mSaveRawImage = TRUE ; @@ -2310,6 +2311,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() { static const F32 MAX_INACTIVE_TIME = 120.f ; //seconds + if(mPauseLoadedCallBacks) + { + destroyRawImage(); + return false; //paused + } if (mNeedsCreateTexture) { return false; @@ -2337,12 +2343,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // Remove ourself from the global list of textures with callbacks gTextureList.mCallbackList.erase(this); - } - if(mPauseLoadedCallBacks) - { - destroyRawImage(); - return res; //paused - } + } S32 gl_discard = getDiscardLevel(); @@ -2604,7 +2605,11 @@ bool LLViewerFetchedTexture::needsToSaveRawImage() void LLViewerFetchedTexture::destroyRawImage() { - if (mAuxRawImage.notNull()) sAuxCount--; + if (mAuxRawImage.notNull()) + { + sAuxCount--; + mAuxRawImage = NULL; + } if (mRawImage.notNull()) { @@ -2618,12 +2623,12 @@ void LLViewerFetchedTexture::destroyRawImage() } setCachedRawImage() ; } + + mRawImage = NULL; + + mIsRawImageValid = FALSE; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } - - mRawImage = NULL; - mAuxRawImage = NULL; - mIsRawImageValid = FALSE; - mRawDiscardLevel = INVALID_DISCARD_LEVEL; } //use the mCachedRawImage to (re)generate the gl texture. -- cgit v1.2.3 From 95fb0249e9f43d907608cc5840d1f8c0e49981d0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Dec 2011 16:50:27 -0500 Subject: LLSD-14: Move LLSD::(outstanding|allocation)Count() to free functions. Free functions can be unconditionally compiled into the .o file, but conditionally hidden in the header file. Static class methods don't have that flexibility: without a declaration in the header file, you can't compile a function definition in the .cpp file. That makes it awkward to use the same llcommon build for production and for unit tests. Why make the function declarations conditional at all? These are debugging functions. They break the abstraction, they peek under the covers. Production code should not use them. Making them conditional on an #ifdef symbol in the unit-test source file means the compiler would reject any use by production code. Put differently, it allows us to assert with confidence that only unit tests do use them. Put new free functions in (lowercase) llsd namespace so as not to clutter global namespace. Tweak the one known consumer (llsd_new_tut.cpp) accordingly. --- indra/llcommon/llsd.cpp | 14 ++++++++------ indra/llcommon/llsd.h | 30 +++++++++++++++++------------- indra/test/llsd_new_tut.cpp | 13 +++++++------ 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 1bd5d06d29..08cb7bd2a8 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -91,7 +91,7 @@ protected: bool shared() const { return (mUseCount > 1) && (mUseCount != STATIC_USAGE_COUNT); } U32 mUseCount; - + public: static void reset(Impl*& var, Impl* impl); ///< safely set var to refer to the new impl (possibly shared) @@ -901,11 +901,6 @@ LLSD& LLSD::operator[](Integer i) const LLSD& LLSD::operator[](Integer i) const { return safe(impl).ref(i); } -#ifdef LLSD_DEBUG_INFO -U32 LLSD::allocationCount() { return Impl::sAllocationCount; } -U32 LLSD::outstandingCount() { return Impl::sOutstandingCount; } -#endif - static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) { // sStorage is used to hold the string representation of the llsd last @@ -954,6 +949,13 @@ LLSD::array_iterator LLSD::endArray() { return makeArray(impl).endArray(); } LLSD::array_const_iterator LLSD::beginArray() const{ return safe(impl).beginArray(); } LLSD::array_const_iterator LLSD::endArray() const { return safe(impl).endArray(); } +namespace llsd +{ + +U32 allocationCount() { return LLSD::Impl::sAllocationCount; } +U32 outstandingCount() { return LLSD::Impl::sOutstandingCount; } + +} // namespace llsd // Diagnostic dump of contents in an LLSD object #ifdef LLSD_DEBUG_INFO diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 3519b134c2..ae083dd629 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -389,19 +389,6 @@ private: Impl* impl; friend class LLSD::Impl; //@} - - /** @name Unit Testing Interface */ - //@{ -public: -#ifdef LLSD_DEBUG_INFO - /// @warn THESE COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED - /// ENVIRONMENT. - /// - /// These counts track LLSD::Impl (hidden) objects. - static U32 allocationCount(); ///< how many Impls have been made - static U32 outstandingCount(); ///< how many Impls are still alive -#endif - //@} private: /** @name Debugging Interface */ @@ -475,6 +462,23 @@ struct llsd_select_string : public std::unary_function LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd); +namespace llsd +{ + +/** @name Unit Testing Interface */ +//@{ +#ifdef LLSD_DEBUG_INFO + /// @warn THESE COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED + /// ENVIRONMENT. + /// + /// These counts track LLSD::Impl (hidden) objects. + LL_COMMON_API U32 allocationCount(); ///< how many Impls have been made + LL_COMMON_API U32 outstandingCount(); ///< how many Impls are still alive +#endif +//@} + +} // namespace llsd + /** QUESTIONS & TO DOS - Would Binary be more convenient as unsigned char* buffer semantics? - Should Binary be convertible to/from String, and if so how? diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp index f332ad0ee2..b55a562e98 100644 --- a/indra/test/llsd_new_tut.cpp +++ b/indra/test/llsd_new_tut.cpp @@ -25,6 +25,7 @@ * $/LicenseInfo$ */ +#define LLSD_DEBUG_INFO #include #include "linden_common.h" #include "lltut.h" @@ -39,11 +40,11 @@ namespace tut private: U32 mOutstandingAtStart; public: - SDCleanupCheck() : mOutstandingAtStart(LLSD::outstandingCount()) { } + SDCleanupCheck() : mOutstandingAtStart(llsd::outstandingCount()) { } ~SDCleanupCheck() { ensure_equals("SDCleanupCheck", - LLSD::outstandingCount(), mOutstandingAtStart); + llsd::outstandingCount(), mOutstandingAtStart); } }; @@ -57,12 +58,12 @@ namespace tut SDAllocationCheck(const std::string& message, int expectedAllocations) : mMessage(message), mExpectedAllocations(expectedAllocations), - mAllocationAtStart(LLSD::allocationCount()) + mAllocationAtStart(llsd::allocationCount()) { } ~SDAllocationCheck() { ensure_equals(mMessage + " SDAllocationCheck", - LLSD::allocationCount() - mAllocationAtStart, + llsd::allocationCount() - mAllocationAtStart, mExpectedAllocations); } }; @@ -746,7 +747,7 @@ namespace tut { SDAllocationCheck check("shared values test for threaded work", 9); - //U32 start_llsd_count = LLSD::outstandingCount(); + //U32 start_llsd_count = llsd::outstandingCount(); LLSD m = LLSD::emptyMap(); @@ -773,7 +774,7 @@ namespace tut m["string_two"] = "string two value"; m["string_one_copy"] = m["string_one"]; // 9 - //U32 llsd_object_count = LLSD::outstandingCount(); + //U32 llsd_object_count = llsd::outstandingCount(); //std::cout << "Using " << (llsd_object_count - start_llsd_count) << " LLSD objects" << std::endl; //m.dumpStats(); -- cgit v1.2.3 From c9c03ffa0ca21eeb2786920cf9c0cb547be8a468 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 1 Dec 2011 14:52:37 -0700 Subject: fix for sh-2735: LLCurl causes SL to freeze when logout --- indra/newview/llappviewer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9d40a8a60e..e80475f096 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1781,6 +1781,7 @@ bool LLAppViewer::cleanup() pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread pending += LLVFSThread::updateClass(0); pending += LLLFSThread::updateClass(0); + pending += LLCurl::getCurlThread()->update(1) ; F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) { @@ -1792,6 +1793,7 @@ bool LLAppViewer::cleanup() break; } } + LLCurl::getCurlThread()->pause() ; // Delete workers first // shotdown all worker threads before deleting them in case of co-dependencies -- cgit v1.2.3 From 587a1a425a8e57139a863d5c4a37de108afa6d40 Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 1 Dec 2011 14:19:52 -0800 Subject: EXP-1649 FIX (client) Turn off web loading spinner until a more visually pleasing one can be defined --- autobuild.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index bb6de76d7a..11c57f43fb 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1206,9 +1206,9 @@ archive hash - 4b144790799df284f2ebe739a21aa4ec + 26aa7c367ffadd573f61a6a96f820f80 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245528/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111118.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111201.tar.bz2 name darwin @@ -1230,9 +1230,9 @@ archive hash - 60a36c75456eaffc4858bc11df1c49a9 + d7743d42de9a5e48809dedf4b64e53e4 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245528/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111118.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111201.tar.bz2 name windows -- cgit v1.2.3 From 57311704c8211e3899dd10e2a8f33ae145ac1916 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 1 Dec 2011 15:07:34 -0800 Subject: FIX VWR-25381 --- indra/newview/skins/default/xui/es/panel_navigation_bar.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml index 1b7f5d5a9f..d36c6283bc 100644 --- a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml @@ -3,7 +3,7 @@ - + " + // which equates to the following nesting: + // button + // param + // nested_param1 + // nested_param2 + // nested_param3 + mCurReadDepth++; + for(LLXMLNodePtr childp = nodep->getFirstChild(); childp.notNull();) + { + std::string child_name(childp->getName()->mString); + S32 num_tokens_pushed = 0; + + // for non "dotted" child nodes check to see if child node maps to another widget type + // and if not, treat as a child element of the current node + // e.g. will interpret as "button.rect" + // since there is no widget named "rect" + if (child_name.find(".") == std::string::npos) + { + mNameStack.push_back(std::make_pair(child_name, true)); + num_tokens_pushed++; + } + else + { + // parse out "dotted" name into individual tokens + tokenizer name_tokens(child_name, sep); + + tokenizer::iterator name_token_it = name_tokens.begin(); + if(name_token_it == name_tokens.end()) + { + childp = childp->getNextSibling(); + continue; + } + + // check for proper nesting + if (mNameStack.empty()) + { + if (*name_token_it != mRootNodeName) + { + childp = childp->getNextSibling(); + continue; + } + } + else if(mNameStack.back().first != *name_token_it) + { + childp = childp->getNextSibling(); + continue; + } + + // now ignore first token + ++name_token_it; + + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, true)); + num_tokens_pushed++; + } + } + + // recurse and visit children XML nodes + if(readXUIImpl(childp, block)) + { + // child node successfully parsed, remove from DOM + + values_parsed = true; + LLXMLNodePtr node_to_remove = childp; + childp = childp->getNextSibling(); + + nodep->deleteChild(node_to_remove); + } + else + { + childp = childp->getNextSibling(); + } + + while(num_tokens_pushed-- > 0) + { + mNameStack.pop_back(); + } + } + mCurReadDepth--; + return values_parsed; +} + +bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) +{ + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("."); + + bool any_parsed = false; + bool silent = mCurReadDepth > 0; + + for(LLXMLAttribList::const_iterator attribute_it = nodep->mAttributes.begin(); + attribute_it != nodep->mAttributes.end(); + ++attribute_it) + { + S32 num_tokens_pushed = 0; + std::string attribute_name(attribute_it->first->mString); + mCurReadNode = attribute_it->second; + + tokenizer name_tokens(attribute_name, sep); + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, true)); + num_tokens_pushed++; + } + + // child nodes are not necessarily valid attributes, so don't complain once we've recursed + any_parsed |= block.submitValue(mNameStack, *this, silent); + + while(num_tokens_pushed-- > 0) + { + mNameStack.pop_back(); + } + } + + return any_parsed; +} + +void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block) +{ + mWriteRootNode = node; + name_stack_t name_stack = Parser::name_stack_t(); + block.serializeBlock(*this, name_stack, diff_block); + mOutNodes.clear(); +} + +// go from a stack of names to a specific XML node +LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) +{ + LLXMLNodePtr out_node = mWriteRootNode; + + name_stack_t::iterator next_it = stack.begin(); + for (name_stack_t::iterator it = stack.begin(); + it != stack.end(); + it = next_it) + { + ++next_it; + if (it->first.empty()) + { + it->second = false; + continue; + } + + out_nodes_t::iterator found_it = mOutNodes.find(it->first); + + // node with this name not yet written + if (found_it == mOutNodes.end() || it->second) + { + // make an attribute if we are the last element on the name stack + bool is_attribute = next_it == stack.end(); + LLXMLNodePtr new_node = new LLXMLNode(it->first.c_str(), is_attribute); + out_node->addChild(new_node); + mOutNodes[it->first] = new_node; + out_node = new_node; + it->second = false; + } + else + { + out_node = found_it->second; + } + } + + return (out_node == mWriteRootNode ? LLXMLNodePtr(NULL) : out_node); +} + +bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode == DUMMY_NODE; +} + +bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + // just create node + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + return node.notNull(); +} + +bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) +{ + S32 value; + LLXUIParser& self = static_cast(parser); + bool success = self.mCurReadNode->getBoolValue(1, &value); + *((bool*)val_ptr) = (value != FALSE); + return success; +} + +bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setBoolValue(*((bool*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readStringValue(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + *((std::string*)val_ptr) = self.mCurReadNode->getSanitizedValue(); + return true; +} + +bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + const std::string* string_val = reinterpret_cast(val_ptr); + if (string_val->find('\n') != std::string::npos + || string_val->size() > MAX_STRING_ATTRIBUTE_SIZE) + { + // don't write strings with newlines into attributes + std::string attribute_name = node->getName()->mString; + LLXMLNodePtr parent_node = node->mParent; + parent_node->deleteChild(node); + // write results in text contents of node + if (attribute_name == "value") + { + // "value" is implicit, just write to parent + node = parent_node; + } + else + { + // create a child that is not an attribute, but with same name + node = parent_node->createChild(attribute_name.c_str(), false); + } + } + node->setStringValue(*string_val); + return true; + } + return false; +} + +bool LLXUIParser::readU8Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode->getByteValue(1, (U8*)val_ptr); +} + +bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setUnsignedValue(*((U8*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readS8Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + S32 value; + if(self.mCurReadNode->getIntValue(1, &value)) + { + *((S8*)val_ptr) = value; + return true; + } + return false; +} + +bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setIntValue(*((S8*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readU16Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + U32 value; + if(self.mCurReadNode->getUnsignedValue(1, &value)) + { + *((U16*)val_ptr) = value; + return true; + } + return false; +} + +bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setUnsignedValue(*((U16*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readS16Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + S32 value; + if(self.mCurReadNode->getIntValue(1, &value)) + { + *((S16*)val_ptr) = value; + return true; + } + return false; +} + +bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setIntValue(*((S16*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readU32Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode->getUnsignedValue(1, (U32*)val_ptr); +} + +bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setUnsignedValue(*((U32*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readS32Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode->getIntValue(1, (S32*)val_ptr); +} + +bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setIntValue(*((S32*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readF32Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode->getFloatValue(1, (F32*)val_ptr); +} + +bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setFloatValue(*((F32*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readF64Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + return self.mCurReadNode->getDoubleValue(1, (F64*)val_ptr); +} + +bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setDoubleValue(*((F64*)val_ptr)); + return true; + } + return false; +} + +bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + LLColor4* colorp = (LLColor4*)val_ptr; + if(self.mCurReadNode->getFloatValue(4, colorp->mV) >= 3) + { + return true; + } + + return false; +} + +bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + LLColor4 color = *((LLColor4*)val_ptr); + node->setFloatValue(4, color.mV); + return true; + } + return false; +} + +bool LLXUIParser::readUIColorValue(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + LLUIColor* param = (LLUIColor*)val_ptr; + LLColor4 color; + bool success = self.mCurReadNode->getFloatValue(4, color.mV) >= 3; + if (success) + { + param->set(color); + return true; + } + return false; +} + +bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + LLUIColor color = *((LLUIColor*)val_ptr); + //RN: don't write out the color that is represented by a function + // rely on param block exporting to get the reference to the color settings + if (color.isReference()) return false; + node->setFloatValue(4, color.get().mV); + return true; + } + return false; +} + +bool LLXUIParser::readUUIDValue(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + LLUUID temp_id; + // LLUUID::set is destructive, so use temporary value + if (temp_id.set(self.mCurReadNode->getSanitizedValue())) + { + *(LLUUID*)(val_ptr) = temp_id; + return true; + } + return false; +} + +bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + node->setStringValue(((LLUUID*)val_ptr)->asString()); + return true; + } + return false; +} + +bool LLXUIParser::readSDValue(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + *((LLSD*)val_ptr) = LLSD(self.mCurReadNode->getSanitizedValue()); + return true; +} + +bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + std::string string_val = ((LLSD*)val_ptr)->asString(); + if (string_val.find('\n') != std::string::npos || string_val.size() > MAX_STRING_ATTRIBUTE_SIZE) + { + // don't write strings with newlines into attributes + std::string attribute_name = node->getName()->mString; + LLXMLNodePtr parent_node = node->mParent; + parent_node->deleteChild(node); + // write results in text contents of node + if (attribute_name == "value") + { + // "value" is implicit, just write to parent + node = parent_node; + } + else + { + node = parent_node->createChild(attribute_name.c_str(), false); + } + } + + node->setStringValue(string_val); + return true; + } + return false; +} + +/*virtual*/ std::string LLXUIParser::getCurrentElementName() +{ + std::string full_name; + for (name_stack_t::iterator it = mNameStack.begin(); + it != mNameStack.end(); + ++it) + { + full_name += it->first + "."; // build up dotted names: "button.param.nestedparam." + } + + return full_name; +} + +void LLXUIParser::parserWarning(const std::string& message) +{ +#ifdef LL_WINDOWS + // use Visual Studo friendly formatting of output message for easy access to originating xml + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserWarning(message); +#endif +} + +void LLXUIParser::parserError(const std::string& message) +{ +#ifdef LL_WINDOWS + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserError(message); +#endif +} + + +// +// LLSimpleXUIParser +// + +struct ScopedFile +{ + ScopedFile( const std::string& filename, const char* accessmode ) + { + mFile = LLFile::fopen(filename, accessmode); + } + + ~ScopedFile() + { + fclose(mFile); + mFile = NULL; + } + + S32 getRemainingBytes() + { + if (!isOpen()) return 0; + + S32 cur_pos = ftell(mFile); + fseek(mFile, 0L, SEEK_END); + S32 file_size = ftell(mFile); + fseek(mFile, cur_pos, SEEK_SET); + return file_size - cur_pos; + } + + bool isOpen() { return mFile != NULL; } + + LLFILE* mFile; +}; +LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t element_cb) +: Parser(sSimpleXUIReadFuncs, sSimpleXUIWriteFuncs, sSimpleXUIInspectFuncs), + mCurReadDepth(0), + mElementCB(element_cb) +{ + if (sSimpleXUIReadFuncs.empty()) + { + registerParserFuncs(readFlag); + registerParserFuncs(readBoolValue); + registerParserFuncs(readStringValue); + registerParserFuncs(readU8Value); + registerParserFuncs(readS8Value); + registerParserFuncs(readU16Value); + registerParserFuncs(readS16Value); + registerParserFuncs(readU32Value); + registerParserFuncs(readS32Value); + registerParserFuncs(readF32Value); + registerParserFuncs(readF64Value); + registerParserFuncs(readColor4Value); + registerParserFuncs(readUIColorValue); + registerParserFuncs(readUUIDValue); + registerParserFuncs(readSDValue); + } +} + +LLSimpleXUIParser::~LLSimpleXUIParser() +{ +} + + +bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) +{ + LLFastTimer timer(FTM_PARSE_XUI); + + mParser = XML_ParserCreate(NULL); + XML_SetUserData(mParser, this); + XML_SetElementHandler( mParser, startElementHandler, endElementHandler); + XML_SetCharacterDataHandler( mParser, characterDataHandler); + + mOutputStack.push_back(std::make_pair(&block, 0)); + mNameStack.clear(); + mCurFileName = filename; + mCurReadDepth = 0; + setParseSilently(silent); + + ScopedFile file(filename, "rb"); + if( !file.isOpen() ) + { + LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + + S32 bytes_read = 0; + + S32 buffer_size = file.getRemainingBytes(); + void* buffer = XML_GetBuffer(mParser, buffer_size); + if( !buffer ) + { + LL_WARNS("ReadXUI") << "Unable to allocate XML buffer while reading file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + + bytes_read = (S32)fread(buffer, 1, buffer_size, file.mFile); + if( bytes_read <= 0 ) + { + LL_WARNS("ReadXUI") << "Error while reading file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + + mEmptyLeafNode.push_back(false); + + if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) + { + LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + + mEmptyLeafNode.pop_back(); + + XML_ParserFree( mParser ); + return true; +} + +void LLSimpleXUIParser::startElementHandler(void *userData, const char *name, const char **atts) +{ + LLSimpleXUIParser* self = reinterpret_cast(userData); + self->startElement(name, atts); +} + +void LLSimpleXUIParser::endElementHandler(void *userData, const char *name) +{ + LLSimpleXUIParser* self = reinterpret_cast(userData); + self->endElement(name); +} + +void LLSimpleXUIParser::characterDataHandler(void *userData, const char *s, int len) +{ + LLSimpleXUIParser* self = reinterpret_cast(userData); + self->characterData(s, len); +} + +void LLSimpleXUIParser::characterData(const char *s, int len) +{ + mTextContents += std::string(s, len); +} + +void LLSimpleXUIParser::startElement(const char *name, const char **atts) +{ + processText(); + + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("."); + + if (mElementCB) + { + LLInitParam::BaseBlock* blockp = mElementCB(*this, name); + if (blockp) + { + mOutputStack.push_back(std::make_pair(blockp, 0)); + } + } + + mOutputStack.back().second++; + S32 num_tokens_pushed = 0; + std::string child_name(name); + + if (mOutputStack.back().second == 1) + { // root node for this block + mScope.push_back(child_name); + } + else + { // compound attribute + if (child_name.find(".") == std::string::npos) + { + mNameStack.push_back(std::make_pair(child_name, true)); + num_tokens_pushed++; + mScope.push_back(child_name); + } + else + { + // parse out "dotted" name into individual tokens + tokenizer name_tokens(child_name, sep); + + tokenizer::iterator name_token_it = name_tokens.begin(); + if(name_token_it == name_tokens.end()) + { + return; + } + + // check for proper nesting + if(!mScope.empty() && *name_token_it != mScope.back()) + { + return; + } + + // now ignore first token + ++name_token_it; + + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, true)); + num_tokens_pushed++; + } + mScope.push_back(mNameStack.back().first); + } + } + + // parent node is not empty + mEmptyLeafNode.back() = false; + // we are empty if we have no attributes + mEmptyLeafNode.push_back(atts[0] == NULL); + + mTokenSizeStack.push_back(num_tokens_pushed); + readAttributes(atts); + +} + +void LLSimpleXUIParser::endElement(const char *name) +{ + bool has_text = processText(); + + // no text, attributes, or children + if (!has_text && mEmptyLeafNode.back()) + { + // submit this as a valueless name (even though there might be text contents we haven't seen yet) + mCurAttributeValueBegin = NO_VALUE_MARKER; + mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); + } + + if (--mOutputStack.back().second == 0) + { + if (mOutputStack.empty()) + { + LL_ERRS("ReadXUI") << "Parameter block output stack popped while empty." << LL_ENDL; + } + mOutputStack.pop_back(); + } + + S32 num_tokens_to_pop = mTokenSizeStack.back(); + mTokenSizeStack.pop_back(); + while(num_tokens_to_pop-- > 0) + { + mNameStack.pop_back(); + } + mScope.pop_back(); + mEmptyLeafNode.pop_back(); +} + +bool LLSimpleXUIParser::readAttributes(const char **atts) +{ + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("."); + + bool any_parsed = false; + for(S32 i = 0; atts[i] && atts[i+1]; i += 2 ) + { + std::string attribute_name(atts[i]); + mCurAttributeValueBegin = atts[i+1]; + + S32 num_tokens_pushed = 0; + tokenizer name_tokens(attribute_name, sep); + // copy remaining tokens on to our running token list + for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) + { + mNameStack.push_back(std::make_pair(*token_to_push, true)); + num_tokens_pushed++; + } + + // child nodes are not necessarily valid attributes, so don't complain once we've recursed + any_parsed |= mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); + + while(num_tokens_pushed-- > 0) + { + mNameStack.pop_back(); + } + } + return any_parsed; +} + +bool LLSimpleXUIParser::processText() +{ + if (!mTextContents.empty()) + { + LLStringUtil::trim(mTextContents); + if (!mTextContents.empty()) + { + mNameStack.push_back(std::make_pair(std::string("value"), true)); + mCurAttributeValueBegin = mTextContents.c_str(); + mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); + mNameStack.pop_back(); + } + mTextContents.clear(); + return true; + } + return false; +} + +/*virtual*/ std::string LLSimpleXUIParser::getCurrentElementName() +{ + std::string full_name; + for (name_stack_t::iterator it = mNameStack.begin(); + it != mNameStack.end(); + ++it) + { + full_name += it->first + "."; // build up dotted names: "button.param.nestedparam." + } + + return full_name; +} + +void LLSimpleXUIParser::parserWarning(const std::string& message) +{ +#ifdef LL_WINDOWS + // use Visual Studo friendly formatting of output message for easy access to originating xml + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserWarning(message); +#endif +} + +void LLSimpleXUIParser::parserError(const std::string& message) +{ +#ifdef LL_WINDOWS + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); +#else + Parser::parserError(message); +#endif +} + +bool LLSimpleXUIParser::readFlag(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return self.mCurAttributeValueBegin == NO_VALUE_MARKER; +} + +bool LLSimpleXUIParser::readBoolValue(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + if (!strcmp(self.mCurAttributeValueBegin, "true")) + { + *((bool*)val_ptr) = true; + return true; + } + else if (!strcmp(self.mCurAttributeValueBegin, "false")) + { + *((bool*)val_ptr) = false; + return true; + } + + return false; +} + +bool LLSimpleXUIParser::readStringValue(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + *((std::string*)val_ptr) = self.mCurAttributeValueBegin; + return true; +} + +bool LLSimpleXUIParser::readU8Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U8*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readS8Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S8*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readU16Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U16*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readS16Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S16*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readU32Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U32*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readS32Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S32*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readF32Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F32*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readF64Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F64*)val_ptr)]).full; +} + +bool LLSimpleXUIParser::readColor4Value(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + LLColor4 value; + + if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) + { + *(LLColor4*)(val_ptr) = value; + return true; + } + return false; +} + +bool LLSimpleXUIParser::readUIColorValue(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + LLColor4 value; + LLUIColor* colorp = (LLUIColor*)val_ptr; + + if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) + { + colorp->set(value); + return true; + } + return false; +} + +bool LLSimpleXUIParser::readUUIDValue(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + LLUUID temp_id; + // LLUUID::set is destructive, so use temporary value + if (temp_id.set(std::string(self.mCurAttributeValueBegin))) + { + *(LLUUID*)(val_ptr) = temp_id; + return true; + } + return false; +} + +bool LLSimpleXUIParser::readSDValue(Parser& parser, void* val_ptr) +{ + LLSimpleXUIParser& self = static_cast(parser); + *((LLSD*)val_ptr) = LLSD(self.mCurAttributeValueBegin); + return true; +} diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h new file mode 100644 index 0000000000..d7cd256967 --- /dev/null +++ b/indra/llui/llxuiparser.h @@ -0,0 +1,242 @@ +/** + * @file llxuiparser.h + * @brief Utility functions for handling XUI structures in XML + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLXUIPARSER_H +#define LLXUIPARSER_H + +#include "llinitparam.h" +#include "llregistry.h" +#include "llpointer.h" + +#include +#include +#include +#include + + + +class LLView; + + +typedef LLPointer LLXMLNodePtr; + + +// lookup widget type by name +class LLWidgetTypeRegistry +: public LLRegistrySingleton +{}; + + +// global static instance for registering all widget types +typedef boost::function LLWidgetCreatorFunc; + +typedef LLRegistry widget_registry_t; + +class LLChildRegistryRegistry +: public LLRegistrySingleton +{}; + + + +class LLXSDWriter : public LLInitParam::Parser +{ + LOG_CLASS(LLXSDWriter); +public: + void writeXSD(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace); + + /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; } + + LLXSDWriter(); + +protected: + void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector* possible_values); + void addAttributeToSchema(LLXMLNodePtr nodep, const std::string& attribute_name, const std::string& type, bool mandatory, const std::vector* possible_values); + LLXMLNodePtr mAttributeNode; + LLXMLNodePtr mElementNode; + LLXMLNodePtr mSchemaNode; + + typedef std::set string_set_t; + typedef std::map attributes_map_t; + attributes_map_t mAttributesWritten; +}; + + + +// NOTE: DOES NOT WORK YET +// should support child widgets for XUI +class LLXUIXSDWriter : public LLXSDWriter +{ +public: + void writeXSD(const std::string& name, const std::string& path, const LLInitParam::BaseBlock& block); +}; + + +class LLXUIParserImpl; + +class LLXUIParser : public LLInitParam::Parser +{ +LOG_CLASS(LLXUIParser); + +public: + LLXUIParser(); + typedef LLInitParam::Parser::name_stack_t name_stack_t; + + /*virtual*/ std::string getCurrentElementName(); + /*virtual*/ void parserWarning(const std::string& message); + /*virtual*/ void parserError(const std::string& message); + + void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false); + void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); + +private: + bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block); + bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); + + //reader helper functions + static bool readFlag(Parser& parser, void* val_ptr); + static bool readBoolValue(Parser& parser, void* val_ptr); + static bool readStringValue(Parser& parser, void* val_ptr); + static bool readU8Value(Parser& parser, void* val_ptr); + static bool readS8Value(Parser& parser, void* val_ptr); + static bool readU16Value(Parser& parser, void* val_ptr); + static bool readS16Value(Parser& parser, void* val_ptr); + static bool readU32Value(Parser& parser, void* val_ptr); + static bool readS32Value(Parser& parser, void* val_ptr); + static bool readF32Value(Parser& parser, void* val_ptr); + static bool readF64Value(Parser& parser, void* val_ptr); + static bool readColor4Value(Parser& parser, void* val_ptr); + static bool readUIColorValue(Parser& parser, void* val_ptr); + static bool readUUIDValue(Parser& parser, void* val_ptr); + static bool readSDValue(Parser& parser, void* val_ptr); + + //writer helper functions + static bool writeFlag(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeStringValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF64Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeSDValue(Parser& parser, const void* val_ptr, name_stack_t&); + + LLXMLNodePtr getNode(name_stack_t& stack); + +private: + Parser::name_stack_t mNameStack; + LLXMLNodePtr mCurReadNode; + // Root of the widget XML sub-tree, for example, "line_editor" + LLXMLNodePtr mWriteRootNode; + + typedef std::map out_nodes_t; + out_nodes_t mOutNodes; + LLXMLNodePtr mLastWrittenChild; + S32 mCurReadDepth; + std::string mCurFileName; + std::string mRootNodeName; +}; + +// LLSimpleXUIParser is a streamlined SAX-based XUI parser that does not support localization +// or parsing of a tree of independent param blocks, such as child widgets. +// Use this for reading non-localized files that only need a single param block as a result. +// +// NOTE: In order to support nested block parsing, we need callbacks for start element that +// push new blocks contexts on the mScope stack. +// NOTE: To support localization without building a DOM, we need to enforce consistent +// ordering of child elements from base file to localized diff file. Then we can use a pair +// of coroutines to perform matching of xml nodes during parsing. Not sure if the overhead +// of coroutines would offset the gain from SAX parsing +class LLSimpleXUIParserImpl; + +class LLSimpleXUIParser : public LLInitParam::Parser +{ +LOG_CLASS(LLSimpleXUIParser); +public: + typedef LLInitParam::Parser::name_stack_t name_stack_t; + typedef LLInitParam::BaseBlock* (*element_start_callback_t)(LLSimpleXUIParser&, const char* block_name); + + LLSimpleXUIParser(element_start_callback_t element_cb = NULL); + virtual ~LLSimpleXUIParser(); + + /*virtual*/ std::string getCurrentElementName(); + /*virtual*/ void parserWarning(const std::string& message); + /*virtual*/ void parserError(const std::string& message); + + bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false); + + +private: + //reader helper functions + static bool readFlag(Parser&, void* val_ptr); + static bool readBoolValue(Parser&, void* val_ptr); + static bool readStringValue(Parser&, void* val_ptr); + static bool readU8Value(Parser&, void* val_ptr); + static bool readS8Value(Parser&, void* val_ptr); + static bool readU16Value(Parser&, void* val_ptr); + static bool readS16Value(Parser&, void* val_ptr); + static bool readU32Value(Parser&, void* val_ptr); + static bool readS32Value(Parser&, void* val_ptr); + static bool readF32Value(Parser&, void* val_ptr); + static bool readF64Value(Parser&, void* val_ptr); + static bool readColor4Value(Parser&, void* val_ptr); + static bool readUIColorValue(Parser&, void* val_ptr); + static bool readUUIDValue(Parser&, void* val_ptr); + static bool readSDValue(Parser&, void* val_ptr); + +private: + static void startElementHandler(void *userData, const char *name, const char **atts); + static void endElementHandler(void *userData, const char *name); + static void characterDataHandler(void *userData, const char *s, int len); + + void startElement(const char *name, const char **atts); + void endElement(const char *name); + void characterData(const char *s, int len); + bool readAttributes(const char **atts); + bool processText(); + + Parser::name_stack_t mNameStack; + struct XML_ParserStruct* mParser; + LLXMLNodePtr mLastWrittenChild; + S32 mCurReadDepth; + std::string mCurFileName; + std::string mTextContents; + const char* mCurAttributeValueBegin; + std::vector mTokenSizeStack; + std::vector mScope; + std::vector mEmptyLeafNode; + element_start_callback_t mElementCB; + + std::vector > mOutputStack; +}; + + +#endif //LLXUIPARSER_H diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index c75df86891..cb3b7abb14 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -105,28 +105,6 @@ LLStyle::Params::Params() namespace LLInitParam { - Param::Param(BaseBlock* enclosing_block) - : mIsProvided(false) - { - const U8* my_addr = reinterpret_cast(this); - const U8* block_addr = reinterpret_cast(enclosing_block); - mEnclosingBlockOffset = (U16)(my_addr - block_addr); - } - - void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){} - void BaseBlock::addSynonym(Param& param, const std::string& synonym) {} - param_handle_t BaseBlock::getHandleFromParam(const Param* param) const {return 0;} - - void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size) - { - descriptor.mCurrentBlockPtr = this; - } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } - void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const LLInitParam::BaseBlock* diff_block) const {} - bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_value, S32 max_value) const { return true; } - bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } - bool BaseBlock::validateBlock(bool emit_errors) const { return true; } - ParamValue >::ParamValue(const LLUIColor& color) : super_t(color) {} diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index c1fb050206..8f0a48018f 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -70,21 +70,6 @@ S32 LLUIImage::getHeight() const return 0; } -namespace LLInitParam -{ - BlockDescriptor::BlockDescriptor() {} - ParamDescriptor::ParamDescriptor(param_handle_t p, - merge_func_t merge_func, - deserialize_func_t deserialize_func, - serialize_func_t serialize_func, - validation_func_t validation_func, - inspect_func_t inspect_func, - S32 min_count, - S32 max_count){} - ParamDescriptor::~ParamDescriptor() {} - -} - namespace tut { struct LLUrlEntryData diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index 7183413463..963473c92a 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -63,40 +63,6 @@ S32 LLUIImage::getHeight() const namespace LLInitParam { - BlockDescriptor::BlockDescriptor() {} - ParamDescriptor::ParamDescriptor(param_handle_t p, - merge_func_t merge_func, - deserialize_func_t deserialize_func, - serialize_func_t serialize_func, - validation_func_t validation_func, - inspect_func_t inspect_func, - S32 min_count, - S32 max_count){} - ParamDescriptor::~ParamDescriptor() {} - - void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){} - param_handle_t BaseBlock::getHandleFromParam(const Param* param) const {return 0;} - void BaseBlock::addSynonym(Param& param, const std::string& synonym) {} - - void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size) - { - descriptor.mCurrentBlockPtr = this; - } - - Param::Param(BaseBlock* enclosing_block) - : mIsProvided(false) - { - const U8* my_addr = reinterpret_cast(this); - const U8* block_addr = reinterpret_cast(enclosing_block); - mEnclosingBlockOffset = 0x7FFFffff & ((U32)(my_addr - block_addr)); - } - - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } - void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const LLInitParam::BaseBlock* diff_block) const {} - bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const { return true; } - bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } - bool BaseBlock::validateBlock(bool emit_errors) const { return true; } - ParamValue >::ParamValue(const LLUIColor& color) : super_t(color) {} diff --git a/indra/llxuixml/CMakeLists.txt b/indra/llxuixml/CMakeLists.txt deleted file mode 100644 index daed4de6ce..0000000000 --- a/indra/llxuixml/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# -*- cmake -*- - -project(llxuixml) - -include(00-Common) -include(LLCommon) -include(LLMath) -include(LLXML) - -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) - -set(llxuixml_SOURCE_FILES - llinitparam.cpp - lltrans.cpp - lluicolor.cpp - llxuiparser.cpp - ) - -set(llxuixml_HEADER_FILES - CMakeLists.txt - - llinitparam.h - lltrans.h - llregistry.h - lluicolor.h - llxuiparser.h - ) - -set_source_files_properties(${llxuixml_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - -list(APPEND llxuixml_SOURCE_FILES ${llxuixml_HEADER_FILES}) - -add_library (llxuixml ${llxuixml_SOURCE_FILES}) -# Libraries on which this library depends, needed for Linux builds -# Sort by high-level to low-level -target_link_libraries(llxuixml - llxml - llcommon - llmath - ) diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp deleted file mode 100644 index db72aa19b9..0000000000 --- a/indra/llxuixml/llinitparam.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/** - * @file llinitparam.cpp - * @brief parameter block abstraction for creating complex objects and - * parsing construction parameters from xml and LLSD - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llinitparam.h" - - -namespace LLInitParam -{ - // - // Param - // - Param::Param(BaseBlock* enclosing_block) - : mIsProvided(false) - { - const U8* my_addr = reinterpret_cast(this); - const U8* block_addr = reinterpret_cast(enclosing_block); - mEnclosingBlockOffset = 0x7FFFffff & (U32)(my_addr - block_addr); - } - - // - // ParamDescriptor - // - ParamDescriptor::ParamDescriptor(param_handle_t p, - merge_func_t merge_func, - deserialize_func_t deserialize_func, - serialize_func_t serialize_func, - validation_func_t validation_func, - inspect_func_t inspect_func, - S32 min_count, - S32 max_count) - : mParamHandle(p), - mMergeFunc(merge_func), - mDeserializeFunc(deserialize_func), - mSerializeFunc(serialize_func), - mValidationFunc(validation_func), - mInspectFunc(inspect_func), - mMinCount(min_count), - mMaxCount(max_count), - mUserData(NULL) - {} - - ParamDescriptor::ParamDescriptor() - : mParamHandle(0), - mMergeFunc(NULL), - mDeserializeFunc(NULL), - mSerializeFunc(NULL), - mValidationFunc(NULL), - mInspectFunc(NULL), - mMinCount(0), - mMaxCount(0), - mUserData(NULL) - {} - - ParamDescriptor::~ParamDescriptor() - { - delete mUserData; - } - - // - // Parser - // - Parser::~Parser() - {} - - void Parser::parserWarning(const std::string& message) - { - if (mParseSilently) return; - llwarns << message << llendl; - } - - void Parser::parserError(const std::string& message) - { - if (mParseSilently) return; - llerrs << message << llendl; - } - - - // - // BlockDescriptor - // - void BlockDescriptor::aggregateBlockData(BlockDescriptor& src_block_data) - { - mNamedParams.insert(src_block_data.mNamedParams.begin(), src_block_data.mNamedParams.end()); - std::copy(src_block_data.mUnnamedParams.begin(), src_block_data.mUnnamedParams.end(), std::back_inserter(mUnnamedParams)); - std::copy(src_block_data.mValidationList.begin(), src_block_data.mValidationList.end(), std::back_inserter(mValidationList)); - std::copy(src_block_data.mAllParams.begin(), src_block_data.mAllParams.end(), std::back_inserter(mAllParams)); - } - - BlockDescriptor::BlockDescriptor() - : mMaxParamOffset(0), - mInitializationState(UNINITIALIZED), - mCurrentBlockPtr(NULL) - {} - - // called by each derived class in least to most derived order - void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size) - { - descriptor.mCurrentBlockPtr = this; - descriptor.mMaxParamOffset = block_size; - - switch(descriptor.mInitializationState) - { - case BlockDescriptor::UNINITIALIZED: - // copy params from base class here - descriptor.aggregateBlockData(base_descriptor); - - descriptor.mInitializationState = BlockDescriptor::INITIALIZING; - break; - case BlockDescriptor::INITIALIZING: - descriptor.mInitializationState = BlockDescriptor::INITIALIZED; - break; - case BlockDescriptor::INITIALIZED: - // nothing to do - break; - } - } - - param_handle_t BaseBlock::getHandleFromParam(const Param* param) const - { - const U8* param_address = reinterpret_cast(param); - const U8* baseblock_address = reinterpret_cast(this); - return (param_address - baseblock_address); - } - - bool BaseBlock::submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent) - { - if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), true)) - { - if (!silent) - { - p.parserWarning(llformat("Failed to parse parameter \"%s\"", p.getCurrentElementName().c_str())); - } - return false; - } - return true; - } - - - bool BaseBlock::validateBlock(bool emit_errors) const - { - const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it) - { - const Param* param = getParamFromHandle(it->first); - if (!it->second(param)) - { - if (emit_errors) - { - llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl; - } - return false; - } - } - return true; - } - - void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const LLInitParam::BaseBlock* diff_block) const - { - // named param is one like LLView::Params::follows - // unnamed param is like LLView::Params::rect - implicit - const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - - for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); - it != block_data.mUnnamedParams.end(); - ++it) - { - param_handle_t param_handle = (*it)->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc; - if (serialize_func) - { - const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - // each param descriptor remembers its serial number - // so we can inspect the same param under different names - // and see that it has the same number - name_stack.push_back(std::make_pair("", true)); - serialize_func(*param, parser, name_stack, diff_param); - name_stack.pop_back(); - } - } - - for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin(); - it != block_data.mNamedParams.end(); - ++it) - { - param_handle_t param_handle = it->second->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc; - if (serialize_func && param->anyProvided()) - { - // Ensure this param has not already been serialized - // Prevents from being serialized as its own tag. - bool duplicate = false; - for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin(); - it2 != block_data.mUnnamedParams.end(); - ++it2) - { - if (param_handle == (*it2)->mParamHandle) - { - duplicate = true; - break; - } - } - - //FIXME: for now, don't attempt to serialize values under synonyms, as current parsers - // don't know how to detect them - if (duplicate) - { - continue; - } - - name_stack.push_back(std::make_pair(it->first, !duplicate)); - const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - serialize_func(*param, parser, name_stack, diff_param); - name_stack.pop_back(); - } - } - } - - bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const - { - // named param is one like LLView::Params::follows - // unnamed param is like LLView::Params::rect - implicit - const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - - for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); - it != block_data.mUnnamedParams.end(); - ++it) - { - param_handle_t param_handle = (*it)->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc; - if (inspect_func) - { - name_stack.push_back(std::make_pair("", true)); - inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount); - name_stack.pop_back(); - } - } - - for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin(); - it != block_data.mNamedParams.end(); - ++it) - { - param_handle_t param_handle = it->second->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc; - if (inspect_func) - { - // Ensure this param has not already been inspected - bool duplicate = false; - for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin(); - it2 != block_data.mUnnamedParams.end(); - ++it2) - { - if (param_handle == (*it2)->mParamHandle) - { - duplicate = true; - break; - } - } - - name_stack.push_back(std::make_pair(it->first, !duplicate)); - inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount); - name_stack.pop_back(); - } - } - - return true; - } - - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool ignored) - { - BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - bool names_left = name_stack_range.first != name_stack_range.second; - - bool new_name = names_left - ? name_stack_range.first->second - : true; - - if (names_left) - { - const std::string& top_name = name_stack_range.first->first; - - ParamDescriptor::deserialize_func_t deserialize_func = NULL; - Param* paramp = NULL; - - BlockDescriptor::param_map_t::iterator found_it = block_data.mNamedParams.find(top_name); - if (found_it != block_data.mNamedParams.end()) - { - // find pointer to member parameter from offset table - paramp = getParamFromHandle(found_it->second->mParamHandle); - deserialize_func = found_it->second->mDeserializeFunc; - - Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second); - ++new_name_stack.first; - if (deserialize_func(*paramp, p, new_name_stack, new_name)) - { - // value is no longer new, we know about it now - name_stack_range.first->second = false; - return true; - } - else - { - return false; - } - } - } - - // try to parse unnamed parameters, in declaration order - for ( BlockDescriptor::param_list_t::iterator it = block_data.mUnnamedParams.begin(); - it != block_data.mUnnamedParams.end(); - ++it) - { - Param* paramp = getParamFromHandle((*it)->mParamHandle); - ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc; - - if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name)) - { - return true; - } - } - - // if no match, and no names left on stack, this is just an existence assertion of this block - // verify by calling readValue with NoParamValue type, an inherently unparseable type - if (!names_left) - { - Flag no_value; - return p.readValue(no_value); - } - - return false; - } - - //static - void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name) - { - // create a copy of the param descriptor in mAllParams - // so other data structures can store a pointer to it - block_data.mAllParams.push_back(in_param); - ParamDescriptorPtr param(block_data.mAllParams.back()); - - std::string name(char_name); - if ((size_t)param->mParamHandle > block_data.mMaxParamOffset) - { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block" << llendl; - } - - if (name.empty()) - { - block_data.mUnnamedParams.push_back(param); - } - else - { - // don't use insert, since we want to overwrite existing entries - block_data.mNamedParams[name] = param; - } - - if (param->mValidationFunc) - { - block_data.mValidationList.push_back(std::make_pair(param->mParamHandle, param->mValidationFunc)); - } - } - - void BaseBlock::addSynonym(Param& param, const std::string& synonym) - { - BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - if (block_data.mInitializationState == BlockDescriptor::INITIALIZING) - { - param_handle_t handle = getHandleFromParam(¶m); - - // check for invalid derivation from a paramblock (i.e. without using - // Block - if ((size_t)handle > block_data.mMaxParamOffset) - { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block" << llendl; - } - - ParamDescriptorPtr param_descriptor = findParamDescriptor(param); - if (param_descriptor) - { - if (synonym.empty()) - { - block_data.mUnnamedParams.push_back(param_descriptor); - } - else - { - block_data.mNamedParams[synonym] = param_descriptor; - } - } - } - } - - const std::string& BaseBlock::getParamName(const BlockDescriptor& block_data, const Param* paramp) const - { - param_handle_t handle = getHandleFromParam(paramp); - for (BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin(); it != block_data.mNamedParams.end(); ++it) - { - if (it->second->mParamHandle == handle) - { - return it->first; - } - } - - return LLStringUtil::null; - } - - ParamDescriptorPtr BaseBlock::findParamDescriptor(const Param& param) - { - param_handle_t handle = getHandleFromParam(¶m); - BlockDescriptor& descriptor = mostDerivedBlockDescriptor(); - BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end(); - for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin(); - it != end_it; - ++it) - { - if ((*it)->mParamHandle == handle) return *it; - } - return ParamDescriptorPtr(); - } - - // take all provided params from other and apply to self - // NOTE: this requires that "other" is of the same derived type as this - bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) - { - bool some_param_changed = false; - BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end(); - for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin(); - it != end_it; - ++it) - { - const Param* other_paramp = other.getParamFromHandle((*it)->mParamHandle); - ParamDescriptor::merge_func_t merge_func = (*it)->mMergeFunc; - if (merge_func) - { - Param* paramp = getParamFromHandle((*it)->mParamHandle); - llassert(paramp->mEnclosingBlockOffset == (*it)->mParamHandle); - some_param_changed |= merge_func(*paramp, *other_paramp, overwrite); - } - } - return some_param_changed; - } -} diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h deleted file mode 100644 index ab20957760..0000000000 --- a/indra/llxuixml/llinitparam.h +++ /dev/null @@ -1,2294 +0,0 @@ -/** - * @file llinitparam.h - * @brief parameter block abstraction for creating complex objects and - * parsing construction parameters from xml and LLSD - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPARAM_H -#define LL_LLPARAM_H - -#include -#include -#include -#include -#include - -#include "llerror.h" - -namespace LLInitParam -{ - // used to indicate no matching value to a given name when parsing - struct Flag{}; - - template const T& defaultValue() { static T value; return value; } - - template ::value > - struct ParamCompare - { - static bool equals(const T &a, const T &b) - { - return a == b; - } - }; - - // boost function types are not comparable - template - struct ParamCompare - { - static bool equals(const T&a, const T &b) - { - return false; - } - }; - - template<> - struct ParamCompare - { - static bool equals(const LLSD &a, const LLSD &b) { return false; } - }; - - template<> - struct ParamCompare - { - static bool equals(const Flag& a, const Flag& b) { return false; } - }; - - - // helper functions and classes - typedef ptrdiff_t param_handle_t; - - // empty default implementation of key cache - // leverages empty base class optimization - template - class TypeValues - { - private: - struct Inaccessable{}; - public: - typedef std::map value_name_map_t; - typedef Inaccessable name_t; - - void setValueName(const std::string& key) {} - std::string getValueName() const { return ""; } - std::string calcValueName(const T& value) const { return ""; } - void clearValueName() const {} - - static bool getValueFromName(const std::string& name, T& value) - { - return false; - } - - static bool valueNamesExist() - { - return false; - } - - static std::vector* getPossibleValues() - { - return NULL; - } - - static value_name_map_t* getValueNames() {return NULL;} - }; - - template > - class TypeValuesHelper - { - public: - typedef typename std::map value_name_map_t; - typedef std::string name_t; - - //TODO: cache key by index to save on param block size - void setValueName(const std::string& value_name) - { - mValueName = value_name; - } - - std::string getValueName() const - { - return mValueName; - } - - std::string calcValueName(const T& value) const - { - value_name_map_t* map = getValueNames(); - for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end(); - it != end_it; - ++it) - { - if (ParamCompare::equals(it->second, value)) - { - return it->first; - } - } - - return ""; - } - - void clearValueName() const - { - mValueName.clear(); - } - - static bool getValueFromName(const std::string& name, T& value) - { - value_name_map_t* map = getValueNames(); - typename value_name_map_t::iterator found_it = map->find(name); - if (found_it == map->end()) return false; - - value = found_it->second; - return true; - } - - static bool valueNamesExist() - { - return !getValueNames()->empty(); - } - - static value_name_map_t* getValueNames() - { - static value_name_map_t sMap; - static bool sInitialized = false; - - if (!sInitialized) - { - sInitialized = true; - DERIVED_TYPE::declareValues(); - } - return &sMap; - } - - static std::vector* getPossibleValues() - { - static std::vector sValues; - - value_name_map_t* map = getValueNames(); - for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end(); - it != end_it; - ++it) - { - sValues.push_back(it->first); - } - return &sValues; - } - - static void declare(const std::string& name, const T& value) - { - (*getValueNames())[name] = value; - } - - protected: - static void getName(const std::string& name, const T& value) - {} - - mutable std::string mValueName; - }; - - class Parser - { - LOG_CLASS(Parser); - - public: - - struct CompareTypeID - { - bool operator()(const std::type_info* lhs, const std::type_info* rhs) const - { - return lhs->before(*rhs); - } - }; - - typedef std::vector > name_stack_t; - typedef std::pair name_stack_range_t; - typedef std::vector possible_values_t; - - typedef bool (*parser_read_func_t)(Parser& parser, void* output); - typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); - typedef boost::function parser_inspect_func_t; - - typedef std::map parser_read_func_map_t; - typedef std::map parser_write_func_map_t; - typedef std::map parser_inspect_func_map_t; - - Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) - : mParseSilently(false), - mParserReadFuncs(&read_map), - mParserWriteFuncs(&write_map), - mParserInspectFuncs(&inspect_map) - {} - virtual ~Parser(); - - template bool readValue(T& param) - { - parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); - if (found_it != mParserReadFuncs->end()) - { - return found_it->second(*this, (void*)¶m); - } - return false; - } - - template bool writeValue(const T& param, name_stack_t& name_stack) - { - parser_write_func_map_t::iterator found_it = mParserWriteFuncs->find(&typeid(T)); - if (found_it != mParserWriteFuncs->end()) - { - return found_it->second(*this, (const void*)¶m, name_stack); - } - return false; - } - - // dispatch inspection to registered inspection functions, for each parameter in a param block - template bool inspectValue(name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values) - { - parser_inspect_func_map_t::iterator found_it = mParserInspectFuncs->find(&typeid(T)); - if (found_it != mParserInspectFuncs->end()) - { - found_it->second(name_stack, min_count, max_count, possible_values); - return true; - } - return false; - } - - virtual std::string getCurrentElementName() = 0; - virtual void parserWarning(const std::string& message); - virtual void parserError(const std::string& message); - void setParseSilently(bool silent) { mParseSilently = silent; } - - protected: - template - void registerParserFuncs(parser_read_func_t read_func, parser_write_func_t write_func = NULL) - { - mParserReadFuncs->insert(std::make_pair(&typeid(T), read_func)); - mParserWriteFuncs->insert(std::make_pair(&typeid(T), write_func)); - } - - template - void registerInspectFunc(parser_inspect_func_t inspect_func) - { - mParserInspectFuncs->insert(std::make_pair(&typeid(T), inspect_func)); - } - - bool mParseSilently; - - private: - parser_read_func_map_t* mParserReadFuncs; - parser_write_func_map_t* mParserWriteFuncs; - parser_inspect_func_map_t* mParserInspectFuncs; - }; - - class Param; - - // various callbacks and constraints associated with an individual param - struct ParamDescriptor - { - struct UserData - { - virtual ~UserData() {} - }; - - typedef bool(*merge_func_t)(Param&, const Param&, bool); - typedef bool(*deserialize_func_t)(Param&, Parser&, const Parser::name_stack_range_t&, bool); - typedef void(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const Param* diff_param); - typedef void(*inspect_func_t)(const Param&, Parser&, Parser::name_stack_t&, S32 min_count, S32 max_count); - typedef bool(*validation_func_t)(const Param*); - - ParamDescriptor(param_handle_t p, - merge_func_t merge_func, - deserialize_func_t deserialize_func, - serialize_func_t serialize_func, - validation_func_t validation_func, - inspect_func_t inspect_func, - S32 min_count, - S32 max_count); - - ParamDescriptor(); - ~ParamDescriptor(); - - param_handle_t mParamHandle; - merge_func_t mMergeFunc; - deserialize_func_t mDeserializeFunc; - serialize_func_t mSerializeFunc; - inspect_func_t mInspectFunc; - validation_func_t mValidationFunc; - S32 mMinCount; - S32 mMaxCount; - S32 mNumRefs; - UserData* mUserData; - }; - - typedef boost::shared_ptr ParamDescriptorPtr; - - // each derived Block class keeps a static data structure maintaining offsets to various params - class BlockDescriptor - { - public: - BlockDescriptor(); - - typedef enum e_initialization_state - { - UNINITIALIZED, - INITIALIZING, - INITIALIZED - } EInitializationState; - - void aggregateBlockData(BlockDescriptor& src_block_data); - - typedef boost::unordered_map param_map_t; - typedef std::vector param_list_t; - typedef std::list all_params_list_t; - typedef std::vector > param_validation_list_t; - - param_map_t mNamedParams; // parameters with associated names - param_list_t mUnnamedParams; // parameters with_out_ associated names - param_validation_list_t mValidationList; // parameters that must be validated - all_params_list_t mAllParams; // all parameters, owns descriptors - size_t mMaxParamOffset; - EInitializationState mInitializationState; // whether or not static block data has been initialized - class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed - }; - - class BaseBlock - { - public: - //TODO: implement in terms of owned_ptr - template - class Lazy - { - public: - Lazy() - : mPtr(NULL) - {} - - ~Lazy() - { - delete mPtr; - } - - Lazy(const Lazy& other) - { - if (other.mPtr) - { - mPtr = new T(*other.mPtr); - } - else - { - mPtr = NULL; - } - } - - Lazy& operator = (const Lazy& other) - { - if (other.mPtr) - { - mPtr = new T(*other.mPtr); - } - else - { - mPtr = NULL; - } - return *this; - } - - bool empty() const - { - return mPtr == NULL; - } - - void set(const T& other) - { - delete mPtr; - mPtr = new T(other); - } - - const T& get() const - { - return ensureInstance(); - } - - T& get() - { - return ensureInstance(); - } - - private: - // lazily allocate an instance of T - T* ensureInstance() const - { - if (mPtr == NULL) - { - mPtr = new T(); - } - return mPtr; - } - - private: - // if you get a compilation error with this, that means you are using a forward declared struct for T - // unfortunately, the type traits we rely on don't work with forward declared typed - //static const int dummy = sizeof(T); - - mutable T* mPtr; - }; - - // "Multiple" constraint types, put here in root class to avoid ambiguity during use - struct AnyAmount - { - enum { minCount = 0 }; - enum { maxCount = U32_MAX }; - }; - - template - struct AtLeast - { - enum { minCount = MIN_AMOUNT }; - enum { maxCount = U32_MAX }; - }; - - template - struct AtMost - { - enum { minCount = 0 }; - enum { maxCount = MAX_AMOUNT }; - }; - - template - struct Between - { - enum { minCount = MIN_AMOUNT }; - enum { maxCount = MAX_AMOUNT }; - }; - - template - struct Exactly - { - enum { minCount = EXACT_COUNT }; - enum { maxCount = EXACT_COUNT }; - }; - - // this typedef identifies derived classes as being blocks - typedef void baseblock_base_class_t; - LOG_CLASS(BaseBlock); - friend class Param; - - virtual ~BaseBlock() {} - bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false); - - param_handle_t getHandleFromParam(const Param* param) const; - bool validateBlock(bool emit_errors = true) const; - - Param* getParamFromHandle(const param_handle_t param_handle) - { - if (param_handle == 0) return NULL; - - U8* baseblock_address = reinterpret_cast(this); - return reinterpret_cast(baseblock_address + param_handle); - } - - const Param* getParamFromHandle(const param_handle_t param_handle) const - { - const U8* baseblock_address = reinterpret_cast(this); - return reinterpret_cast(baseblock_address + param_handle); - } - - void addSynonym(Param& param, const std::string& synonym); - - // Blocks can override this to do custom tracking of changes - virtual void paramChanged(const Param& changed_param, bool user_provided) {} - - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; - bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; - - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } - - // take all provided params from other and apply to self - bool overwriteFrom(const BaseBlock& other) - { - return false; - } - - // take all provided params that are not already provided, and apply to self - bool fillFrom(const BaseBlock& other) - { - return false; - } - - static void addParam(BlockDescriptor& block_data, ParamDescriptorPtr param, const char* name); - - ParamDescriptorPtr findParamDescriptor(const Param& param); - - protected: - void init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size); - - - bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) - { - return mergeBlock(block_data, source, overwrite); - } - // take all provided params from other and apply to self - bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite); - - static BlockDescriptor& selfBlockDescriptor() - { - static BlockDescriptor sBlockDescriptor; - return sBlockDescriptor; - } - - private: - const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; - }; - - template - struct ParamCompare, false > - { - static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } - }; - - class Param - { - public: - void setProvided(bool is_provided = true) - { - mIsProvided = is_provided; - enclosingBlock().paramChanged(*this, is_provided); - } - - Param& operator =(const Param& other) - { - mIsProvided = other.mIsProvided; - // don't change mEnclosingblockoffset - return *this; - } - protected: - - bool anyProvided() const { return mIsProvided; } - - Param(BaseBlock* enclosing_block); - - // store pointer to enclosing block as offset to reduce space and allow for quick copying - BaseBlock& enclosingBlock() const - { - const U8* my_addr = reinterpret_cast(this); - // get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class - return *const_cast - (reinterpret_cast - (my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset)); - } - - private: - friend class BaseBlock; - - U32 mEnclosingBlockOffset:31; - U32 mIsProvided:1; - - }; - - // these templates allow us to distinguish between template parameters - // that derive from BaseBlock and those that don't - template - struct IsBlock - { - static const bool value = false; - struct EmptyBase {}; - typedef EmptyBase base_class_t; - }; - - template - struct IsBlock - { - static const bool value = true; - typedef BaseBlock base_class_t; - }; - - template - struct IsBlock, typename T::baseblock_base_class_t > - { - static const bool value = true; - typedef BaseBlock base_class_t; - }; - - template::value> - class ParamValue : public NAME_VALUE_LOOKUP - { - public: - typedef const T& value_assignment_t; - typedef T value_t; - typedef ParamValue self_t; - - ParamValue(): mValue() {} - ParamValue(value_assignment_t other) : mValue(other) {} - - void setValue(value_assignment_t val) - { - mValue = val; - } - - value_assignment_t getValue() const - { - return mValue; - } - - T& getValue() - { - return mValue; - } - - operator value_assignment_t() const - { - return mValue; - } - - value_assignment_t operator()() const - { - return mValue; - } - - void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name) - { - *this = name; - } - - self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) - { - if (NAME_VALUE_LOOKUP::getValueFromName(name, mValue)) - { - setValueName(name); - } - - return *this; - } - - protected: - T mValue; - }; - - template - class ParamValue - : public T, - public NAME_VALUE_LOOKUP - { - public: - typedef const T& value_assignment_t; - typedef T value_t; - typedef ParamValue self_t; - - ParamValue() - : T(), - mValidated(false) - {} - - ParamValue(value_assignment_t other) - : T(other), - mValidated(false) - {} - - void setValue(value_assignment_t val) - { - *this = val; - } - - value_assignment_t getValue() const - { - return *this; - } - - T& getValue() - { - return *this; - } - - operator value_assignment_t() const - { - return *this; - } - - value_assignment_t operator()() const - { - return *this; - } - - void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name) - { - *this = name; - } - - self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) - { - if (NAME_VALUE_LOOKUP::getValueFromName(name, *this)) - { - setValueName(name); - } - - return *this; - } - - protected: - mutable bool mValidated; // lazy validation flag - }; - - template - class ParamValue - : public NAME_VALUE_LOOKUP - { - public: - typedef const std::string& value_assignment_t; - typedef std::string value_t; - typedef ParamValue self_t; - - ParamValue(): mValue() {} - ParamValue(value_assignment_t other) : mValue(other) {} - - void setValue(value_assignment_t val) - { - if (NAME_VALUE_LOOKUP::getValueFromName(val, mValue)) - { - NAME_VALUE_LOOKUP::setValueName(val); - } - else - { - mValue = val; - } - } - - value_assignment_t getValue() const - { - return mValue; - } - - std::string& getValue() - { - return mValue; - } - - operator value_assignment_t() const - { - return mValue; - } - - value_assignment_t operator()() const - { - return mValue; - } - - protected: - std::string mValue; - }; - - - template > - struct ParamIterator - { - typedef typename std::vector >::const_iterator const_iterator; - typedef typename std::vector >::iterator iterator; - }; - - // specialize for custom parsing/decomposition of specific classes - // e.g. TypedParam has left, top, right, bottom, etc... - template, - bool HAS_MULTIPLE_VALUES = false, - bool VALUE_IS_BLOCK = IsBlock >::value> - class TypedParam - : public Param, - public ParamValue - { - public: - typedef TypedParam self_t; - typedef ParamValue param_value_t; - typedef typename param_value_t::value_assignment_t value_assignment_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - - using param_value_t::operator(); - - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) - { - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - validate_func, - &inspectParam, - min_count, max_count)); - BaseBlock::addParam(block_descriptor, param_descriptor, name); - } - - setValue(value); - } - - bool isProvided() const { return Param::anyProvided(); } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) - { - self_t& typed_param = static_cast(param); - // no further names in stack, attempt to parse value now - if (name_stack_range.first == name_stack_range.second) - { - if (parser.readValue(typed_param.getValue())) - { - typed_param.clearValueName(); - typed_param.setProvided(); - return true; - } - - // try to parse a known named value - if(name_value_lookup_t::valueNamesExist()) - { - // try to parse a known named value - std::string name; - if (parser.readValue(name)) - { - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) - { - typed_param.setValueName(name); - typed_param.setProvided(); - return true; - } - - } - } - } - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; - - if (!name_stack.empty()) - { - name_stack.back().second = true; - } - - std::string key = typed_param.getValueName(); - - // first try to write out name of name/value pair - - if (!key.empty()) - { - if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), key)) - { - parser.writeValue(key, name_stack); - } - } - // then try to serialize value directly - else if (!diff_param || !ParamCompare::equals(typed_param.getValue(), static_cast(diff_param)->getValue())) - { - if (!parser.writeValue(typed_param.getValue(), name_stack)) - { - std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); - if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), calculated_key)) - { - parser.writeValue(calculated_key, name_stack); - } - } - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); - // then tell it about string-based alternatives ("red", "blue", etc. for LLColor4) - if (name_value_lookup_t::getPossibleValues()) - { - parser.inspectValue(name_stack, min_count, max_count, name_value_lookup_t::getPossibleValues()); - } - } - - void set(value_assignment_t val, bool flag_as_provided = true) - { - param_value_t::clearValueName(); - setValue(val); - setProvided(flag_as_provided); - } - - self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) - { - return static_cast(param_value_t::operator =(name)); - } - - protected: - - self_t& operator =(const self_t& other) - { - param_value_t::operator =(other); - Param::operator =(other); - return *this; - } - - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (src_typed_param.isProvided() - && (overwrite || !dst_typed_param.isProvided())) - { - dst_typed_param.set(src_typed_param.getValue()); - return true; - } - return false; - } - }; - - // parameter that is a block - template - class TypedParam - : public Param, - public ParamValue - { - public: - typedef ParamValue param_value_t; - typedef typename param_value_t::value_assignment_t value_assignment_t; - typedef TypedParam self_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - - using param_value_t::operator(); - - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr), - param_value_t(value) - { - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - validate_func, - &inspectParam, - min_count, max_count)); - BaseBlock::addParam(block_descriptor, param_descriptor, name); - } - } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) - { - self_t& typed_param = static_cast(param); - // attempt to parse block... - if(typed_param.deserializeBlock(parser, name_stack_range, new_name)) - { - typed_param.clearValueName(); - typed_param.setProvided(); - return true; - } - - if(name_value_lookup_t::valueNamesExist()) - { - // try to parse a known named value - std::string name; - if (parser.readValue(name)) - { - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) - { - typed_param.setValueName(name); - typed_param.setProvided(); - return true; - } - - } - } - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; - - if (!name_stack.empty()) - { - name_stack.back().second = true; - } - - std::string key = typed_param.getValueName(); - if (!key.empty()) - { - if (!parser.writeValue(key, name_stack)) - { - return; - } - } - else - { - typed_param.serializeBlock(parser, name_stack, static_cast(diff_param)); - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - // I am a param that is also a block, so just recurse into my contents - const self_t& typed_param = static_cast(param); - typed_param.inspectBlock(parser, name_stack, min_count, max_count); - } - - // a param-that-is-a-block is provided when the user has set one of its child params - // *and* the block as a whole validates - bool isProvided() const - { - // only validate block when it hasn't already passed validation with current data - if (Param::anyProvided() && !param_value_t::mValidated) - { - // a sub-block is "provided" when it has been filled in enough to be valid - param_value_t::mValidated = param_value_t::validateBlock(false); - } - return Param::anyProvided() && param_value_t::mValidated; - } - - // assign block contents to this param-that-is-a-block - void set(value_assignment_t val, bool flag_as_provided = true) - { - setValue(val); - param_value_t::clearValueName(); - // force revalidation of block - // next call to isProvided() will update provision status based on validity - param_value_t::mValidated = false; - setProvided(flag_as_provided); - } - - self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) - { - return static_cast(param_value_t::operator =(name)); - } - - // propagate changed status up to enclosing block - /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) - { - param_value_t::paramChanged(changed_param, user_provided); - if (user_provided) - { - // a child param has been explicitly changed - // so *some* aspect of this block is now provided - param_value_t::mValidated = false; - setProvided(); - param_value_t::clearValueName(); - } - else - { - Param::enclosingBlock().paramChanged(*this, user_provided); - } - } - - protected: - - self_t& operator =(const self_t& other) - { - param_value_t::operator =(other); - Param::operator =(other); - return *this; - } - - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (src_typed_param.anyProvided()) - { - if (dst_typed_param.mergeBlockParam(src_typed_param.isProvided(), dst_typed_param.isProvided(), param_value_t::selfBlockDescriptor(), src_typed_param, overwrite)) - { - dst_typed_param.clearValueName(); - dst_typed_param.setProvided(true); - return true; - } - } - return false; - } - }; - - // container of non-block parameters - template - class TypedParam - : public Param - { - public: - typedef TypedParam self_t; - typedef ParamValue param_value_t; - typedef typename std::vector container_t; - typedef const container_t& value_assignment_t; - - typedef typename param_value_t::value_t value_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) - { - std::copy(value.begin(), value.end(), std::back_inserter(mValues)); - - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - validate_func, - &inspectParam, - min_count, max_count)); - BaseBlock::addParam(block_descriptor, param_descriptor, name); - } - } - - bool isProvided() const { return Param::anyProvided(); } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) - { - self_t& typed_param = static_cast(param); - value_t value; - // no further names in stack, attempt to parse value now - if (name_stack_range.first == name_stack_range.second) - { - // attempt to read value directly - if (parser.readValue(value)) - { - typed_param.add(value); - return true; - } - - // try to parse a known named value - if(name_value_lookup_t::valueNamesExist()) - { - // try to parse a known named value - std::string name; - if (parser.readValue(name)) - { - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) - { - typed_param.add(value); - typed_param.mValues.back().setValueName(name); - return true; - } - - } - } - } - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided() || name_stack.empty()) return; - - for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); - it != end_it; - ++it) - { - std::string key = it->getValueName(); - name_stack.back().second = true; - - if(key.empty()) - // not parsed via name values, write out value directly - { - bool value_written = parser.writeValue(*it, name_stack); - if (!value_written) - { - std::string calculated_key = it->calcValueName(it->getValue()); - if (!parser.writeValue(calculated_key, name_stack)) - { - break; - } - } - } - else - { - if(!parser.writeValue(key, name_stack)) - { - break; - } - } - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - parser.inspectValue(name_stack, min_count, max_count, NULL); - if (name_value_lookup_t::getPossibleValues()) - { - parser.inspectValue(name_stack, min_count, max_count, name_value_lookup_t::getPossibleValues()); - } - } - - void set(value_assignment_t val, bool flag_as_provided = true) - { - mValues = val; - setProvided(flag_as_provided); - } - - param_value_t& add() - { - mValues.push_back(param_value_t(value_t())); - Param::setProvided(); - return mValues.back(); - } - - void add(const value_t& item) - { - param_value_t param_value; - param_value.setValue(item); - mValues.push_back(param_value); - setProvided(); - } - - void add(const typename name_value_lookup_t::name_t& name) - { - value_t value; - - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) - { - add(value); - mValues.back().setValueName(name); - } - } - - // implicit conversion - operator value_assignment_t() const { return mValues; } - // explicit conversion - value_assignment_t operator()() const { return mValues; } - - typedef typename container_t::iterator iterator; - typedef typename container_t::const_iterator const_iterator; - iterator begin() { return mValues.begin(); } - iterator end() { return mValues.end(); } - const_iterator begin() const { return mValues.begin(); } - const_iterator end() const { return mValues.end(); } - bool empty() const { return mValues.empty(); } - size_t size() const { return mValues.size(); } - - U32 numValidElements() const - { - return mValues.size(); - } - - protected: - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (overwrite) - { - std::copy(src_typed_param.begin(), src_typed_param.end(), std::back_inserter(dst_typed_param.mValues)); - } - else - { - container_t new_values(src_typed_param.mValues); - std::copy(dst_typed_param.begin(), dst_typed_param.end(), std::back_inserter(new_values)); - std::swap(dst_typed_param.mValues, new_values); - } - - if (src_typed_param.begin() != src_typed_param.end()) - { - dst_typed_param.setProvided(); - } - return true; - } - - container_t mValues; - }; - - // container of block parameters - template - class TypedParam - : public Param - { - public: - typedef TypedParam self_t; - typedef ParamValue param_value_t; - typedef typename std::vector container_t; - typedef const container_t& value_assignment_t; - typedef typename param_value_t::value_t value_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) - { - std::copy(value.begin(), value.end(), back_inserter(mValues)); - - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - validate_func, - &inspectParam, - min_count, max_count)); - BaseBlock::addParam(block_descriptor, param_descriptor, name); - } - } - - bool isProvided() const { return Param::anyProvided(); } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) - { - self_t& typed_param = static_cast(param); - bool new_value = false; - - if (new_name || typed_param.mValues.empty()) - { - new_value = true; - typed_param.mValues.push_back(value_t()); - } - - param_value_t& value = typed_param.mValues.back(); - - // attempt to parse block... - if(value.deserializeBlock(parser, name_stack_range, new_name)) - { - typed_param.setProvided(); - return true; - } - else if(name_value_lookup_t::valueNamesExist()) - { - // try to parse a known named value - std::string name; - if (parser.readValue(name)) - { - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value.getValue())) - { - typed_param.mValues.back().setValueName(name); - typed_param.setProvided(); - return true; - } - - } - } - - if (new_value) - { // failed to parse new value, pop it off - typed_param.mValues.pop_back(); - } - - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided() || name_stack.empty()) return; - - for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); - it != end_it; - ++it) - { - name_stack.back().second = true; - - std::string key = it->getValueName(); - if (!key.empty()) - { - parser.writeValue(key, name_stack); - } - // Not parsed via named values, write out value directly - // NOTE: currently we don't worry about removing default values in Multiple - else - { - it->serializeBlock(parser, name_stack, NULL); - } - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - // I am a vector of blocks, so describe my contents recursively - param_value_t(value_t()).inspectBlock(parser, name_stack, min_count, max_count); - } - - void set(value_assignment_t val, bool flag_as_provided = true) - { - mValues = val; - setProvided(flag_as_provided); - } - - param_value_t& add() - { - mValues.push_back(value_t()); - setProvided(); - return mValues.back(); - } - - void add(const value_t& item) - { - mValues.push_back(item); - setProvided(); - } - - void add(const typename name_value_lookup_t::name_t& name) - { - value_t value; - - // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) - { - add(value); - mValues.back().setValueName(name); - } - } - - // implicit conversion - operator value_assignment_t() const { return mValues; } - // explicit conversion - value_assignment_t operator()() const { return mValues; } - - typedef typename container_t::iterator iterator; - typedef typename container_t::const_iterator const_iterator; - iterator begin() { return mValues.begin(); } - iterator end() { return mValues.end(); } - const_iterator begin() const { return mValues.begin(); } - const_iterator end() const { return mValues.end(); } - bool empty() const { return mValues.empty(); } - size_t size() const { return mValues.size(); } - - U32 numValidElements() const - { - U32 count = 0; - for (const_iterator it = mValues.begin(), end_it = mValues.end(); - it != end_it; - ++it) - { - if(it->validateBlock(false)) count++; - } - return count; - } - - protected: - - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (overwrite) - { - std::copy(src_typed_param.begin(), src_typed_param.end(), std::back_inserter(dst_typed_param.mValues)); - } - else - { - container_t new_values(src_typed_param.mValues); - std::copy(dst_typed_param.begin(), dst_typed_param.end(), std::back_inserter(new_values)); - std::swap(dst_typed_param.mValues, new_values); - } - - if (src_typed_param.begin() != src_typed_param.end()) - { - dst_typed_param.setProvided(); - } - - return true; - } - - container_t mValues; - }; - - template - class ChoiceBlock : public BASE_BLOCK - { - typedef ChoiceBlock self_t; - typedef ChoiceBlock enclosing_block_t; - typedef BASE_BLOCK base_block_t; - - LOG_CLASS(self_t); - public: - // take all provided params from other and apply to self - bool overwriteFrom(const self_t& other) - { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, true); - } - - // take all provided params that are not already provided, and apply to self - bool fillFrom(const self_t& other) - { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, false); - } - - bool mergeBlockParam(bool source_provided, bool dest_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) - { - bool source_override = source_provided && (overwrite || !dest_provided); - - if (source_override || source.mCurChoice == mCurChoice) - { - return mergeBlock(block_data, source, overwrite); - } - return false; - } - - // merge with other block - bool mergeBlock(BlockDescriptor& block_data, const self_t& other, bool overwrite) - { - mCurChoice = other.mCurChoice; - return base_block_t::mergeBlock(selfBlockDescriptor(), other, overwrite); - } - - // clear out old choice when param has changed - /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) - { - param_handle_t changed_param_handle = base_block_t::getHandleFromParam(&changed_param); - // if we have a new choice... - if (changed_param_handle != mCurChoice) - { - // clear provided flag on previous choice - Param* previous_choice = base_block_t::getParamFromHandle(mCurChoice); - if (previous_choice) - { - previous_choice->setProvided(false); - } - mCurChoice = changed_param_handle; - } - base_block_t::paramChanged(changed_param, user_provided); - } - - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } - - protected: - ChoiceBlock() - : mCurChoice(0) - { - BaseBlock::init(selfBlockDescriptor(), base_block_t::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); - } - - // Alternatives are mutually exclusive wrt other Alternatives in the same block. - // One alternative in a block will always have isChosen() == true. - // At most one alternative in a block will have isProvided() == true. - template > - class Alternative : public TypedParam - { - public: - friend class ChoiceBlock; - - typedef Alternative self_t; - typedef TypedParam >::value> super_t; - typedef typename super_t::value_assignment_t value_assignment_t; - - using super_t::operator =; - - explicit Alternative(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), - mOriginalValue(val) - { - // assign initial choice to first declared option - DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr); - if (LL_UNLIKELY(DERIVED_BLOCK::selfBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) - { - if(blockp->mCurChoice == 0) - { - blockp->mCurChoice = Param::enclosingBlock().getHandleFromParam(this); - } - } - } - - void choose() - { - static_cast(Param::enclosingBlock()).paramChanged(*this, true); - } - - void chooseAs(value_assignment_t val) - { - super_t::set(val); - } - - void operator =(value_assignment_t val) - { - super_t::set(val); - } - - void operator()(typename super_t::value_assignment_t val) - { - super_t::set(val); - } - - operator value_assignment_t() const - { - return (*this)(); - } - - value_assignment_t operator()() const - { - if (static_cast(Param::enclosingBlock()).getCurrentChoice() == this) - { - return super_t::getValue(); - } - return mOriginalValue; - } - - bool isChosen() const - { - return static_cast(Param::enclosingBlock()).getCurrentChoice() == this; - } - - private: - T mOriginalValue; - }; - - protected: - static BlockDescriptor& selfBlockDescriptor() - { - static BlockDescriptor sBlockDescriptor; - return sBlockDescriptor; - } - - private: - param_handle_t mCurChoice; - - const Param* getCurrentChoice() const - { - return base_block_t::getParamFromHandle(mCurChoice); - } - }; - - template - class Block - : public BASE_BLOCK - { - typedef Block self_t; - typedef Block block_t; - - public: - typedef BASE_BLOCK base_block_t; - - // take all provided params from other and apply to self - bool overwriteFrom(const self_t& other) - { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, true); - } - - // take all provided params that are not already provided, and apply to self - bool fillFrom(const self_t& other) - { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, false); - } - - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } - - protected: - Block() - { - //#pragma message("Parsing LLInitParam::Block") - BaseBlock::init(selfBlockDescriptor(), BASE_BLOCK::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); - } - - // - // Nested classes for declaring parameters - // - template > - class Optional : public TypedParam - { - public: - typedef TypedParam >::value> super_t; - typedef typename super_t::value_assignment_t value_assignment_t; - - using super_t::operator(); - using super_t::operator =; - - explicit Optional(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) - { - //#pragma message("Parsing LLInitParam::Block::Optional") - } - - Optional& operator =(value_assignment_t val) - { - set(val); - return *this; - } - - DERIVED_BLOCK& operator()(value_assignment_t val) - { - super_t::set(val); - return static_cast(Param::enclosingBlock()); - } - }; - - template > - class Mandatory : public TypedParam - { - public: - typedef TypedParam >::value> super_t; - typedef Mandatory self_t; - typedef typename super_t::value_assignment_t value_assignment_t; - - using super_t::operator(); - using super_t::operator =; - - // mandatory parameters require a name to be parseable - explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1) - {} - - Mandatory& operator =(value_assignment_t val) - { - set(val); - return *this; - } - - DERIVED_BLOCK& operator()(typename super_t::value_assignment_t val) - { - super_t::set(val); - return static_cast(Param::enclosingBlock()); - } - - static bool validate(const Param* p) - { - // valid only if provided - return static_cast(p)->isProvided(); - } - - }; - - template > - class Multiple : public TypedParam - { - public: - typedef TypedParam >::value> super_t; - typedef Multiple self_t; - typedef typename super_t::container_t container_t; - typedef typename super_t::value_assignment_t value_assignment_t; - typedef typename super_t::iterator iterator; - typedef typename super_t::const_iterator const_iterator; - - explicit Multiple(const char* name = "") - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount) - {} - - Multiple& operator =(value_assignment_t val) - { - set(val); - return *this; - } - - DERIVED_BLOCK& operator()(typename super_t::value_assignment_t val) - { - super_t::set(val); - return static_cast(Param::enclosingBlock()); - } - - static bool validate(const Param* paramp) - { - U32 num_valid = ((super_t*)paramp)->numValidElements(); - return RANGE::minCount <= num_valid && num_valid <= RANGE::maxCount; - } - }; - - class Deprecated : public Param - { - public: - explicit Deprecated(const char* name) - : Param(DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) - { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor(); - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - NULL, - &deserializeParam, - NULL, - NULL, - NULL, - 0, S32_MAX)); - BaseBlock::addParam(block_descriptor, param_descriptor, name); - } - } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) - { - if (name_stack_range.first == name_stack_range.second) - { - //std::string message = llformat("Deprecated value %s ignored", getName().c_str()); - //parser.parserWarning(message); - return true; - } - - return false; - } - }; - - // different semantics for documentation purposes, but functionally identical - typedef Deprecated Ignored; - - protected: - static BlockDescriptor& selfBlockDescriptor() - { - static BlockDescriptor sBlockDescriptor; - return sBlockDescriptor; - } - - template - void changeDefault(TypedParam& param, - typename TypedParam::value_assignment_t value) - { - if (!param.isProvided()) - { - param.set(value, false); - } - } - - }; - - template - class BatchBlock - : public Block - { - public: - typedef BatchBlock self_t; - typedef Block super_t; - - BatchBlock() - {} - - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name) - { - if (new_name) - { - // reset block - *static_cast(this) = defaultBatchValue(); - } - return super_t::deserializeBlock(p, name_stack_range, new_name); - } - - bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) - { - if (overwrite) - { - *static_cast(this) = defaultBatchValue(); - // merge individual parameters into destination - return super_t::mergeBlock(super_t::selfBlockDescriptor(), other, overwrite); - } - return false; - } - protected: - static const DERIVED_BLOCK& defaultBatchValue() - { - static DERIVED_BLOCK default_value; - return default_value; - } - }; - - // FIXME: this specialization is not currently used, as it only matches against the BatchBlock base class - // and not the derived class with the actual params - template - class ParamValue , - NAME_VALUE_LOOKUP, - true> - : public NAME_VALUE_LOOKUP, - protected BatchBlock - { - public: - typedef BatchBlock block_t; - typedef const BatchBlock& value_assignment_t; - typedef block_t value_t; - - ParamValue() - : block_t(), - mValidated(false) - {} - - ParamValue(value_assignment_t other) - : block_t(other), - mValidated(false) - { - } - - void setValue(value_assignment_t val) - { - *this = val; - } - - value_assignment_t getValue() const - { - return *this; - } - - BatchBlock& getValue() - { - return *this; - } - - operator value_assignment_t() const - { - return *this; - } - - value_assignment_t operator()() const - { - return *this; - } - - protected: - mutable bool mValidated; // lazy validation flag - }; - - template - class ParamValue , - TypeValues, - IS_BLOCK> - : public IsBlock::base_class_t - { - public: - typedef ParamValue , TypeValues, false> self_t; - typedef const T& value_assignment_t; - typedef T value_t; - - ParamValue() - : mValue(), - mValidated(false) - {} - - ParamValue(value_assignment_t other) - : mValue(other), - mValidated(false) - {} - - void setValue(value_assignment_t val) - { - mValue.set(val); - } - - value_assignment_t getValue() const - { - return mValue.get(); - } - - T& getValue() - { - return mValue.get(); - } - - operator value_assignment_t() const - { - return mValue.get(); - } - - value_assignment_t operator()() const - { - return mValue.get(); - } - - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name) - { - return mValue.get().deserializeBlock(p, name_stack_range, new_name); - } - - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const - { - if (mValue.empty()) return; - - mValue.get().serializeBlock(p, name_stack, diff_block); - } - - bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const - { - if (mValue.empty()) return false; - - return mValue.get().inspectBlock(p, name_stack, min_count, max_count); - } - - protected: - mutable bool mValidated; // lazy validation flag - - private: - BaseBlock::Lazy mValue; - }; - - template <> - class ParamValue , - false> - : public TypeValues, - public BaseBlock - { - public: - typedef ParamValue, false> self_t; - typedef const LLSD& value_assignment_t; - - ParamValue() - : mValidated(false) - {} - - ParamValue(value_assignment_t other) - : mValue(other), - mValidated(false) - {} - - void setValue(value_assignment_t val) { mValue = val; } - - value_assignment_t getValue() const { return mValue; } - LLSD& getValue() { return mValue; } - - operator value_assignment_t() const { return mValue; } - value_assignment_t operator()() const { return mValue; } - - - // block param interface - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; - bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const - { - //TODO: implement LLSD params as schema type Any - return true; - } - - protected: - mutable bool mValidated; // lazy validation flag - - private: - static void serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack); - - LLSD mValue; - }; - - template - class CustomParamValue - : public Block > >, - public TypeValues - { - public: - typedef enum e_value_age - { - VALUE_NEEDS_UPDATE, // mValue needs to be refreshed from the block parameters - VALUE_AUTHORITATIVE, // mValue holds the authoritative value (which has been replicated to the block parameters via updateBlockFromValue) - BLOCK_AUTHORITATIVE // mValue is derived from the block parameters, which are authoritative - } EValueAge; - - typedef ParamValue > derived_t; - typedef CustomParamValue self_t; - typedef Block block_t; - typedef const T& value_assignment_t; - typedef T value_t; - - - CustomParamValue(const T& value = T()) - : mValue(value), - mValueAge(VALUE_AUTHORITATIVE), - mValidated(false) - {} - - bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack_range, bool new_name) - { - derived_t& typed_param = static_cast(*this); - // try to parse direct value T - if (name_stack_range.first == name_stack_range.second) - { - if(parser.readValue(typed_param.mValue)) - { - typed_param.mValueAge = VALUE_AUTHORITATIVE; - typed_param.updateBlockFromValue(false); - - typed_param.clearValueName(); - - return true; - } - } - - // fall back on parsing block components for T - return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); - } - - void serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const - { - const derived_t& typed_param = static_cast(*this); - const derived_t* diff_param = static_cast(diff_block); - - std::string key = typed_param.getValueName(); - - // first try to write out name of name/value pair - if (!key.empty()) - { - if (!diff_param || !ParamCompare::equals(diff_param->getValueName(), key)) - { - parser.writeValue(key, name_stack); - } - } - // then try to serialize value directly - else if (!diff_param || !ParamCompare::equals(typed_param.getValue(), diff_param->getValue())) - { - - if (!parser.writeValue(typed_param.getValue(), name_stack)) - { - //RN: *always* serialize provided components of BlockValue (don't pass diff_param on), - // since these tend to be viewed as the constructor arguments for the value T. It seems - // cleaner to treat the uniqueness of a BlockValue according to the generated value, and - // not the individual components. This way will not - // be exported as , since it was probably the intent of the user to - // be specific about the RGB color values. This also fixes an issue where we distinguish - // between rect.left not being provided and rect.left being explicitly set to 0 (same as default) - - if (typed_param.mValueAge == VALUE_AUTHORITATIVE) - { - // if the value is authoritative but the parser doesn't accept the value type - // go ahead and make a copy, and splat the value out to its component params - // and serialize those params - derived_t copy(typed_param); - copy.updateBlockFromValue(true); - copy.block_t::serializeBlock(parser, name_stack, NULL); - } - else - { - block_t::serializeBlock(parser, name_stack, NULL); - } - } - } - } - - bool inspectBlock(Parser& parser, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const - { - // first, inspect with actual type... - parser.inspectValue(name_stack, min_count, max_count, NULL); - if (TypeValues::getPossibleValues()) - { - //...then inspect with possible string values... - parser.inspectValue(name_stack, min_count, max_count, TypeValues::getPossibleValues()); - } - // then recursively inspect contents... - return block_t::inspectBlock(parser, name_stack, min_count, max_count); - } - - bool validateBlock(bool emit_errors = true) const - { - if (mValueAge == VALUE_NEEDS_UPDATE) - { - if (block_t::validateBlock(emit_errors)) - { - // clear stale keyword associated with old value - TypeValues::clearValueName(); - mValueAge = BLOCK_AUTHORITATIVE; - static_cast(const_cast(this))->updateValueFromBlock(); - return true; - } - else - { - //block value incomplete, so not considered provided - // will attempt to revalidate on next call to isProvided() - return false; - } - } - else - { - // we have a valid value in hand - return true; - } - } - - // propagate change status up to enclosing block - /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) - { - BaseBlock::paramChanged(changed_param, user_provided); - if (user_provided) - { - // a parameter changed, so our value is out of date - mValueAge = VALUE_NEEDS_UPDATE; - } - } - - void setValue(value_assignment_t val) - { - derived_t& typed_param = static_cast(*this); - // set param version number to be up to date, so we ignore block contents - mValueAge = VALUE_AUTHORITATIVE; - mValue = val; - typed_param.clearValueName(); - static_cast(this)->updateBlockFromValue(false); - } - - value_assignment_t getValue() const - { - validateBlock(true); - return mValue; - } - - T& getValue() - { - validateBlock(true); - return mValue; - } - - operator value_assignment_t() const - { - return getValue(); - } - - value_assignment_t operator()() const - { - return getValue(); - } - - protected: - - // use this from within updateValueFromBlock() to set the value without making it authoritative - void updateValue(value_assignment_t value) - { - mValue = value; - } - - bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) - { - bool source_override = source_provided && (overwrite || !dst_provided); - - const derived_t& src_typed_param = static_cast(source); - - if (source_override && src_typed_param.mValueAge == VALUE_AUTHORITATIVE) - { - // copy value over - setValue(src_typed_param.getValue()); - return true; - } - // merge individual parameters into destination - if (mValueAge == VALUE_AUTHORITATIVE) - { - static_cast(this)->updateBlockFromValue(dst_provided); - } - return mergeBlock(block_data, source, overwrite); - } - - bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) - { - return block_t::mergeBlock(block_data, source, overwrite); - } - - mutable bool mValidated; // lazy validation flag - - private: - mutable T mValue; - mutable EValueAge mValueAge; - }; -} - - -#endif // LL_LLPARAM_H diff --git a/indra/llxuixml/llregistry.h b/indra/llxuixml/llregistry.h deleted file mode 100644 index 36ce6a97b7..0000000000 --- a/indra/llxuixml/llregistry.h +++ /dev/null @@ -1,351 +0,0 @@ -/** - * @file llregistry.h - * @brief template classes for registering name, value pairs in nested scopes, statically, etc. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLREGISTRY_H -#define LL_LLREGISTRY_H - -#include - -#include -#include "llsingleton.h" - -template -class LLRegistryDefaultComparator -{ - bool operator()(const T& lhs, const T& rhs) { return lhs < rhs; } -}; - -template > -class LLRegistry -{ -public: - typedef LLRegistry registry_t; - typedef typename boost::add_reference::type>::type ref_const_key_t; - typedef typename boost::add_reference::type>::type ref_const_value_t; - typedef typename boost::add_reference::type ref_value_t; - typedef typename boost::add_pointer::type>::type ptr_const_value_t; - typedef typename boost::add_pointer::type ptr_value_t; - - class Registrar - { - friend class LLRegistry; - public: - typedef typename std::map registry_map_t; - - bool add(ref_const_key_t key, ref_const_value_t value) - { - if (mMap.insert(std::make_pair(key, value)).second == false) - { - llwarns << "Tried to register " << key << " but it was already registered!" << llendl; - return false; - } - return true; - } - - void remove(ref_const_key_t key) - { - mMap.erase(key); - } - - void replace(ref_const_key_t key, ref_const_value_t value) - { - mMap[key] = value; - } - - typename registry_map_t::const_iterator beginItems() const - { - return mMap.begin(); - } - - typename registry_map_t::const_iterator endItems() const - { - return mMap.end(); - } - - protected: - ptr_value_t getValue(ref_const_key_t key) - { - typename registry_map_t::iterator found_it = mMap.find(key); - if (found_it != mMap.end()) - { - return &(found_it->second); - } - return NULL; - } - - ptr_const_value_t getValue(ref_const_key_t key) const - { - typename registry_map_t::const_iterator found_it = mMap.find(key); - if (found_it != mMap.end()) - { - return &(found_it->second); - } - return NULL; - } - - // if the registry is used to store pointers, and null values are valid entries - // then use this function to check the existence of an entry - bool exists(ref_const_key_t key) const - { - return mMap.find(key) != mMap.end(); - } - - bool empty() const - { - return mMap.empty(); - } - - protected: - // use currentRegistrar() or defaultRegistrar() - Registrar() {} - ~Registrar() {} - - private: - registry_map_t mMap; - }; - - typedef typename std::list scope_list_t; - typedef typename std::list::iterator scope_list_iterator_t; - typedef typename std::list::const_iterator scope_list_const_iterator_t; - - LLRegistry() - {} - - ~LLRegistry() {} - - ptr_value_t getValue(ref_const_key_t key) - { - for(scope_list_iterator_t it = mActiveScopes.begin(); - it != mActiveScopes.end(); - ++it) - { - ptr_value_t valuep = (*it)->getValue(key); - if (valuep != NULL) return valuep; - } - return mDefaultRegistrar.getValue(key); - } - - ptr_const_value_t getValue(ref_const_key_t key) const - { - for(scope_list_const_iterator_t it = mActiveScopes.begin(); - it != mActiveScopes.end(); - ++it) - { - ptr_value_t valuep = (*it)->getValue(key); - if (valuep != NULL) return valuep; - } - return mDefaultRegistrar.getValue(key); - } - - bool exists(ref_const_key_t key) const - { - for(scope_list_const_iterator_t it = mActiveScopes.begin(); - it != mActiveScopes.end(); - ++it) - { - if ((*it)->exists(key)) return true; - } - - return mDefaultRegistrar.exists(key); - } - - bool empty() const - { - for(scope_list_const_iterator_t it = mActiveScopes.begin(); - it != mActiveScopes.end(); - ++it) - { - if (!(*it)->empty()) return false; - } - - return mDefaultRegistrar.empty(); - } - - - Registrar& defaultRegistrar() - { - return mDefaultRegistrar; - } - - const Registrar& defaultRegistrar() const - { - return mDefaultRegistrar; - } - - - Registrar& currentRegistrar() - { - if (!mActiveScopes.empty()) - { - return *mActiveScopes.front(); - } - - return mDefaultRegistrar; - } - - const Registrar& currentRegistrar() const - { - if (!mActiveScopes.empty()) - { - return *mActiveScopes.front(); - } - - return mDefaultRegistrar; - } - - -protected: - void addScope(Registrar* scope) - { - // newer scopes go up front - mActiveScopes.insert(mActiveScopes.begin(), scope); - } - - void removeScope(Registrar* scope) - { - // O(N) but should be near the beggining and N should be small and this is safer than storing iterators - scope_list_iterator_t iter = std::find(mActiveScopes.begin(), mActiveScopes.end(), scope); - if (iter != mActiveScopes.end()) - { - mActiveScopes.erase(iter); - } - } - -private: - scope_list_t mActiveScopes; - Registrar mDefaultRegistrar; -}; - -template > -class LLRegistrySingleton - : public LLRegistry, - public LLSingleton -{ - friend class LLSingleton; -public: - typedef LLRegistry registry_t; - typedef const KEY& ref_const_key_t; - typedef const VALUE& ref_const_value_t; - typedef VALUE* ptr_value_t; - typedef const VALUE* ptr_const_value_t; - typedef LLSingleton singleton_t; - - class ScopedRegistrar : public registry_t::Registrar - { - public: - ScopedRegistrar(bool push_scope = true) - { - if (push_scope) - { - pushScope(); - } - } - - ~ScopedRegistrar() - { - if (!singleton_t::destroyed()) - { - popScope(); - } - } - - void pushScope() - { - singleton_t::instance().addScope(this); - } - - void popScope() - { - singleton_t::instance().removeScope(this); - } - - ptr_value_t getValueFromScope(ref_const_key_t key) - { - return getValue(key); - } - - ptr_const_value_t getValueFromScope(ref_const_key_t key) const - { - return getValue(key); - } - - private: - typename std::list::iterator mListIt; - }; - - class StaticRegistrar : public registry_t::Registrar - { - public: - virtual ~StaticRegistrar() {} - StaticRegistrar(ref_const_key_t key, ref_const_value_t value) - { - singleton_t::instance().mStaticScope->add(key, value); - } - }; - - // convenience functions - typedef typename LLRegistry::Registrar& ref_registrar_t; - static ref_registrar_t currentRegistrar() - { - return singleton_t::instance().registry_t::currentRegistrar(); - } - - static ref_registrar_t defaultRegistrar() - { - return singleton_t::instance().registry_t::defaultRegistrar(); - } - - static ptr_value_t getValue(ref_const_key_t key) - { - return singleton_t::instance().registry_t::getValue(key); - } - -protected: - // DERIVED_TYPE needs to derive from LLRegistrySingleton - LLRegistrySingleton() - : mStaticScope(NULL) - {} - - virtual void initSingleton() - { - mStaticScope = new ScopedRegistrar(); - } - - virtual ~LLRegistrySingleton() - { - delete mStaticScope; - } - -private: - ScopedRegistrar* mStaticScope; -}; - -// helper macro for doing static registration -#define GLUED_TOKEN(x, y) x ## y -#define GLUE_TOKENS(x, y) GLUED_TOKEN(x, y) -#define LLREGISTER_STATIC(REGISTRY, KEY, VALUE) static REGISTRY::StaticRegistrar GLUE_TOKENS(reg, __LINE__)(KEY, VALUE); - -#endif diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp deleted file mode 100644 index 5388069c24..0000000000 --- a/indra/llxuixml/lltrans.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/** - * @file lltrans.cpp - * @brief LLTrans implementation - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lltrans.h" - -#include "llfasttimer.h" // for call count statistics -#include "llxuiparser.h" -#include "llsd.h" -#include "llxmlnode.h" - -#include - -LLTrans::template_map_t LLTrans::sStringTemplates; -LLStringUtil::format_map_t LLTrans::sDefaultArgs; - -struct StringDef : public LLInitParam::Block -{ - Mandatory name; - Mandatory value; - - StringDef() - : name("name"), - value("value") - {} -}; - -struct StringTable : public LLInitParam::Block -{ - Multiple strings; - StringTable() - : strings("string") - {} -}; - -//static -bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set& default_args) -{ - std::string xml_filename = "(strings file)"; - if (!root->hasName("strings")) - { - llerrs << "Invalid root node name in " << xml_filename - << ": was " << root->getName() << ", expected \"strings\"" << llendl; - } - - StringTable string_table; - LLXUIParser parser; - parser.readXUI(root, string_table, xml_filename); - - if (!string_table.validateBlock()) - { - llerrs << "Problem reading strings: " << xml_filename << llendl; - return false; - } - - sStringTemplates.clear(); - sDefaultArgs.clear(); - - for(LLInitParam::ParamIterator::const_iterator it = string_table.strings.begin(); - it != string_table.strings.end(); - ++it) - { - LLTransTemplate xml_template(it->name, it->value); - sStringTemplates[xml_template.mName] = xml_template; - - std::set::const_iterator iter = default_args.find(xml_template.mName); - if (iter != default_args.end()) - { - std::string name = *iter; - if (name[0] != '[') - name = llformat("[%s]",name.c_str()); - sDefaultArgs[name] = xml_template.mText; - } - } - - return true; -} - - -//static -bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) -{ - std::string xml_filename = "(language strings file)"; - if (!root->hasName("strings")) - { - llerrs << "Invalid root node name in " << xml_filename - << ": was " << root->getName() << ", expected \"strings\"" << llendl; - } - - StringTable string_table; - LLXUIParser parser; - parser.readXUI(root, string_table, xml_filename); - - if (!string_table.validateBlock()) - { - llerrs << "Problem reading strings: " << xml_filename << llendl; - return false; - } - - for(LLInitParam::ParamIterator::const_iterator it = string_table.strings.begin(); - it != string_table.strings.end(); - ++it) - { - // share the same map with parseStrings() so we can search the strings using the same getString() function.- angela - LLTransTemplate xml_template(it->name, it->value); - sStringTemplates[xml_template.mName] = xml_template; - } - - return true; -} - - - -static LLFastTimer::DeclareTimer FTM_GET_TRANS("Translate string"); - -//static -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 - // calling LLTrans::getString() in an inner loop. JC - LLFastTimer timer(FTM_GET_TRANS); - - template_map_t::iterator iter = sStringTemplates.find(xml_desc); - if (iter != sStringTemplates.end()) - { - std::string text = iter->second.mText; - LLStringUtil::format_map_t args = sDefaultArgs; - args.insert(msg_args.begin(), msg_args.end()); - LLStringUtil::format(text, args); - - return text; - } - else - { - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - return "MissingString("+xml_desc+")"; - } -} - -//static -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 - // calling LLTrans::getString() in an inner loop. JC - LLFastTimer timer(FTM_GET_TRANS); - - template_map_t::iterator iter = sStringTemplates.find(xml_desc); - if (iter != sStringTemplates.end()) - { - std::string text = iter->second.mText; - LLStringUtil::format(text, msg_args); - return text; - } - else - { - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - return "MissingString("+xml_desc+")"; - } -} - -//static -bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) -{ - LLFastTimer timer(FTM_GET_TRANS); - - template_map_t::iterator iter = sStringTemplates.find(xml_desc); - if (iter != sStringTemplates.end()) - { - std::string text = iter->second.mText; - LLStringUtil::format_map_t args = sDefaultArgs; - args.insert(msg_args.begin(), msg_args.end()); - LLStringUtil::format(text, args); - result = text; - return true; - } - else - { - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - return false; - } -} - -//static -bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args) -{ - LLFastTimer timer(FTM_GET_TRANS); - - template_map_t::iterator iter = sStringTemplates.find(xml_desc); - if (iter != sStringTemplates.end()) - { - std::string text = iter->second.mText; - LLStringUtil::format(text, msg_args); - result = text; - return true; - } - else - { - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - return false; - } -} - -//static -std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count) -{ - // Compute which string identifier to use - const char* form = ""; - if (language == "ru") // Russian - { - // From GNU ngettext() - // Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2; - if (count % 10 == 1 - && count % 100 != 11) - { - // singular, "1 item" - form = "A"; - } - else if (count % 10 >= 2 - && count % 10 <= 4 - && (count % 100 < 10 || count % 100 >= 20) ) - { - // special case "2 items", "23 items", but not "13 items" - form = "B"; - } - else - { - // English-style plural, "5 items" - form = "C"; - } - } - else if (language == "fr" || language == "pt") // French, Brazilian Portuguese - { - // French and Portuguese treat zero as a singular "0 item" not "0 items" - if (count == 0 || count == 1) - { - form = "A"; - } - else - { - // English-style plural - form = "B"; - } - } - else // default - { - // languages like English with 2 forms, singular and plural - if (count == 1) - { - // "1 item" - form = "A"; - } - else - { - // "2 items", also use plural for "0 items" - form = "B"; - } - } - - // Translate that string - LLStringUtil::format_map_t args; - args["[COUNT]"] = llformat("%d", count); - - // Look up "AgeYearsB" or "AgeWeeksC" including the "form" - std::string key = llformat("%s%s", xml_desc.c_str(), form); - return getString(key, args); -} - -void LLTrans::setDefaultArg(const std::string& name, const std::string& value) -{ - sDefaultArgs[name] = value; -} diff --git a/indra/llxuixml/lltrans.h b/indra/llxuixml/lltrans.h deleted file mode 100644 index 128b51d383..0000000000 --- a/indra/llxuixml/lltrans.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file lltrans.h - * @brief LLTrans definition - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_TRANS_H -#define LL_TRANS_H - -#include - -#include "llpointer.h" -#include "llstring.h" - -class LLXMLNode; - -class LLSD; - -/** - * @brief String template loaded from strings.xml - */ -class LLTransTemplate -{ -public: - LLTransTemplate(const std::string& name = LLStringUtil::null, const std::string& text = LLStringUtil::null) : mName(name), mText(text) {} - - std::string mName; - std::string mText; -}; - -/** - * @brief Localized strings class - * This class is used to retrieve translations of strings used to build larger ones, as well as - * strings with a general usage that don't belong to any specific floater. For example, - * "Owner:", "Retrieving..." used in the place of a not yet known name, etc. - */ -class LLTrans -{ -public: - LLTrans(); - - /** - * @brief Parses the xml root that holds the strings. Used once on startup -// *FIXME * @param xml_filename Filename to parse - * @param default_args Set of strings (expected to be in the file) to use as default replacement args, e.g. "SECOND_LIFE" - * @returns true if the file was parsed successfully, true if something went wrong - */ - static bool parseStrings(LLPointer & root, const std::set& default_args); - - static bool parseLanguageStrings(LLPointer & root); - - /** - * @brief Returns a translated string - * @param xml_desc String's description - * @param args A list of substrings to replace in the string - * @returns Translated string - */ - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); - static std::string getString(const std::string &xml_desc, const LLSD& args); - static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args); - static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args); - - // Returns translated string with [COUNT] replaced with a number, following - // special per-language logic for plural nouns. For example, some languages - // may have different plurals for 0, 1, 2 and > 2. - // See "AgeWeeksA", "AgeWeeksB", etc. in strings.xml for examples. - static std::string getCountString(const std::string& language, const std::string& xml_desc, S32 count); - - /** - * @brief Returns a translated string - * @param xml_desc String's description - * @returns Translated string - */ - static std::string getString(const std::string &xml_desc) - { - LLStringUtil::format_map_t empty; - return getString(xml_desc, empty); - } - - static bool findString(std::string &result, const std::string &xml_desc) - { - LLStringUtil::format_map_t empty; - return findString(result, xml_desc, empty); - } - - static std::string getKeyboardString(const char* keystring) - { - std::string key_str(keystring); - std::string trans_str; - return findString(trans_str, key_str) ? trans_str : key_str; - } - - // get the default args - static const LLStringUtil::format_map_t& getDefaultArgs() - { - return sDefaultArgs; - } - - static void setDefaultArg(const std::string& name, const std::string& value); - - // insert default args into an arg list - static void getArgs(LLStringUtil::format_map_t& args) - { - args.insert(sDefaultArgs.begin(), sDefaultArgs.end()); - } - -private: - typedef std::map template_map_t; - static template_map_t sStringTemplates; - static LLStringUtil::format_map_t sDefaultArgs; -}; - -#endif diff --git a/indra/llxuixml/lluicolor.cpp b/indra/llxuixml/lluicolor.cpp deleted file mode 100644 index f9bb80f8c5..0000000000 --- a/indra/llxuixml/lluicolor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file lluicolor.cpp - * @brief brief LLUIColor class implementation file - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lluicolor.h" - -LLUIColor::LLUIColor() - :mColorPtr(NULL) -{ -} - - -LLUIColor::LLUIColor(const LLColor4& color) -: mColor(color), - mColorPtr(NULL) -{ -} - -LLUIColor::LLUIColor(const LLUIColor* color) -: mColorPtr(color) -{ -} - -void LLUIColor::set(const LLColor4& color) -{ - mColor = color; - mColorPtr = NULL; -} - -void LLUIColor::set(const LLUIColor* color) -{ - mColorPtr = color; -} - -const LLColor4& LLUIColor::get() const -{ - return (mColorPtr == NULL ? mColor : mColorPtr->get()); -} - -LLUIColor::operator const LLColor4& () const -{ - return get(); -} - -const LLColor4& LLUIColor::operator()() const -{ - return get(); -} - -bool LLUIColor::isReference() const -{ - return mColorPtr != NULL; -} - -namespace LLInitParam -{ - // used to detect equivalence with default values on export - bool ParamCompare::equals(const LLUIColor &a, const LLUIColor &b) - { - // do not detect value equivalence, treat pointers to colors as distinct from color values - return (a.mColorPtr == NULL && b.mColorPtr == NULL ? a.mColor == b.mColor : a.mColorPtr == b.mColorPtr); - } -} diff --git a/indra/llxuixml/lluicolor.h b/indra/llxuixml/lluicolor.h deleted file mode 100644 index 97ebea854a..0000000000 --- a/indra/llxuixml/lluicolor.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file lluicolor.h - * @brief brief LLUIColor class header file - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLUICOLOR_H_ -#define LL_LLUICOLOR_H_ - -#include "v4color.h" - -namespace LLInitParam -{ - template - struct ParamCompare; -} - -class LLUIColor -{ -public: - LLUIColor(); - LLUIColor(const LLColor4& color); - LLUIColor(const LLUIColor* color); - - void set(const LLColor4& color); - void set(const LLUIColor* color); - - const LLColor4& get() const; - - operator const LLColor4& () const; - const LLColor4& operator()() const; - - bool isReference() const; - -private: - friend struct LLInitParam::ParamCompare; - - const LLUIColor* mColorPtr; - LLColor4 mColor; -}; - -namespace LLInitParam -{ - template<> - struct ParamCompare - { - static bool equals(const LLUIColor& a, const LLUIColor& b); - }; -} - -#endif diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp deleted file mode 100644 index afc76024d1..0000000000 --- a/indra/llxuixml/llxuiparser.cpp +++ /dev/null @@ -1,1756 +0,0 @@ -/** - * @file llxuiparser.cpp - * @brief Utility functions for handling XUI structures in XML - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llxuiparser.h" - -#include "llxmlnode.h" - -#ifdef LL_STANDALONE -#include -#else -#include "expat/expat.h" -#endif - -#include -#include -//#include -#include - -#include "lluicolor.h" - -using namespace BOOST_SPIRIT_CLASSIC_NS; - -const S32 MAX_STRING_ATTRIBUTE_SIZE = 40; - -static LLInitParam::Parser::parser_read_func_map_t sXSDReadFuncs; -static LLInitParam::Parser::parser_write_func_map_t sXSDWriteFuncs; -static LLInitParam::Parser::parser_inspect_func_map_t sXSDInspectFuncs; - -static LLInitParam::Parser::parser_read_func_map_t sSimpleXUIReadFuncs; -static LLInitParam::Parser::parser_write_func_map_t sSimpleXUIWriteFuncs; -static LLInitParam::Parser::parser_inspect_func_map_t sSimpleXUIInspectFuncs; - -const char* NO_VALUE_MARKER = "no_value"; - -const S32 LINE_NUMBER_HERE = 0; - -struct MaxOccursValues : public LLInitParam::TypeValuesHelper -{ - static void declareValues() - { - declare("unbounded", U32_MAX); - } -}; - -struct Occurs : public LLInitParam::Block -{ - Optional minOccurs; - Optional maxOccurs; - - Occurs() - : minOccurs("minOccurs", 0), - maxOccurs("maxOccurs", U32_MAX) - - {} -}; - - -typedef enum -{ - USE_REQUIRED, - USE_OPTIONAL -} EUse; - -namespace LLInitParam -{ - template<> - struct TypeValues : public TypeValuesHelper - { - static void declareValues() - { - declare("required", USE_REQUIRED); - declare("optional", USE_OPTIONAL); - } - }; -} - -struct Element; -struct Group; -struct Choice; -struct Sequence; -struct Any; - -struct Attribute : public LLInitParam::Block -{ - Mandatory name; - Mandatory type; - Mandatory use; - - Attribute() - : name("name"), - type("type"), - use("use") - {} -}; - -struct Any : public LLInitParam::Block -{ - Optional _namespace; - - Any() - : _namespace("namespace") - {} -}; - -struct All : public LLInitParam::Block -{ - Multiple< Lazy > elements; - - All() - : elements("element") - { - maxOccurs = 1; - } -}; - -struct Choice : public LLInitParam::ChoiceBlock -{ - Alternative< Lazy > element; - Alternative< Lazy > group; - Alternative< Lazy > choice; - Alternative< Lazy > sequence; - Alternative< Lazy > any; - - Choice() - : element("element"), - group("group"), - choice("choice"), - sequence("sequence"), - any("any") - {} - -}; - -struct Sequence : public LLInitParam::ChoiceBlock -{ - Alternative< Lazy > element; - Alternative< Lazy > group; - Alternative< Lazy > choice; - Alternative< Lazy > sequence; - Alternative< Lazy > any; -}; - -struct GroupContents : public LLInitParam::ChoiceBlock -{ - Alternative all; - Alternative choice; - Alternative sequence; - - GroupContents() - : all("all"), - choice("choice"), - sequence("sequence") - {} -}; - -struct Group : public LLInitParam::Block -{ - Optional name, - ref; - - Group() - : name("name"), - ref("ref") - {} -}; - -struct Restriction : public LLInitParam::Block -{ -}; - -struct Extension : public LLInitParam::Block -{ -}; - -struct SimpleContent : public LLInitParam::ChoiceBlock -{ - Alternative restriction; - Alternative extension; - - SimpleContent() - : restriction("restriction"), - extension("extension") - {} -}; - -struct SimpleType : public LLInitParam::Block -{ - // TODO -}; - -struct ComplexContent : public LLInitParam::Block -{ - Optional mixed; - - ComplexContent() - : mixed("mixed", true) - {} -}; - -struct ComplexTypeContents : public LLInitParam::ChoiceBlock -{ - Alternative simple_content; - Alternative complex_content; - Alternative group; - Alternative all; - Alternative choice; - Alternative sequence; - - ComplexTypeContents() - : simple_content("simpleContent"), - complex_content("complexContent"), - group("group"), - all("all"), - choice("choice"), - sequence("sequence") - {} -}; - -struct ComplexType : public LLInitParam::Block -{ - Optional name; - Optional mixed; - - Multiple attribute; - Multiple< Lazy > elements; - - ComplexType() - : name("name"), - attribute("xs:attribute"), - elements("xs:element"), - mixed("mixed") - { - } -}; - -struct ElementContents : public LLInitParam::ChoiceBlock -{ - Alternative simpleType; - Alternative complexType; - - ElementContents() - : simpleType("simpleType"), - complexType("complexType") - {} -}; - -struct Element : public LLInitParam::Block -{ - Optional name, - ref, - type; - - Element() - : name("xs:name"), - ref("xs:ref"), - type("xs:type") - {} -}; - -struct Schema : public LLInitParam::Block -{ -private: - Mandatory targetNamespace, - xmlns, - xs; - -public: - Optional attributeFormDefault, - elementFormDefault; - - Mandatory root_element; - - void setNameSpace(const std::string& ns) {targetNamespace = ns; xmlns = ns;} - - Schema(const std::string& ns = LLStringUtil::null) - : attributeFormDefault("attributeFormDefault"), - elementFormDefault("elementFormDefault"), - xs("xmlns:xs"), - targetNamespace("targetNamespace"), - xmlns("xmlns"), - root_element("xs:element") - { - attributeFormDefault = "unqualified"; - elementFormDefault = "qualified"; - xs = "http://www.w3.org/2001/XMLSchema"; - if (!ns.empty()) - { - setNameSpace(ns); - }; - } - -}; - -// -// LLXSDWriter -// -LLXSDWriter::LLXSDWriter() -: Parser(sXSDReadFuncs, sXSDWriteFuncs, sXSDInspectFuncs) -{ - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:boolean", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:unsignedByte", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:signedByte", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:unsignedShort", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:signedShort", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:unsignedInt", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:integer", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:float", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:double", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); - registerInspectFunc(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); -} - -void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace) -{ - Schema schema(xml_namespace); - - schema.root_element.name = type_name; - Choice& choice = schema.root_element.complexType.choice; - - choice.minOccurs = 0; - choice.maxOccurs = "unbounded"; - - mSchemaNode = node; - //node->setName("xs:schema"); - //node->createChild("attributeFormDefault", true)->setStringValue("unqualified"); - //node->createChild("elementFormDefault", true)->setStringValue("qualified"); - //node->createChild("targetNamespace", true)->setStringValue(xml_namespace); - //node->createChild("xmlns:xs", true)->setStringValue("http://www.w3.org/2001/XMLSchema"); - //node->createChild("xmlns", true)->setStringValue(xml_namespace); - - //node = node->createChild("xs:complexType", false); - //node->createChild("name", true)->setStringValue(type_name); - //node->createChild("mixed", true)->setStringValue("true"); - - //mAttributeNode = node; - //mElementNode = node->createChild("xs:choice", false); - //mElementNode->createChild("minOccurs", true)->setStringValue("0"); - //mElementNode->createChild("maxOccurs", true)->setStringValue("unbounded"); - block.inspectBlock(*this); - - // duplicate element choices - LLXMLNodeList children; - mElementNode->getChildren("xs:element", children, FALSE); - for (LLXMLNodeList::iterator child_it = children.begin(); child_it != children.end(); ++child_it) - { - LLXMLNodePtr child_copy = child_it->second->deepCopy(); - std::string child_name; - child_copy->getAttributeString("name", child_name); - child_copy->setAttributeString("name", type_name + "." + child_name); - mElementNode->addChild(child_copy); - } - - LLXMLNodePtr element_declaration_node = mSchemaNode->createChild("xs:element", false); - element_declaration_node->createChild("name", true)->setStringValue(type_name); - element_declaration_node->createChild("type", true)->setStringValue(type_name); -} - -void LLXSDWriter::writeAttribute(const std::string& type, const Parser::name_stack_t& stack, S32 min_count, S32 max_count, const std::vector* possible_values) -{ - name_stack_t non_empty_names; - std::string attribute_name; - for (name_stack_t::const_iterator it = stack.begin(); - it != stack.end(); - ++it) - { - const std::string& name = it->first; - if (!name.empty()) - { - non_empty_names.push_back(*it); - } - } - - for (name_stack_t::const_iterator it = non_empty_names.begin(); - it != non_empty_names.end(); - ++it) - { - if (!attribute_name.empty()) - { - attribute_name += "."; - } - attribute_name += it->first; - } - - // only flag non-nested attributes as mandatory, nested attributes have variant syntax - // that can't be properly constrained in XSD - // e.g. vs - bool attribute_mandatory = min_count == 1 && max_count == 1 && non_empty_names.size() == 1; - - // don't bother supporting "Multiple" params as xml attributes - if (max_count <= 1) - { - // add compound attribute to root node - addAttributeToSchema(mAttributeNode, attribute_name, type, attribute_mandatory, possible_values); - } - - // now generated nested elements for compound attributes - if (non_empty_names.size() > 1 && !attribute_mandatory) - { - std::string element_name; - - // traverse all but last element, leaving that as an attribute name - name_stack_t::const_iterator end_it = non_empty_names.end(); - end_it--; - - for (name_stack_t::const_iterator it = non_empty_names.begin(); - it != end_it; - ++it) - { - if (it != non_empty_names.begin()) - { - element_name += "."; - } - element_name += it->first; - } - - std::string short_attribute_name = non_empty_names.back().first; - - LLXMLNodePtr complex_type_node; - - // find existing element node here, starting at tail of child list - if (mElementNode->mChildren.notNull()) - { - for(LLXMLNodePtr element = mElementNode->mChildren->tail; - element.notNull(); - element = element->mPrev) - { - std::string name; - if(element->getAttributeString("name", name) && name == element_name) - { - complex_type_node = element->mChildren->head; - break; - } - } - } - //create complex_type node - // - // - // - // - // - if(complex_type_node.isNull()) - { - complex_type_node = mElementNode->createChild("xs:element", false); - - complex_type_node->createChild("minOccurs", true)->setIntValue(min_count); - complex_type_node->createChild("maxOccurs", true)->setIntValue(max_count); - complex_type_node->createChild("name", true)->setStringValue(element_name); - complex_type_node = complex_type_node->createChild("xs:complexType", false); - } - - addAttributeToSchema(complex_type_node, short_attribute_name, type, false, possible_values); - } -} - -void LLXSDWriter::addAttributeToSchema(LLXMLNodePtr type_declaration_node, const std::string& attribute_name, const std::string& type, bool mandatory, const std::vector* possible_values) -{ - if (!attribute_name.empty()) - { - LLXMLNodePtr new_enum_type_node; - if (possible_values != NULL) - { - // custom attribute type, for example - // - // - // - // - // - // - new_enum_type_node = new LLXMLNode("xs:simpleType", false); - - LLXMLNodePtr restriction_node = new_enum_type_node->createChild("xs:restriction", false); - restriction_node->createChild("base", true)->setStringValue("xs:string"); - - for (std::vector::const_iterator it = possible_values->begin(); - it != possible_values->end(); - ++it) - { - LLXMLNodePtr enum_node = restriction_node->createChild("xs:enumeration", false); - enum_node->createChild("value", true)->setStringValue(*it); - } - } - - string_set_t& attributes_written = mAttributesWritten[type_declaration_node]; - - string_set_t::iterator found_it = attributes_written.lower_bound(attribute_name); - - // attribute not yet declared - if (found_it == attributes_written.end() || attributes_written.key_comp()(attribute_name, *found_it)) - { - attributes_written.insert(found_it, attribute_name); - - LLXMLNodePtr attribute_node = type_declaration_node->createChild("xs:attribute", false); - - // attribute name - attribute_node->createChild("name", true)->setStringValue(attribute_name); - - if (new_enum_type_node.notNull()) - { - attribute_node->addChild(new_enum_type_node); - } - else - { - // simple attribute type - attribute_node->createChild("type", true)->setStringValue(type); - } - - // required or optional - attribute_node->createChild("use", true)->setStringValue(mandatory ? "required" : "optional"); - } - // attribute exists...handle collision of same name attributes with potentially different types - else - { - LLXMLNodePtr attribute_declaration; - if (type_declaration_node.notNull()) - { - for(LLXMLNodePtr node = type_declaration_node->mChildren->tail; - node.notNull(); - node = node->mPrev) - { - std::string name; - if (node->getAttributeString("name", name) && name == attribute_name) - { - attribute_declaration = node; - break; - } - } - } - - bool new_type_is_enum = new_enum_type_node.notNull(); - bool existing_type_is_enum = !attribute_declaration->hasAttribute("type"); - - // either type is enum, revert to string in collision - // don't bother to check for enum equivalence - if (new_type_is_enum || existing_type_is_enum) - { - if (attribute_declaration->hasAttribute("type")) - { - attribute_declaration->setAttributeString("type", "xs:string"); - } - else - { - attribute_declaration->createChild("type", true)->setStringValue("xs:string"); - } - attribute_declaration->deleteChildren("xs:simpleType"); - } - else - { - // check for collision of different standard types - std::string existing_type; - attribute_declaration->getAttributeString("type", existing_type); - // if current type is not the same as the new type, revert to strnig - if (existing_type != type) - { - // ...than use most general type, string - attribute_declaration->setAttributeString("type", "string"); - } - } - } - } -} - -// -// LLXUIXSDWriter -// -void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& path, const LLInitParam::BaseBlock& block) -{ - std::string file_name(path); - file_name += type_name + ".xsd"; - LLXMLNodePtr root_nodep = new LLXMLNode(); - - LLXSDWriter::writeXSD(type_name, root_nodep, block, "http://www.lindenlab.com/xui"); - - // add includes for all possible children - const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name); - const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type); - - // add choices for valid children - if (widget_registryp) - { - // add include declarations for all valid children - for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems(); - it != widget_registryp->currentRegistrar().endItems(); - ++it) - { - std::string widget_name = it->first; - if (widget_name == type_name) - { - continue; - } - LLXMLNodePtr nodep = new LLXMLNode("xs:include", false); - nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd"); - - // add to front of schema - mSchemaNode->addChild(nodep, mSchemaNode); - } - - for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems(); - it != widget_registryp->currentRegistrar().endItems(); - ++it) - { - std::string widget_name = it->first; - // - LLXMLNodePtr widget_node = mElementNode->createChild("xs:element", false); - widget_node->createChild("name", true)->setStringValue(widget_name); - widget_node->createChild("type", true)->setStringValue(widget_name); - } - } - - LLFILE* xsd_file = LLFile::fopen(file_name.c_str(), "w"); - LLXMLNode::writeHeaderToFile(xsd_file); - root_nodep->writeToFile(xsd_file); - fclose(xsd_file); -} - -static LLInitParam::Parser::parser_read_func_map_t sXUIReadFuncs; -static LLInitParam::Parser::parser_write_func_map_t sXUIWriteFuncs; -static LLInitParam::Parser::parser_inspect_func_map_t sXUIInspectFuncs; - -// -// LLXUIParser -// -LLXUIParser::LLXUIParser() -: Parser(sXUIReadFuncs, sXUIWriteFuncs, sXUIInspectFuncs), - mCurReadDepth(0) -{ - if (sXUIReadFuncs.empty()) - { - registerParserFuncs(readFlag, writeFlag); - registerParserFuncs(readBoolValue, writeBoolValue); - registerParserFuncs(readStringValue, writeStringValue); - registerParserFuncs(readU8Value, writeU8Value); - registerParserFuncs(readS8Value, writeS8Value); - registerParserFuncs(readU16Value, writeU16Value); - registerParserFuncs(readS16Value, writeS16Value); - registerParserFuncs(readU32Value, writeU32Value); - registerParserFuncs(readS32Value, writeS32Value); - registerParserFuncs(readF32Value, writeF32Value); - registerParserFuncs(readF64Value, writeF64Value); - registerParserFuncs(readColor4Value, writeColor4Value); - registerParserFuncs(readUIColorValue, writeUIColorValue); - registerParserFuncs(readUUIDValue, writeUUIDValue); - registerParserFuncs(readSDValue, writeSDValue); - } -} - -static LLFastTimer::DeclareTimer FTM_PARSE_XUI("XUI Parsing"); -const LLXMLNodePtr DUMMY_NODE = new LLXMLNode(); - -void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename, bool silent) -{ - LLFastTimer timer(FTM_PARSE_XUI); - mNameStack.clear(); - mRootNodeName = node->getName()->mString; - mCurFileName = filename; - mCurReadDepth = 0; - setParseSilently(silent); - - if (node.isNull()) - { - parserWarning("Invalid node"); - } - else - { - readXUIImpl(node, block); - } -} - -bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) -{ - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("."); - - bool values_parsed = false; - bool silent = mCurReadDepth > 0; - - if (nodep->getFirstChild().isNull() - && nodep->mAttributes.empty() - && nodep->getSanitizedValue().empty()) - { - // empty node, just parse as flag - mCurReadNode = DUMMY_NODE; - return block.submitValue(mNameStack, *this, silent); - } - - // submit attributes for current node - values_parsed |= readAttributes(nodep, block); - - // treat text contents of xml node as "value" parameter - std::string text_contents = nodep->getSanitizedValue(); - if (!text_contents.empty()) - { - mCurReadNode = nodep; - mNameStack.push_back(std::make_pair(std::string("value"), true)); - // child nodes are not necessarily valid parameters (could be a child widget) - // so don't complain once we've recursed - if (!block.submitValue(mNameStack, *this, true)) - { - mNameStack.pop_back(); - block.submitValue(mNameStack, *this, silent); - } - else - { - mNameStack.pop_back(); - } - } - - // then traverse children - // child node must start with last name of parent node (our "scope") - // for example: "" - // which equates to the following nesting: - // button - // param - // nested_param1 - // nested_param2 - // nested_param3 - mCurReadDepth++; - for(LLXMLNodePtr childp = nodep->getFirstChild(); childp.notNull();) - { - std::string child_name(childp->getName()->mString); - S32 num_tokens_pushed = 0; - - // for non "dotted" child nodes check to see if child node maps to another widget type - // and if not, treat as a child element of the current node - // e.g. will interpret as "button.rect" - // since there is no widget named "rect" - if (child_name.find(".") == std::string::npos) - { - mNameStack.push_back(std::make_pair(child_name, true)); - num_tokens_pushed++; - } - else - { - // parse out "dotted" name into individual tokens - tokenizer name_tokens(child_name, sep); - - tokenizer::iterator name_token_it = name_tokens.begin(); - if(name_token_it == name_tokens.end()) - { - childp = childp->getNextSibling(); - continue; - } - - // check for proper nesting - if (mNameStack.empty()) - { - if (*name_token_it != mRootNodeName) - { - childp = childp->getNextSibling(); - continue; - } - } - else if(mNameStack.back().first != *name_token_it) - { - childp = childp->getNextSibling(); - continue; - } - - // now ignore first token - ++name_token_it; - - // copy remaining tokens on to our running token list - for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) - { - mNameStack.push_back(std::make_pair(*token_to_push, true)); - num_tokens_pushed++; - } - } - - // recurse and visit children XML nodes - if(readXUIImpl(childp, block)) - { - // child node successfully parsed, remove from DOM - - values_parsed = true; - LLXMLNodePtr node_to_remove = childp; - childp = childp->getNextSibling(); - - nodep->deleteChild(node_to_remove); - } - else - { - childp = childp->getNextSibling(); - } - - while(num_tokens_pushed-- > 0) - { - mNameStack.pop_back(); - } - } - mCurReadDepth--; - return values_parsed; -} - -bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) -{ - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("."); - - bool any_parsed = false; - bool silent = mCurReadDepth > 0; - - for(LLXMLAttribList::const_iterator attribute_it = nodep->mAttributes.begin(); - attribute_it != nodep->mAttributes.end(); - ++attribute_it) - { - S32 num_tokens_pushed = 0; - std::string attribute_name(attribute_it->first->mString); - mCurReadNode = attribute_it->second; - - tokenizer name_tokens(attribute_name, sep); - // copy remaining tokens on to our running token list - for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) - { - mNameStack.push_back(std::make_pair(*token_to_push, true)); - num_tokens_pushed++; - } - - // child nodes are not necessarily valid attributes, so don't complain once we've recursed - any_parsed |= block.submitValue(mNameStack, *this, silent); - - while(num_tokens_pushed-- > 0) - { - mNameStack.pop_back(); - } - } - - return any_parsed; -} - -void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block) -{ - mWriteRootNode = node; - name_stack_t name_stack = Parser::name_stack_t(); - block.serializeBlock(*this, name_stack, diff_block); - mOutNodes.clear(); -} - -// go from a stack of names to a specific XML node -LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) -{ - LLXMLNodePtr out_node = mWriteRootNode; - - name_stack_t::iterator next_it = stack.begin(); - for (name_stack_t::iterator it = stack.begin(); - it != stack.end(); - it = next_it) - { - ++next_it; - if (it->first.empty()) - { - it->second = false; - continue; - } - - out_nodes_t::iterator found_it = mOutNodes.find(it->first); - - // node with this name not yet written - if (found_it == mOutNodes.end() || it->second) - { - // make an attribute if we are the last element on the name stack - bool is_attribute = next_it == stack.end(); - LLXMLNodePtr new_node = new LLXMLNode(it->first.c_str(), is_attribute); - out_node->addChild(new_node); - mOutNodes[it->first] = new_node; - out_node = new_node; - it->second = false; - } - else - { - out_node = found_it->second; - } - } - - return (out_node == mWriteRootNode ? LLXMLNodePtr(NULL) : out_node); -} - -bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode == DUMMY_NODE; -} - -bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - // just create node - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - return node.notNull(); -} - -bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) -{ - S32 value; - LLXUIParser& self = static_cast(parser); - bool success = self.mCurReadNode->getBoolValue(1, &value); - *((bool*)val_ptr) = (value != FALSE); - return success; -} - -bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setBoolValue(*((bool*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readStringValue(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - *((std::string*)val_ptr) = self.mCurReadNode->getSanitizedValue(); - return true; -} - -bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - const std::string* string_val = reinterpret_cast(val_ptr); - if (string_val->find('\n') != std::string::npos - || string_val->size() > MAX_STRING_ATTRIBUTE_SIZE) - { - // don't write strings with newlines into attributes - std::string attribute_name = node->getName()->mString; - LLXMLNodePtr parent_node = node->mParent; - parent_node->deleteChild(node); - // write results in text contents of node - if (attribute_name == "value") - { - // "value" is implicit, just write to parent - node = parent_node; - } - else - { - // create a child that is not an attribute, but with same name - node = parent_node->createChild(attribute_name.c_str(), false); - } - } - node->setStringValue(*string_val); - return true; - } - return false; -} - -bool LLXUIParser::readU8Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode->getByteValue(1, (U8*)val_ptr); -} - -bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setUnsignedValue(*((U8*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readS8Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - S32 value; - if(self.mCurReadNode->getIntValue(1, &value)) - { - *((S8*)val_ptr) = value; - return true; - } - return false; -} - -bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setIntValue(*((S8*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readU16Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - U32 value; - if(self.mCurReadNode->getUnsignedValue(1, &value)) - { - *((U16*)val_ptr) = value; - return true; - } - return false; -} - -bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setUnsignedValue(*((U16*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readS16Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - S32 value; - if(self.mCurReadNode->getIntValue(1, &value)) - { - *((S16*)val_ptr) = value; - return true; - } - return false; -} - -bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setIntValue(*((S16*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readU32Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode->getUnsignedValue(1, (U32*)val_ptr); -} - -bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setUnsignedValue(*((U32*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readS32Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode->getIntValue(1, (S32*)val_ptr); -} - -bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setIntValue(*((S32*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readF32Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode->getFloatValue(1, (F32*)val_ptr); -} - -bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setFloatValue(*((F32*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readF64Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - return self.mCurReadNode->getDoubleValue(1, (F64*)val_ptr); -} - -bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setDoubleValue(*((F64*)val_ptr)); - return true; - } - return false; -} - -bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - LLColor4* colorp = (LLColor4*)val_ptr; - if(self.mCurReadNode->getFloatValue(4, colorp->mV) >= 3) - { - return true; - } - - return false; -} - -bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - LLColor4 color = *((LLColor4*)val_ptr); - node->setFloatValue(4, color.mV); - return true; - } - return false; -} - -bool LLXUIParser::readUIColorValue(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - LLUIColor* param = (LLUIColor*)val_ptr; - LLColor4 color; - bool success = self.mCurReadNode->getFloatValue(4, color.mV) >= 3; - if (success) - { - param->set(color); - return true; - } - return false; -} - -bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - LLUIColor color = *((LLUIColor*)val_ptr); - //RN: don't write out the color that is represented by a function - // rely on param block exporting to get the reference to the color settings - if (color.isReference()) return false; - node->setFloatValue(4, color.get().mV); - return true; - } - return false; -} - -bool LLXUIParser::readUUIDValue(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - LLUUID temp_id; - // LLUUID::set is destructive, so use temporary value - if (temp_id.set(self.mCurReadNode->getSanitizedValue())) - { - *(LLUUID*)(val_ptr) = temp_id; - return true; - } - return false; -} - -bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - node->setStringValue(((LLUUID*)val_ptr)->asString()); - return true; - } - return false; -} - -bool LLXUIParser::readSDValue(Parser& parser, void* val_ptr) -{ - LLXUIParser& self = static_cast(parser); - *((LLSD*)val_ptr) = LLSD(self.mCurReadNode->getSanitizedValue()); - return true; -} - -bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) -{ - LLXUIParser& self = static_cast(parser); - - LLXMLNodePtr node = self.getNode(stack); - if (node.notNull()) - { - std::string string_val = ((LLSD*)val_ptr)->asString(); - if (string_val.find('\n') != std::string::npos || string_val.size() > MAX_STRING_ATTRIBUTE_SIZE) - { - // don't write strings with newlines into attributes - std::string attribute_name = node->getName()->mString; - LLXMLNodePtr parent_node = node->mParent; - parent_node->deleteChild(node); - // write results in text contents of node - if (attribute_name == "value") - { - // "value" is implicit, just write to parent - node = parent_node; - } - else - { - node = parent_node->createChild(attribute_name.c_str(), false); - } - } - - node->setStringValue(string_val); - return true; - } - return false; -} - -/*virtual*/ std::string LLXUIParser::getCurrentElementName() -{ - std::string full_name; - for (name_stack_t::iterator it = mNameStack.begin(); - it != mNameStack.end(); - ++it) - { - full_name += it->first + "."; // build up dotted names: "button.param.nestedparam." - } - - return full_name; -} - -void LLXUIParser::parserWarning(const std::string& message) -{ -#ifdef LL_WINDOWS - // use Visual Studo friendly formatting of output message for easy access to originating xml - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); - utf16str += '\n'; - OutputDebugString(utf16str.c_str()); -#else - Parser::parserWarning(message); -#endif -} - -void LLXUIParser::parserError(const std::string& message) -{ -#ifdef LL_WINDOWS - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); - utf16str += '\n'; - OutputDebugString(utf16str.c_str()); -#else - Parser::parserError(message); -#endif -} - - -// -// LLSimpleXUIParser -// - -struct ScopedFile -{ - ScopedFile( const std::string& filename, const char* accessmode ) - { - mFile = LLFile::fopen(filename, accessmode); - } - - ~ScopedFile() - { - fclose(mFile); - mFile = NULL; - } - - S32 getRemainingBytes() - { - if (!isOpen()) return 0; - - S32 cur_pos = ftell(mFile); - fseek(mFile, 0L, SEEK_END); - S32 file_size = ftell(mFile); - fseek(mFile, cur_pos, SEEK_SET); - return file_size - cur_pos; - } - - bool isOpen() { return mFile != NULL; } - - LLFILE* mFile; -}; -LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t element_cb) -: Parser(sSimpleXUIReadFuncs, sSimpleXUIWriteFuncs, sSimpleXUIInspectFuncs), - mCurReadDepth(0), - mElementCB(element_cb) -{ - if (sSimpleXUIReadFuncs.empty()) - { - registerParserFuncs(readFlag); - registerParserFuncs(readBoolValue); - registerParserFuncs(readStringValue); - registerParserFuncs(readU8Value); - registerParserFuncs(readS8Value); - registerParserFuncs(readU16Value); - registerParserFuncs(readS16Value); - registerParserFuncs(readU32Value); - registerParserFuncs(readS32Value); - registerParserFuncs(readF32Value); - registerParserFuncs(readF64Value); - registerParserFuncs(readColor4Value); - registerParserFuncs(readUIColorValue); - registerParserFuncs(readUUIDValue); - registerParserFuncs(readSDValue); - } -} - -LLSimpleXUIParser::~LLSimpleXUIParser() -{ -} - - -bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) -{ - LLFastTimer timer(FTM_PARSE_XUI); - - mParser = XML_ParserCreate(NULL); - XML_SetUserData(mParser, this); - XML_SetElementHandler( mParser, startElementHandler, endElementHandler); - XML_SetCharacterDataHandler( mParser, characterDataHandler); - - mOutputStack.push_back(std::make_pair(&block, 0)); - mNameStack.clear(); - mCurFileName = filename; - mCurReadDepth = 0; - setParseSilently(silent); - - ScopedFile file(filename, "rb"); - if( !file.isOpen() ) - { - LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - - S32 bytes_read = 0; - - S32 buffer_size = file.getRemainingBytes(); - void* buffer = XML_GetBuffer(mParser, buffer_size); - if( !buffer ) - { - LL_WARNS("ReadXUI") << "Unable to allocate XML buffer while reading file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - - bytes_read = (S32)fread(buffer, 1, buffer_size, file.mFile); - if( bytes_read <= 0 ) - { - LL_WARNS("ReadXUI") << "Error while reading file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - - mEmptyLeafNode.push_back(false); - - if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) - { - LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - - mEmptyLeafNode.pop_back(); - - XML_ParserFree( mParser ); - return true; -} - -void LLSimpleXUIParser::startElementHandler(void *userData, const char *name, const char **atts) -{ - LLSimpleXUIParser* self = reinterpret_cast(userData); - self->startElement(name, atts); -} - -void LLSimpleXUIParser::endElementHandler(void *userData, const char *name) -{ - LLSimpleXUIParser* self = reinterpret_cast(userData); - self->endElement(name); -} - -void LLSimpleXUIParser::characterDataHandler(void *userData, const char *s, int len) -{ - LLSimpleXUIParser* self = reinterpret_cast(userData); - self->characterData(s, len); -} - -void LLSimpleXUIParser::characterData(const char *s, int len) -{ - mTextContents += std::string(s, len); -} - -void LLSimpleXUIParser::startElement(const char *name, const char **atts) -{ - processText(); - - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("."); - - if (mElementCB) - { - LLInitParam::BaseBlock* blockp = mElementCB(*this, name); - if (blockp) - { - mOutputStack.push_back(std::make_pair(blockp, 0)); - } - } - - mOutputStack.back().second++; - S32 num_tokens_pushed = 0; - std::string child_name(name); - - if (mOutputStack.back().second == 1) - { // root node for this block - mScope.push_back(child_name); - } - else - { // compound attribute - if (child_name.find(".") == std::string::npos) - { - mNameStack.push_back(std::make_pair(child_name, true)); - num_tokens_pushed++; - mScope.push_back(child_name); - } - else - { - // parse out "dotted" name into individual tokens - tokenizer name_tokens(child_name, sep); - - tokenizer::iterator name_token_it = name_tokens.begin(); - if(name_token_it == name_tokens.end()) - { - return; - } - - // check for proper nesting - if(!mScope.empty() && *name_token_it != mScope.back()) - { - return; - } - - // now ignore first token - ++name_token_it; - - // copy remaining tokens on to our running token list - for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) - { - mNameStack.push_back(std::make_pair(*token_to_push, true)); - num_tokens_pushed++; - } - mScope.push_back(mNameStack.back().first); - } - } - - // parent node is not empty - mEmptyLeafNode.back() = false; - // we are empty if we have no attributes - mEmptyLeafNode.push_back(atts[0] == NULL); - - mTokenSizeStack.push_back(num_tokens_pushed); - readAttributes(atts); - -} - -void LLSimpleXUIParser::endElement(const char *name) -{ - bool has_text = processText(); - - // no text, attributes, or children - if (!has_text && mEmptyLeafNode.back()) - { - // submit this as a valueless name (even though there might be text contents we haven't seen yet) - mCurAttributeValueBegin = NO_VALUE_MARKER; - mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); - } - - if (--mOutputStack.back().second == 0) - { - if (mOutputStack.empty()) - { - LL_ERRS("ReadXUI") << "Parameter block output stack popped while empty." << LL_ENDL; - } - mOutputStack.pop_back(); - } - - S32 num_tokens_to_pop = mTokenSizeStack.back(); - mTokenSizeStack.pop_back(); - while(num_tokens_to_pop-- > 0) - { - mNameStack.pop_back(); - } - mScope.pop_back(); - mEmptyLeafNode.pop_back(); -} - -bool LLSimpleXUIParser::readAttributes(const char **atts) -{ - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("."); - - bool any_parsed = false; - for(S32 i = 0; atts[i] && atts[i+1]; i += 2 ) - { - std::string attribute_name(atts[i]); - mCurAttributeValueBegin = atts[i+1]; - - S32 num_tokens_pushed = 0; - tokenizer name_tokens(attribute_name, sep); - // copy remaining tokens on to our running token list - for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) - { - mNameStack.push_back(std::make_pair(*token_to_push, true)); - num_tokens_pushed++; - } - - // child nodes are not necessarily valid attributes, so don't complain once we've recursed - any_parsed |= mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); - - while(num_tokens_pushed-- > 0) - { - mNameStack.pop_back(); - } - } - return any_parsed; -} - -bool LLSimpleXUIParser::processText() -{ - if (!mTextContents.empty()) - { - LLStringUtil::trim(mTextContents); - if (!mTextContents.empty()) - { - mNameStack.push_back(std::make_pair(std::string("value"), true)); - mCurAttributeValueBegin = mTextContents.c_str(); - mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); - mNameStack.pop_back(); - } - mTextContents.clear(); - return true; - } - return false; -} - -/*virtual*/ std::string LLSimpleXUIParser::getCurrentElementName() -{ - std::string full_name; - for (name_stack_t::iterator it = mNameStack.begin(); - it != mNameStack.end(); - ++it) - { - full_name += it->first + "."; // build up dotted names: "button.param.nestedparam." - } - - return full_name; -} - -void LLSimpleXUIParser::parserWarning(const std::string& message) -{ -#ifdef LL_WINDOWS - // use Visual Studo friendly formatting of output message for easy access to originating xml - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); - utf16str += '\n'; - OutputDebugString(utf16str.c_str()); -#else - Parser::parserWarning(message); -#endif -} - -void LLSimpleXUIParser::parserError(const std::string& message) -{ -#ifdef LL_WINDOWS - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str()); - utf16str += '\n'; - OutputDebugString(utf16str.c_str()); -#else - Parser::parserError(message); -#endif -} - -bool LLSimpleXUIParser::readFlag(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return self.mCurAttributeValueBegin == NO_VALUE_MARKER; -} - -bool LLSimpleXUIParser::readBoolValue(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - if (!strcmp(self.mCurAttributeValueBegin, "true")) - { - *((bool*)val_ptr) = true; - return true; - } - else if (!strcmp(self.mCurAttributeValueBegin, "false")) - { - *((bool*)val_ptr) = false; - return true; - } - - return false; -} - -bool LLSimpleXUIParser::readStringValue(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - *((std::string*)val_ptr) = self.mCurAttributeValueBegin; - return true; -} - -bool LLSimpleXUIParser::readU8Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U8*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readS8Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S8*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readU16Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U16*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readS16Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S16*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readU32Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, uint_p[assign_a(*(U32*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readS32Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, int_p[assign_a(*(S32*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readF32Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F32*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readF64Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - return parse(self.mCurAttributeValueBegin, real_p[assign_a(*(F64*)val_ptr)]).full; -} - -bool LLSimpleXUIParser::readColor4Value(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - LLColor4 value; - - if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) - { - *(LLColor4*)(val_ptr) = value; - return true; - } - return false; -} - -bool LLSimpleXUIParser::readUIColorValue(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - LLColor4 value; - LLUIColor* colorp = (LLUIColor*)val_ptr; - - if (parse(self.mCurAttributeValueBegin, real_p[assign_a(value.mV[0])] >> real_p[assign_a(value.mV[1])] >> real_p[assign_a(value.mV[2])] >> real_p[assign_a(value.mV[3])], space_p).full) - { - colorp->set(value); - return true; - } - return false; -} - -bool LLSimpleXUIParser::readUUIDValue(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - LLUUID temp_id; - // LLUUID::set is destructive, so use temporary value - if (temp_id.set(std::string(self.mCurAttributeValueBegin))) - { - *(LLUUID*)(val_ptr) = temp_id; - return true; - } - return false; -} - -bool LLSimpleXUIParser::readSDValue(Parser& parser, void* val_ptr) -{ - LLSimpleXUIParser& self = static_cast(parser); - *((LLSD*)val_ptr) = LLSD(self.mCurAttributeValueBegin); - return true; -} diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h deleted file mode 100644 index d7cd256967..0000000000 --- a/indra/llxuixml/llxuiparser.h +++ /dev/null @@ -1,242 +0,0 @@ -/** - * @file llxuiparser.h - * @brief Utility functions for handling XUI structures in XML - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LLXUIPARSER_H -#define LLXUIPARSER_H - -#include "llinitparam.h" -#include "llregistry.h" -#include "llpointer.h" - -#include -#include -#include -#include - - - -class LLView; - - -typedef LLPointer LLXMLNodePtr; - - -// lookup widget type by name -class LLWidgetTypeRegistry -: public LLRegistrySingleton -{}; - - -// global static instance for registering all widget types -typedef boost::function LLWidgetCreatorFunc; - -typedef LLRegistry widget_registry_t; - -class LLChildRegistryRegistry -: public LLRegistrySingleton -{}; - - - -class LLXSDWriter : public LLInitParam::Parser -{ - LOG_CLASS(LLXSDWriter); -public: - void writeXSD(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace); - - /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; } - - LLXSDWriter(); - -protected: - void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector* possible_values); - void addAttributeToSchema(LLXMLNodePtr nodep, const std::string& attribute_name, const std::string& type, bool mandatory, const std::vector* possible_values); - LLXMLNodePtr mAttributeNode; - LLXMLNodePtr mElementNode; - LLXMLNodePtr mSchemaNode; - - typedef std::set string_set_t; - typedef std::map attributes_map_t; - attributes_map_t mAttributesWritten; -}; - - - -// NOTE: DOES NOT WORK YET -// should support child widgets for XUI -class LLXUIXSDWriter : public LLXSDWriter -{ -public: - void writeXSD(const std::string& name, const std::string& path, const LLInitParam::BaseBlock& block); -}; - - -class LLXUIParserImpl; - -class LLXUIParser : public LLInitParam::Parser -{ -LOG_CLASS(LLXUIParser); - -public: - LLXUIParser(); - typedef LLInitParam::Parser::name_stack_t name_stack_t; - - /*virtual*/ std::string getCurrentElementName(); - /*virtual*/ void parserWarning(const std::string& message); - /*virtual*/ void parserError(const std::string& message); - - void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false); - void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); - -private: - bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block); - bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); - - //reader helper functions - static bool readFlag(Parser& parser, void* val_ptr); - static bool readBoolValue(Parser& parser, void* val_ptr); - static bool readStringValue(Parser& parser, void* val_ptr); - static bool readU8Value(Parser& parser, void* val_ptr); - static bool readS8Value(Parser& parser, void* val_ptr); - static bool readU16Value(Parser& parser, void* val_ptr); - static bool readS16Value(Parser& parser, void* val_ptr); - static bool readU32Value(Parser& parser, void* val_ptr); - static bool readS32Value(Parser& parser, void* val_ptr); - static bool readF32Value(Parser& parser, void* val_ptr); - static bool readF64Value(Parser& parser, void* val_ptr); - static bool readColor4Value(Parser& parser, void* val_ptr); - static bool readUIColorValue(Parser& parser, void* val_ptr); - static bool readUUIDValue(Parser& parser, void* val_ptr); - static bool readSDValue(Parser& parser, void* val_ptr); - - //writer helper functions - static bool writeFlag(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeStringValue(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeU8Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeS8Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeU16Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeS16Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeU32Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeS32Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeF32Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeF64Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t&); - static bool writeSDValue(Parser& parser, const void* val_ptr, name_stack_t&); - - LLXMLNodePtr getNode(name_stack_t& stack); - -private: - Parser::name_stack_t mNameStack; - LLXMLNodePtr mCurReadNode; - // Root of the widget XML sub-tree, for example, "line_editor" - LLXMLNodePtr mWriteRootNode; - - typedef std::map out_nodes_t; - out_nodes_t mOutNodes; - LLXMLNodePtr mLastWrittenChild; - S32 mCurReadDepth; - std::string mCurFileName; - std::string mRootNodeName; -}; - -// LLSimpleXUIParser is a streamlined SAX-based XUI parser that does not support localization -// or parsing of a tree of independent param blocks, such as child widgets. -// Use this for reading non-localized files that only need a single param block as a result. -// -// NOTE: In order to support nested block parsing, we need callbacks for start element that -// push new blocks contexts on the mScope stack. -// NOTE: To support localization without building a DOM, we need to enforce consistent -// ordering of child elements from base file to localized diff file. Then we can use a pair -// of coroutines to perform matching of xml nodes during parsing. Not sure if the overhead -// of coroutines would offset the gain from SAX parsing -class LLSimpleXUIParserImpl; - -class LLSimpleXUIParser : public LLInitParam::Parser -{ -LOG_CLASS(LLSimpleXUIParser); -public: - typedef LLInitParam::Parser::name_stack_t name_stack_t; - typedef LLInitParam::BaseBlock* (*element_start_callback_t)(LLSimpleXUIParser&, const char* block_name); - - LLSimpleXUIParser(element_start_callback_t element_cb = NULL); - virtual ~LLSimpleXUIParser(); - - /*virtual*/ std::string getCurrentElementName(); - /*virtual*/ void parserWarning(const std::string& message); - /*virtual*/ void parserError(const std::string& message); - - bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false); - - -private: - //reader helper functions - static bool readFlag(Parser&, void* val_ptr); - static bool readBoolValue(Parser&, void* val_ptr); - static bool readStringValue(Parser&, void* val_ptr); - static bool readU8Value(Parser&, void* val_ptr); - static bool readS8Value(Parser&, void* val_ptr); - static bool readU16Value(Parser&, void* val_ptr); - static bool readS16Value(Parser&, void* val_ptr); - static bool readU32Value(Parser&, void* val_ptr); - static bool readS32Value(Parser&, void* val_ptr); - static bool readF32Value(Parser&, void* val_ptr); - static bool readF64Value(Parser&, void* val_ptr); - static bool readColor4Value(Parser&, void* val_ptr); - static bool readUIColorValue(Parser&, void* val_ptr); - static bool readUUIDValue(Parser&, void* val_ptr); - static bool readSDValue(Parser&, void* val_ptr); - -private: - static void startElementHandler(void *userData, const char *name, const char **atts); - static void endElementHandler(void *userData, const char *name); - static void characterDataHandler(void *userData, const char *s, int len); - - void startElement(const char *name, const char **atts); - void endElement(const char *name); - void characterData(const char *s, int len); - bool readAttributes(const char **atts); - bool processText(); - - Parser::name_stack_t mNameStack; - struct XML_ParserStruct* mParser; - LLXMLNodePtr mLastWrittenChild; - S32 mCurReadDepth; - std::string mCurFileName; - std::string mTextContents; - const char* mCurAttributeValueBegin; - std::vector mTokenSizeStack; - std::vector mScope; - std::vector mEmptyLeafNode; - element_start_callback_t mElementCB; - - std::vector > mOutputStack; -}; - - -#endif //LLXUIPARSER_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 6b2fe1e45a..baf7627f06 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -30,7 +30,6 @@ include(LLUI) include(LLVFS) include(LLWindow) include(LLXML) -include(LLXUIXML) include(LScript) include(Linking) include(NDOF) @@ -65,7 +64,6 @@ include_directories( ${LLVFS_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS}/lscript_compile ${LLLOGIN_INCLUDE_DIRS} @@ -1740,7 +1738,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLXML_LIBRARIES} - ${LLXUIXML_LIBRARIES} ${LSCRIPT_LIBRARIES} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index f738b84bb9..6c8a827ba3 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -57,6 +57,8 @@ #include "lldeleteutils.h" #include "imageids.h" #include "indra_constants.h" +#include "llinitparam.h" + //#include "linden_common.h" //#include "llpreprocessor.h" #include "llallocator.h" @@ -124,7 +126,5 @@ // Library includes from llmessage project #include "llcachename.h" -// Library includes from llxuixml -#include "llinitparam.h" #endif -- cgit v1.2.3 From 18e7f1bffd875bb933212367f0d62dfc4da871b9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 20 Jan 2012 16:42:57 -0600 Subject: SH-2889 Add visual auto-muting controls --- indra/llmath/llvolume.cpp | 3 + indra/llmath/llvolume.h | 2 + indra/newview/app_settings/settings.xml | 22 +++++++ indra/newview/lldrawable.cpp | 10 ++++ indra/newview/llspatialpartition.cpp | 15 ++++- indra/newview/llspatialpartition.h | 18 ++++-- indra/newview/llviewermenu.cpp | 4 ++ indra/newview/llvoavatar.cpp | 20 ++++++- indra/newview/llvoavatar.h | 5 ++ indra/newview/llvovolume.cpp | 70 +++++++++++++++++++--- indra/newview/pipeline.cpp | 2 +- indra/newview/pipeline.h | 57 +++++++++--------- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++ 13 files changed, 193 insertions(+), 45 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 0c6cf1dfae..761fc171c4 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2078,6 +2078,7 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge mFaceMask = 0x0; mDetail = detail; mSculptLevel = -2; + mSurfaceArea = 1.f; //only calculated for sculpts, defaults to 1 for all other prims mIsMeshAssetLoaded = FALSE; mLODScaleBias.setVec(1,1,1); mHullPoints = NULL; @@ -3144,6 +3145,8 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, { F32 area = sculptGetSurfaceArea(); + mSurfaceArea = area; + const F32 SCULPT_MAX_AREA = 384.f; if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA) diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index afd1ec5eed..76cf9de613 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -963,6 +963,7 @@ public: S32 getNumFaces() const; S32 getNumVolumeFaces() const { return mVolumeFaces.size(); } F32 getDetail() const { return mDetail; } + F32 getSurfaceArea() const { return mSurfaceArea; } const LLVolumeParams& getParams() const { return mParams; } LLVolumeParams getCopyOfParams() const { return mParams; } const LLProfile& getProfile() const { return *mProfilep; } @@ -1065,6 +1066,7 @@ public: BOOL mUnique; F32 mDetail; S32 mSculptLevel; + F32 mSurfaceArea; //unscaled surface area BOOL mIsMeshAssetLoaded; LLVolumeParams mParams; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ea623791d..3acc8a2446 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9024,6 +9024,28 @@ Value 1 + RenderAutoMuteByteLimit + + Comment + Maximum bytes of attachments before an avatar is automatically visually muted (0 for no limit). + Persist + 1 + Type + U32 + Value + 0 + + RenderAutoMuteSurfaceAreaLimit + + Comment + Maximum surface area of attachments before an avatar is automatically visually muted (0 for no limit). + Persist + 1 + Type + F32 + Value + 0 + RenderUseShaderLOD Comment diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index debac9dcbf..21b21c152a 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1077,6 +1077,7 @@ BOOL LLDrawable::isVisible() const LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) : LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB) { + mBridge = this; mDrawable = root; root->setSpatialBridge(this); @@ -1105,6 +1106,15 @@ LLSpatialBridge::~LLSpatialBridge() { group->mSpatialPartition->remove(this, group); } + + //delete octree here so listeners will still be able to access bridge specific state + destroyTree(); +} + +void LLSpatialBridge::destroyTree() +{ + delete mOctree; + mOctree = NULL; } void LLSpatialBridge::updateSpatialExtents() diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 4aa5f32d8a..5d196a465f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1187,6 +1187,8 @@ void LLSpatialGroup::clearOcclusionState(U32 state, S32 mode) LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : mState(0), + mGeometryBytes(0), + mSurfaceArea(0.f), mBuilt(0.f), mOctreeNode(node), mSpatialPartition(part), @@ -1412,6 +1414,17 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node) } } + //clean up avatar attachment stats + LLSpatialBridge* bridge = mSpatialPartition->asBridge(); + if (bridge) + { + if (bridge->mAvatar.notNull()) + { + bridge->mAvatar->mAttachmentGeometryBytes -= mGeometryBytes; + bridge->mAvatar->mAttachmentSurfaceArea -= mSurfaceArea; + } + } + clearDrawMap(); mVertexBuffer = NULL; mBufferMap.clear(); @@ -1767,7 +1780,7 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) //============================================== LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage) -: mRenderByGroup(render_by_group) +: mRenderByGroup(render_by_group), mBridge(NULL) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); mOcclusionEnabled = TRUE; diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 899547ae4d..6c14ecf452 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -405,6 +405,9 @@ public: bridge_list_t mBridgeList; buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers + U32 mGeometryBytes; //used by volumes to track how many bytes of geometry data are in this node + F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node + F32 mBuilt; OctreeNode* mOctreeNode; LLSpatialPartition* mSpatialPartition; @@ -474,8 +477,8 @@ public: BOOL isVisible(const LLVector3& v); bool isHUDPartition() ; - virtual LLSpatialBridge* asBridge() { return NULL; } - virtual BOOL isBridge() { return asBridge() != NULL; } + LLSpatialBridge* asBridge() { return mBridge; } + BOOL isBridge() { return asBridge() != NULL; } void renderPhysicsShapes(); void renderDebug(); @@ -487,6 +490,9 @@ public: public: LLSpatialGroup::OctreeNode* mOctree; + LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this + // use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe + // to call asBridge() from the destructor BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane U32 mBufferUsage; @@ -511,8 +517,9 @@ public: LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask); - virtual BOOL isSpatialBridge() const { return TRUE; } + void destroyTree(); + virtual BOOL isSpatialBridge() const { return TRUE; } virtual void updateSpatialExtents(); virtual void updateBinRadius(); virtual void setVisible(LLCamera& camera_in, std::vector* results = NULL, BOOL for_select = FALSE); @@ -523,11 +530,12 @@ public: virtual void shiftPos(const LLVector4a& vec); virtual void cleanupReferences(); virtual LLSpatialPartition* asPartition() { return this; } - virtual LLSpatialBridge* asBridge() { return this; } - + virtual LLCamera transformCamera(LLCamera& camera); LLDrawable* mDrawable; + LLPointer mAvatar; + }; class LLCullResult diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0104d35e53..e6619e3e08 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -947,6 +947,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_COMPOSITION; } + else if ("attachment bytes" == info_display) + { + return LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES; + } else if ("glow" == info_display) { return LLPipeline::RENDER_DEBUG_GLOW; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 68637a7ed9..bc7f5a9744 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -651,6 +651,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, LLViewerObject(id, pcode, regionp), mIsDummy(FALSE), mSpecialRenderMode(0), + mAttachmentGeometryBytes(0), + mAttachmentSurfaceArea(0.f), mTurning(FALSE), mPelvisToFoot(0.f), mLastSkeletonSerialNum( 0 ), @@ -3363,6 +3365,16 @@ void LLVOAvatar::slamPosition() mRoot.updateWorldMatrixChildren(); } +bool LLVOAvatar::isVisuallyMuted() +{ + static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit"); + static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit"); + + return LLMuteList::getInstance()->isMuted(getID()) || + (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || + (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f); +} + //------------------------------------------------------------------------ // updateCharacter() // called on both your avatar and other avatars @@ -3429,8 +3441,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) size.setSub(ext[1],ext[0]); F32 mag = size.getLength3().getF32()*0.5f; + F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); - if (LLMuteList::getInstance()->isMuted(getID())) + if (isVisuallyMuted()) { // muted avatars update at 16 hz mUpdatePeriod = 16; } @@ -8333,6 +8346,11 @@ void LLVOAvatar::idleUpdateRenderCost() static std::set all_textures; + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES)) + { //set debug text to attachment geometry bytes here so render cost will override + setDebugText(llformat("%.1f KB, %.2f m^2", mAttachmentGeometryBytes/1024.f, mAttachmentSurfaceArea)); + } + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) { return; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 59796370ae..4cd61cecf9 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -380,6 +380,8 @@ private: public: U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0); + bool isVisuallyMuted(); + U32 renderRigid(); U32 renderSkinned(EAvatarRenderPass pass); F32 getLastSkinTime() { return mLastSkinTime; } @@ -391,6 +393,9 @@ public: static void restoreGL(); BOOL mIsDummy; // for special views S32 mSpecialRenderMode; // special lighting + U32 mAttachmentGeometryBytes; //number of bytes in attached geometry + F32 mAttachmentSurfaceArea; //estimated surface area of attachments + private: bool shouldAlphaMask(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e68fd2697a..7492a06784 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4097,6 +4097,32 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLFastTimer ftm2(FTM_REBUILD_VOLUME_VB); + LLVOAvatar* pAvatarVO = NULL; + + LLSpatialBridge* bridge = group->mSpatialPartition->asBridge(); + if (bridge) + { + if (bridge->mAvatar.isNull()) + { + LLViewerObject* vobj = bridge->mDrawable->getVObj(); + if (vobj) + { + bridge->mAvatar = vobj->getAvatar(); + } + } + + pAvatarVO = bridge->mAvatar; + } + + if (pAvatarVO) + { + pAvatarVO->mAttachmentGeometryBytes -= group->mGeometryBytes; + pAvatarVO->mAttachmentSurfaceArea -= group->mSurfaceArea; + } + + group->mGeometryBytes = 0; + group->mSurfaceArea = 0; + group->clearDrawMap(); mFaceList.clear(); @@ -4133,12 +4159,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLVOVolume* vobj = drawablep->getVOVolume(); + if (!vobj) + { + continue; + } + if (vobj->isMesh() && (vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded() || !gMeshRepo.meshRezEnabled())) { continue; } + LLVolume* volume = vobj->getVolume(); + if (volume) + { + const LLVector3& scale = vobj->getScale(); + group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]); + } + llassert_always(vobj); vobj->updateTextureVirtualSize(true); vobj->preRebuild(); @@ -4183,7 +4221,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //Determine if we've received skininfo that contains an //alternate bind matrix - if it does then apply the translational component //to the joints of the avatar. - LLVOAvatar* pAvatarVO = vobj->getAvatar(); bool pelvisGotSet = false; if ( pAvatarVO ) @@ -4253,13 +4290,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (type == LLDrawPool::POOL_ALPHA) { - if (te->getFullbright()) + if (te->getColor().mV[3] > 0.f) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); + } } } else if (te->getShiny()) @@ -4392,8 +4432,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else { - drawablep->setState(LLDrawable::HAS_ALPHA); - alpha_faces.push_back(facep); + if (te->getColor().mV[3] > 0.f) + { + drawablep->setState(LLDrawable::HAS_ALPHA); + alpha_faces.push_back(facep); + } } } else @@ -4510,6 +4553,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } mFaceList.clear(); + + if (pAvatarVO) + { + pAvatarVO->mAttachmentGeometryBytes += group->mGeometryBytes; + pAvatarVO->mAttachmentSurfaceArea += group->mSurfaceArea; + } } static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry"); @@ -4838,6 +4887,9 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } } + group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize(); + + buffer_map[mask][*face_iter].push_back(buffer); //add face geometry diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 737c5b51a2..df8f8793d1 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9420,7 +9420,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) assertInitialized(); - BOOL muted = LLMuteList::getInstance()->isMuted(avatar->getID()); + bool muted = avatar->isVisuallyMuted(); pushRenderTypeMask(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 2815d736e4..9c78048c46 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -432,34 +432,35 @@ public: enum LLRenderDebugMask { - RENDER_DEBUG_COMPOSITION = 0x0000001, - RENDER_DEBUG_VERIFY = 0x0000002, - RENDER_DEBUG_BBOXES = 0x0000004, - RENDER_DEBUG_OCTREE = 0x0000008, - RENDER_DEBUG_WIND_VECTORS = 0x0000010, - RENDER_DEBUG_OCCLUSION = 0x0000020, - RENDER_DEBUG_POINTS = 0x0000040, - RENDER_DEBUG_TEXTURE_PRIORITY = 0x0000080, - RENDER_DEBUG_TEXTURE_AREA = 0x0000100, - RENDER_DEBUG_FACE_AREA = 0x0000200, - RENDER_DEBUG_PARTICLES = 0x0000400, - RENDER_DEBUG_GLOW = 0x0000800, - RENDER_DEBUG_TEXTURE_ANIM = 0x0001000, - RENDER_DEBUG_LIGHTS = 0x0002000, - RENDER_DEBUG_BATCH_SIZE = 0x0004000, - RENDER_DEBUG_ALPHA_BINS = 0x0008000, - RENDER_DEBUG_RAYCAST = 0x0010000, - RENDER_DEBUG_SHAME = 0x0020000, - RENDER_DEBUG_SHADOW_FRUSTA = 0x0040000, - RENDER_DEBUG_SCULPTED = 0x0080000, - RENDER_DEBUG_AVATAR_VOLUME = 0x0100000, - RENDER_DEBUG_BUILD_QUEUE = 0x0200000, - RENDER_DEBUG_AGENT_TARGET = 0x0400000, - RENDER_DEBUG_UPDATE_TYPE = 0x0800000, - RENDER_DEBUG_PHYSICS_SHAPES = 0x1000000, - RENDER_DEBUG_NORMALS = 0x2000000, - RENDER_DEBUG_LOD_INFO = 0x4000000, - RENDER_DEBUG_RENDER_COMPLEXITY = 0x8000000 + RENDER_DEBUG_COMPOSITION = 0x00000001, + RENDER_DEBUG_VERIFY = 0x00000002, + RENDER_DEBUG_BBOXES = 0x00000004, + RENDER_DEBUG_OCTREE = 0x00000008, + RENDER_DEBUG_WIND_VECTORS = 0x00000010, + RENDER_DEBUG_OCCLUSION = 0x00000020, + RENDER_DEBUG_POINTS = 0x00000040, + RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080, + RENDER_DEBUG_TEXTURE_AREA = 0x00000100, + RENDER_DEBUG_FACE_AREA = 0x00000200, + RENDER_DEBUG_PARTICLES = 0x00000400, + RENDER_DEBUG_GLOW = 0x00000800, + RENDER_DEBUG_TEXTURE_ANIM = 0x00001000, + RENDER_DEBUG_LIGHTS = 0x00002000, + RENDER_DEBUG_BATCH_SIZE = 0x00004000, + RENDER_DEBUG_ALPHA_BINS = 0x00008000, + RENDER_DEBUG_RAYCAST = 0x00010000, + RENDER_DEBUG_SHAME = 0x00020000, + RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, + RENDER_DEBUG_SCULPTED = 0x00080000, + RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, + RENDER_DEBUG_BUILD_QUEUE = 0x00200000, + RENDER_DEBUG_AGENT_TARGET = 0x00400000, + RENDER_DEBUG_UPDATE_TYPE = 0x00800000, + RENDER_DEBUG_PHYSICS_SHAPES = 0x01000000, + RENDER_DEBUG_NORMALS = 0x02000000, + RENDER_DEBUG_LOD_INFO = 0x04000000, + RENDER_DEBUG_RENDER_COMPLEXITY = 0x08000000, + RENDER_DEBUG_ATTACHMENT_BYTES = 0x10000000, }; public: diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index ec2dd10248..b3a0c3379d 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2499,6 +2499,16 @@ + + + + Date: Fri, 20 Jan 2012 15:48:51 -0700 Subject: trivial: remove debug code for SH-2828 [crashhunters] Crash in LLRefCount::unref(), bad stacks --- indra/newview/llviewerwindow.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0534246559..5f64dba100 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1960,43 +1960,34 @@ void LLViewerWindow::shutdownViews() // clean up warning logger LLError::removeRecorder(RecordToChatConsole::getInstance()); - llinfos << "Warning logger is cleaned." << llendl ; - delete mDebugText; mDebugText = NULL; - llinfos << "DebugText deleted." << llendl ; - // Cleanup global views if (gMorphView) { gMorphView->setVisible(FALSE); } - llinfos << "Global views cleaned." << llendl ; - + // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open // will crump with LL_ERRS. LLModalDialog::shutdownModals(); - llinfos << "LLModalDialog shut down." << llendl; - + // destroy the nav bar, not currently part of gViewerWindow // *TODO: Make LLNavigationBar part of gViewerWindow if (LLNavigationBar::instanceExists()) { delete LLNavigationBar::getInstance(); } - llinfos << "LLNavigationBar destroyed." << llendl ; - + // destroy menus after instantiating navbar above, as it needs // access to gMenuHolder cleanup_menus(); - llinfos << "menus destroyed." << llendl ; - + // Delete all child views. delete mRootView; mRootView = NULL; - llinfos << "RootView deleted." << llendl ; - + // Automatically deleted as children of mRootView. Fix the globals. gStatusBar = NULL; gIMMgr = NULL; -- cgit v1.2.3 From 4287dcaacf0804a5a73dbf37c629471e2855733c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 20 Jan 2012 14:55:39 -0800 Subject: moved LLSDParam to llcommon so that LLSD<->Param Block conversion are usable by everyone --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llinitparam.h | 4 +- indra/llcommon/llsdparam.cpp | 342 ++++++++++++++++++++++++++++++++++++++++++ indra/llcommon/llsdparam.h | 126 ++++++++++++++++ indra/llui/CMakeLists.txt | 2 - indra/llui/llsdparam.cpp | 342 ------------------------------------------ indra/llui/llsdparam.h | 126 ---------------- 7 files changed, 472 insertions(+), 472 deletions(-) create mode 100644 indra/llcommon/llsdparam.cpp create mode 100644 indra/llcommon/llsdparam.h delete mode 100644 indra/llui/llsdparam.cpp delete mode 100644 indra/llui/llsdparam.h diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 72b1d363b0..a1aa887d3a 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -82,6 +82,7 @@ set(llcommon_SOURCE_FILES llrefcount.cpp llrun.cpp llsd.cpp + llsdparam.cpp llsdserialize.cpp llsdserialize_xml.cpp llsdutil.cpp @@ -211,6 +212,7 @@ set(llcommon_HEADER_FILES llrefcount.h llsafehandle.h llsd.h + llsdparam.h llsdserialize.h llsdserialize_xml.h llsdutil.h diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 550e1608cc..beaf07e56b 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -2057,8 +2057,8 @@ namespace LLInitParam // block param interface - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); + LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp new file mode 100644 index 0000000000..0e29873bb0 --- /dev/null +++ b/indra/llcommon/llsdparam.cpp @@ -0,0 +1,342 @@ +/** + * @file llsdparam.cpp + * @brief parameter block abstraction for creating complex objects and + * parsing construction parameters from xml and LLSD + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +// Project includes +#include "llsdparam.h" +#include "llsdutil.h" + +static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; +static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; +static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; +static const LLSD NO_VALUE_MARKER; + +LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion"); + +// +// LLParamSDParser +// +LLParamSDParser::LLParamSDParser() +: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) +{ + using boost::bind; + + if (sReadFuncs.empty()) + { + registerParserFuncs(readFlag, &LLParamSDParser::writeFlag); + registerParserFuncs(readS32, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readU32, &LLParamSDParser::writeU32Param); + registerParserFuncs(readF32, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readF64, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readBool, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readString, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readUUID, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readDate, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readURI, &LLParamSDParser::writeTypedValue); + registerParserFuncs(readSD, &LLParamSDParser::writeTypedValue); + } +} + +// special case handling of U32 due to ambiguous LLSD::assign overload +bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) +{ + LLParamSDParser& sdparser = static_cast(parser); + if (!sdparser.mWriteRootSD) return false; + + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); + sd_to_write.assign((S32)*((const U32*)val_ptr)); + + return true; +} + +bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) +{ + LLParamSDParser& sdparser = static_cast(parser); + if (!sdparser.mWriteRootSD) return false; + + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); + + return true; +} + +void LLParamSDParser::submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack) +{ + mCurReadSD = &sd; + block.submitValue(name_stack, *this); +} + +void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) +{ + mCurReadSD = NULL; + mNameStack.clear(); + setParseSilently(silent); + + LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); + //readSDValues(sd, block); +} + +void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) +{ + mNameStack.clear(); + mWriteRootSD = &sd; + + name_stack_t name_stack; + block.serializeBlock(*this, name_stack); +} + +/*virtual*/ std::string LLParamSDParser::getCurrentElementName() +{ + std::string full_name = "sd"; + for (name_stack_t::iterator it = mNameStack.begin(); + it != mNameStack.end(); + ++it) + { + full_name += llformat("[%s]", it->first.c_str()); + } + + return full_name; +} + + +bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + return self.mCurReadSD == &NO_VALUE_MARKER; +} + + +bool LLParamSDParser::readS32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((S32*)val_ptr) = self.mCurReadSD->asInteger(); + return true; +} + +bool LLParamSDParser::readU32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((U32*)val_ptr) = self.mCurReadSD->asInteger(); + return true; +} + +bool LLParamSDParser::readF32(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((F32*)val_ptr) = self.mCurReadSD->asReal(); + return true; +} + +bool LLParamSDParser::readF64(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((F64*)val_ptr) = self.mCurReadSD->asReal(); + return true; +} + +bool LLParamSDParser::readBool(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((bool*)val_ptr) = self.mCurReadSD->asBoolean(); + return true; +} + +bool LLParamSDParser::readString(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((std::string*)val_ptr) = self.mCurReadSD->asString(); + return true; +} + +bool LLParamSDParser::readUUID(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((LLUUID*)val_ptr) = self.mCurReadSD->asUUID(); + return true; +} + +bool LLParamSDParser::readDate(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((LLDate*)val_ptr) = self.mCurReadSD->asDate(); + return true; +} + +bool LLParamSDParser::readURI(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((LLURI*)val_ptr) = self.mCurReadSD->asURI(); + return true; +} + +bool LLParamSDParser::readSD(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast(parser); + + *((LLSD*)val_ptr) = *self.mCurReadSD; + return true; +} + +// static +LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range) +{ + LLSD* sd_to_write = &input; + + for (LLInitParam::Parser::name_stack_t::iterator it = name_stack_range.first; + it != name_stack_range.second; + ++it) + { + bool new_traversal = it->second; + + LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; + + if (child_sd->isArray()) + { + if (new_traversal) + { + // write to new element at end + sd_to_write = &(*child_sd)[child_sd->size()]; + } + else + { + // write to last of existing elements, or first element if empty + sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; + } + } + else + { + if (new_traversal + && child_sd->isDefined() + && !child_sd->isArray()) + { + // copy child contents into first element of an array + LLSD new_array = LLSD::emptyArray(); + new_array.append(*child_sd); + // assign array to slot that previously held the single value + *child_sd = new_array; + // return next element in that array + sd_to_write = &((*child_sd)[1]); + } + else + { + sd_to_write = child_sd; + } + } + it->second = false; + } + + return *sd_to_write; +} + +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack) +{ + if (sd.isMap()) + { + for (LLSD::map_const_iterator it = sd.beginMap(); + it != sd.endMap(); + ++it) + { + stack.push_back(make_pair(it->first, true)); + readSDValues(cb, it->second, stack); + stack.pop_back(); + } + } + else if (sd.isArray()) + { + for (LLSD::array_const_iterator it = sd.beginArray(); + it != sd.endArray(); + ++it) + { + stack.back().second = true; + readSDValues(cb, *it, stack); + } + } + else if (sd.isUndefined()) + { + if (!cb.empty()) + { + cb(NO_VALUE_MARKER, stack); + } + } + else + { + if (!cb.empty()) + { + cb(sd, stack); + } + } +} + +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd) +{ + LLInitParam::Parser::name_stack_t stack = LLInitParam::Parser::name_stack_t(); + readSDValues(cb, sd, stack); +} +namespace LLInitParam +{ + // LLSD specialization + // block param interface + bool ParamValue, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name) + { + LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack); + + LLSD::String string; + + if (p.readValue(string)) + { + sd = string; + return true; + } + return false; + } + + //static + void ParamValue, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack) + { + p.writeValue(sd.asString(), name_stack); + } + + void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const + { + // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) + Parser::name_stack_t stack; + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack); + } +} diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h new file mode 100644 index 0000000000..6ef5debd7b --- /dev/null +++ b/indra/llcommon/llsdparam.h @@ -0,0 +1,126 @@ +/** + * @file llsdparam.h + * @brief parameter block abstraction for creating complex objects and + * parsing construction parameters from xml and LLSD + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSDPARAM_H +#define LL_LLSDPARAM_H + +#include "llinitparam.h" +#include "boost/function.hpp" + +struct LL_COMMON_API LLParamSDParserUtilities +{ + static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); + + typedef boost::function read_sd_cb_t; + static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); + static void readSDValues(read_sd_cb_t cb, const LLSD& sd); +}; + +class LL_COMMON_API LLParamSDParser +: public LLInitParam::Parser +{ +LOG_CLASS(LLParamSDParser); + +typedef LLInitParam::Parser parser_t; + +public: + LLParamSDParser(); + void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false); + void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block); + + /*virtual*/ std::string getCurrentElementName(); + +private: + void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); + + template + static bool writeTypedValue(Parser& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) + { + LLParamSDParser& sdparser = static_cast(parser); + if (!sdparser.mWriteRootSD) return false; + + LLInitParam::Parser::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); + + sd_to_write.assign(*((const T*)val_ptr)); + return true; + } + + static bool writeU32Param(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); + static bool writeFlag(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); + + static bool readFlag(Parser& parser, void* val_ptr); + static bool readS32(Parser& parser, void* val_ptr); + static bool readU32(Parser& parser, void* val_ptr); + static bool readF32(Parser& parser, void* val_ptr); + static bool readF64(Parser& parser, void* val_ptr); + static bool readBool(Parser& parser, void* val_ptr); + static bool readString(Parser& parser, void* val_ptr); + static bool readUUID(Parser& parser, void* val_ptr); + static bool readDate(Parser& parser, void* val_ptr); + static bool readURI(Parser& parser, void* val_ptr); + static bool readSD(Parser& parser, void* val_ptr); + + Parser::name_stack_t mNameStack; + const LLSD* mCurReadSD; + LLSD* mWriteRootSD; + LLSD* mCurWriteSD; +}; + + +extern LL_COMMON_API LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR; +template +class LLSDParamAdapter : public T +{ +public: + LLSDParamAdapter() {} + LLSDParamAdapter(const LLSD& sd) + { + LLFastTimer _(FTM_SD_PARAM_ADAPTOR); + LLParamSDParser parser; + // don't spam for implicit parsing of LLSD, as we want to allow arbitrary freeform data and ignore most of it + bool parse_silently = true; + parser.readSD(sd, *this, parse_silently); + } + + operator LLSD() const + { + LLParamSDParser parser; + LLSD sd; + parser.writeSD(sd, *this); + return sd; + } + + LLSDParamAdapter(const T& val) + : T(val) + { + T::operator=(val); + } +}; + +#endif // LL_LLSDPARAM_H + diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 9226f36e73..20c3456a56 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -81,7 +81,6 @@ set(llui_SOURCE_FILES llscrolllistcolumn.cpp llscrolllistctrl.cpp llscrolllistitem.cpp - llsdparam.cpp llsearcheditor.cpp llslider.cpp llsliderctrl.cpp @@ -190,7 +189,6 @@ set(llui_HEADER_FILES llscrolllistcolumn.h llscrolllistctrl.h llscrolllistitem.h - llsdparam.h llsliderctrl.h llslider.h llspinctrl.h diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp deleted file mode 100644 index 0e29873bb0..0000000000 --- a/indra/llui/llsdparam.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/** - * @file llsdparam.cpp - * @brief parameter block abstraction for creating complex objects and - * parsing construction parameters from xml and LLSD - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -// Project includes -#include "llsdparam.h" -#include "llsdutil.h" - -static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; -static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; -static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; -static const LLSD NO_VALUE_MARKER; - -LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion"); - -// -// LLParamSDParser -// -LLParamSDParser::LLParamSDParser() -: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) -{ - using boost::bind; - - if (sReadFuncs.empty()) - { - registerParserFuncs(readFlag, &LLParamSDParser::writeFlag); - registerParserFuncs(readS32, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readU32, &LLParamSDParser::writeU32Param); - registerParserFuncs(readF32, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readF64, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readBool, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readString, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readUUID, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readDate, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readURI, &LLParamSDParser::writeTypedValue); - registerParserFuncs(readSD, &LLParamSDParser::writeTypedValue); - } -} - -// special case handling of U32 due to ambiguous LLSD::assign overload -bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) -{ - LLParamSDParser& sdparser = static_cast(parser); - if (!sdparser.mWriteRootSD) return false; - - parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); - sd_to_write.assign((S32)*((const U32*)val_ptr)); - - return true; -} - -bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) -{ - LLParamSDParser& sdparser = static_cast(parser); - if (!sdparser.mWriteRootSD) return false; - - parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); - LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); - - return true; -} - -void LLParamSDParser::submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack) -{ - mCurReadSD = &sd; - block.submitValue(name_stack, *this); -} - -void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) -{ - mCurReadSD = NULL; - mNameStack.clear(); - setParseSilently(silent); - - LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); - //readSDValues(sd, block); -} - -void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) -{ - mNameStack.clear(); - mWriteRootSD = &sd; - - name_stack_t name_stack; - block.serializeBlock(*this, name_stack); -} - -/*virtual*/ std::string LLParamSDParser::getCurrentElementName() -{ - std::string full_name = "sd"; - for (name_stack_t::iterator it = mNameStack.begin(); - it != mNameStack.end(); - ++it) - { - full_name += llformat("[%s]", it->first.c_str()); - } - - return full_name; -} - - -bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - return self.mCurReadSD == &NO_VALUE_MARKER; -} - - -bool LLParamSDParser::readS32(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((S32*)val_ptr) = self.mCurReadSD->asInteger(); - return true; -} - -bool LLParamSDParser::readU32(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((U32*)val_ptr) = self.mCurReadSD->asInteger(); - return true; -} - -bool LLParamSDParser::readF32(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((F32*)val_ptr) = self.mCurReadSD->asReal(); - return true; -} - -bool LLParamSDParser::readF64(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((F64*)val_ptr) = self.mCurReadSD->asReal(); - return true; -} - -bool LLParamSDParser::readBool(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((bool*)val_ptr) = self.mCurReadSD->asBoolean(); - return true; -} - -bool LLParamSDParser::readString(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((std::string*)val_ptr) = self.mCurReadSD->asString(); - return true; -} - -bool LLParamSDParser::readUUID(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((LLUUID*)val_ptr) = self.mCurReadSD->asUUID(); - return true; -} - -bool LLParamSDParser::readDate(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((LLDate*)val_ptr) = self.mCurReadSD->asDate(); - return true; -} - -bool LLParamSDParser::readURI(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((LLURI*)val_ptr) = self.mCurReadSD->asURI(); - return true; -} - -bool LLParamSDParser::readSD(Parser& parser, void* val_ptr) -{ - LLParamSDParser& self = static_cast(parser); - - *((LLSD*)val_ptr) = *self.mCurReadSD; - return true; -} - -// static -LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range) -{ - LLSD* sd_to_write = &input; - - for (LLInitParam::Parser::name_stack_t::iterator it = name_stack_range.first; - it != name_stack_range.second; - ++it) - { - bool new_traversal = it->second; - - LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; - - if (child_sd->isArray()) - { - if (new_traversal) - { - // write to new element at end - sd_to_write = &(*child_sd)[child_sd->size()]; - } - else - { - // write to last of existing elements, or first element if empty - sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; - } - } - else - { - if (new_traversal - && child_sd->isDefined() - && !child_sd->isArray()) - { - // copy child contents into first element of an array - LLSD new_array = LLSD::emptyArray(); - new_array.append(*child_sd); - // assign array to slot that previously held the single value - *child_sd = new_array; - // return next element in that array - sd_to_write = &((*child_sd)[1]); - } - else - { - sd_to_write = child_sd; - } - } - it->second = false; - } - - return *sd_to_write; -} - -//static -void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack) -{ - if (sd.isMap()) - { - for (LLSD::map_const_iterator it = sd.beginMap(); - it != sd.endMap(); - ++it) - { - stack.push_back(make_pair(it->first, true)); - readSDValues(cb, it->second, stack); - stack.pop_back(); - } - } - else if (sd.isArray()) - { - for (LLSD::array_const_iterator it = sd.beginArray(); - it != sd.endArray(); - ++it) - { - stack.back().second = true; - readSDValues(cb, *it, stack); - } - } - else if (sd.isUndefined()) - { - if (!cb.empty()) - { - cb(NO_VALUE_MARKER, stack); - } - } - else - { - if (!cb.empty()) - { - cb(sd, stack); - } - } -} - -//static -void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd) -{ - LLInitParam::Parser::name_stack_t stack = LLInitParam::Parser::name_stack_t(); - readSDValues(cb, sd, stack); -} -namespace LLInitParam -{ - // LLSD specialization - // block param interface - bool ParamValue, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name) - { - LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack); - - LLSD::String string; - - if (p.readValue(string)) - { - sd = string; - return true; - } - return false; - } - - //static - void ParamValue, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack) - { - p.writeValue(sd.asString(), name_stack); - } - - void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const - { - // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - Parser::name_stack_t stack; - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack); - } -} diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h deleted file mode 100644 index 3dfc6d020e..0000000000 --- a/indra/llui/llsdparam.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @file llsdparam.h - * @brief parameter block abstraction for creating complex objects and - * parsing construction parameters from xml and LLSD - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSDPARAM_H -#define LL_LLSDPARAM_H - -#include "llinitparam.h" -#include "boost/function.hpp" - -struct LLParamSDParserUtilities -{ - static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); - - typedef boost::function read_sd_cb_t; - static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); - static void readSDValues(read_sd_cb_t cb, const LLSD& sd); -}; - -class LLParamSDParser -: public LLInitParam::Parser -{ -LOG_CLASS(LLParamSDParser); - -typedef LLInitParam::Parser parser_t; - -public: - LLParamSDParser(); - void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false); - void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block); - - /*virtual*/ std::string getCurrentElementName(); - -private: - void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); - - template - static bool writeTypedValue(Parser& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) - { - LLParamSDParser& sdparser = static_cast(parser); - if (!sdparser.mWriteRootSD) return false; - - LLInitParam::Parser::name_stack_range_t range(name_stack.begin(), name_stack.end()); - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); - - sd_to_write.assign(*((const T*)val_ptr)); - return true; - } - - static bool writeU32Param(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); - static bool writeFlag(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); - - static bool readFlag(Parser& parser, void* val_ptr); - static bool readS32(Parser& parser, void* val_ptr); - static bool readU32(Parser& parser, void* val_ptr); - static bool readF32(Parser& parser, void* val_ptr); - static bool readF64(Parser& parser, void* val_ptr); - static bool readBool(Parser& parser, void* val_ptr); - static bool readString(Parser& parser, void* val_ptr); - static bool readUUID(Parser& parser, void* val_ptr); - static bool readDate(Parser& parser, void* val_ptr); - static bool readURI(Parser& parser, void* val_ptr); - static bool readSD(Parser& parser, void* val_ptr); - - Parser::name_stack_t mNameStack; - const LLSD* mCurReadSD; - LLSD* mWriteRootSD; - LLSD* mCurWriteSD; -}; - - -extern LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR; -template -class LLSDParamAdapter : public T -{ -public: - LLSDParamAdapter() {} - LLSDParamAdapter(const LLSD& sd) - { - LLFastTimer _(FTM_SD_PARAM_ADAPTOR); - LLParamSDParser parser; - // don't spam for implicit parsing of LLSD, as we want to allow arbitrary freeform data and ignore most of it - bool parse_silently = true; - parser.readSD(sd, *this, parse_silently); - } - - operator LLSD() const - { - LLParamSDParser parser; - LLSD sd; - parser.writeSD(sd, *this); - return sd; - } - - LLSDParamAdapter(const T& val) - : T(val) - { - T::operator=(val); - } -}; - -#endif // LL_LLSDPARAM_H - -- cgit v1.2.3 From f0dbb878337082d3f581874c12e6df2f4659a464 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 20 Jan 2012 18:10:40 -0500 Subject: Per Richard, replace LLProcessLauncher with LLProcess. LLProcessLauncher had the somewhat fuzzy mandate of (1) accumulating parameters with which to launch a child process and (2) sometimes tracking the lifespan of the ensuing child process. But a valid LLProcessLauncher object might or might not have ever been associated with an actual child process. LLProcess specifically tracks a child process. In effect, it's a fairly thin wrapper around a process HANDLE (on Windows) or pid_t (elsewhere), with lifespan management thrown in. A static LLProcess::create() method launches a new child; create() accepts an LLSD bundle with child parameters. So building up a parameter bundle is deferred to LLSD rather than conflated with the process management object. Reconcile all known LLProcessLauncher consumers in the viewer code base, notably the class unit tests. --- indra/llcommon/CMakeLists.txt | 6 +- indra/llcommon/llprocess.cpp | 338 ++++++++++ indra/llcommon/llprocess.h | 106 +++ indra/llcommon/llprocesslauncher.cpp | 394 ----------- indra/llcommon/llprocesslauncher.h | 107 --- indra/llcommon/tests/llprocess_test.cpp | 706 ++++++++++++++++++++ indra/llcommon/tests/llprocesslauncher_test.cpp | 718 --------------------- indra/llcommon/tests/llsdserialize_test.cpp | 13 +- indra/llplugin/llpluginprocessparent.cpp | 47 +- indra/llplugin/llpluginprocessparent.h | 10 +- indra/newview/llexternaleditor.cpp | 73 +-- indra/newview/llexternaleditor.h | 5 +- .../updater/llupdateinstaller.cpp | 20 +- 13 files changed, 1238 insertions(+), 1305 deletions(-) create mode 100644 indra/llcommon/llprocess.cpp create mode 100644 indra/llcommon/llprocess.h delete mode 100644 indra/llcommon/llprocesslauncher.cpp delete mode 100644 indra/llcommon/llprocesslauncher.h create mode 100644 indra/llcommon/tests/llprocess_test.cpp delete mode 100644 indra/llcommon/tests/llprocesslauncher_test.cpp diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 2c376bb016..e2af7265aa 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -74,7 +74,7 @@ set(llcommon_SOURCE_FILES llmortician.cpp lloptioninterface.cpp llptrto.cpp - llprocesslauncher.cpp + llprocess.cpp llprocessor.cpp llqueuedthread.cpp llrand.cpp @@ -197,7 +197,7 @@ set(llcommon_HEADER_FILES llpointer.h llpreprocessor.h llpriqueuemap.h - llprocesslauncher.h + llprocess.h llprocessor.h llptrskiplist.h llptrskipmap.h @@ -328,7 +328,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llprocesslauncher "" "${test_libs}" + LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/setpython.py") LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp new file mode 100644 index 0000000000..8c0caca680 --- /dev/null +++ b/indra/llcommon/llprocess.cpp @@ -0,0 +1,338 @@ +/** + * @file llprocess.cpp + * @brief Utility class for launching, terminating, and tracking the state of processes. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llprocess.h" +#include "llsd.h" +#include "llsdserialize.h" +#include "stringize.h" + +#include +#include +#include + +/// Need an exception to avoid constructing an invalid LLProcess object, but +/// internal use only +struct LLProcessError: public std::runtime_error +{ + LLProcessError(const std::string& msg): std::runtime_error(msg) {} +}; + +LLProcessPtr LLProcess::create(const LLSD& params) +{ + try + { + return LLProcessPtr(new LLProcess(params)); + } + catch (const LLProcessError& e) + { + LL_WARNS("LLProcess") << e.what() << LL_ENDL; + return LLProcessPtr(); + } +} + +LLProcess::LLProcess(const LLSD& params): + mProcessID(0), + mAutokill(params["autokill"].asBoolean()) +{ + // nonstandard default bool value + if (! params.has("autokill")) + mAutokill = true; + if (! params.has("executable")) + { + throw LLProcessError(STRINGIZE("not launched: missing 'executable'\n" + << LLSDNotationStreamer(params))); + } + + launch(params); +} + +LLProcess::~LLProcess() +{ + if (mAutokill) + { + kill(); + } +} + +bool LLProcess::isRunning(void) +{ + mProcessID = isRunning(mProcessID); + return (mProcessID != 0); +} + +#if LL_WINDOWS + +static std::string quote(const std::string& str) +{ + std::string::size_type len(str.length()); + // If the string is already quoted, assume user knows what s/he's doing. + if (len >= 2 && str[0] == '"' && str[len-1] == '"') + { + return str; + } + + // Not already quoted: do it. + std::string result("\""); + for (std::string::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) + { + if (*ci == '"') + { + result.append("\\"); + } + result.push_back(*ci); + } + return result + "\""; +} + +void LLProcess::launch(const LLSD& params) +{ + PROCESS_INFORMATION pinfo; + STARTUPINFOA sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + + std::string args = quote(params["executable"]); + BOOST_FOREACH(const std::string& arg, llsd::inArray(params["args"])) + { + args += " "; + args += quote(arg); + } + + // So retarded. Windows requires that the second parameter to + // CreateProcessA be a writable (non-const) string... + std::vector args2(args.begin(), args.end()); + args2.push_back('\0'); + + // Convert wrapper to a real std::string so we can use c_str(); but use a + // named variable instead of a temporary so c_str() pointer remains valid. + std::string cwd(params["cwd"]); + const char * working_directory = 0; + if (! cwd.empty()) + working_directory = cwd.c_str(); + if( ! CreateProcessA( NULL, &args2[0], NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) ) + { + int result = GetLastError(); + + LPTSTR error_str = 0; + if( + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + result, + 0, + (LPTSTR)&error_str, + 0, + NULL) + != 0) + { + char message[256]; + wcstombs(message, error_str, sizeof(message)); + message[sizeof(message)-1] = 0; + LocalFree(error_str); + throw LLProcessError(STRINGIZE("CreateProcessA failed (" << result << "): " + << message)); + } + throw LLProcessError(STRINGIZE("CreateProcessA failed (" << result + << "), but FormatMessage() did not explain")); + } + + // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on + // CloseHandle(pinfo.hProcess); // stops leaks - nothing else + mProcessID = pinfo.hProcess; + CloseHandle(pinfo.hThread); // stops leaks - nothing else +} + +LLProcess::id LLProcess::isRunning(id handle) +{ + if (! handle) + return 0; + + DWORD waitresult = WaitForSingleObject(handle, 0); + if(waitresult == WAIT_OBJECT_0) + { + // the process has completed. + return 0; + } + + return handle; +} + +bool LLProcess::kill(void) +{ + if (! mProcessID) + return false; + + TerminateProcess(mProcessID, 0); + return ! isRunning(); +} + +#else // Mac and linux + +#include +#include +#include +#include + +// Attempt to reap a process ID -- returns true if the process has exited and been reaped, false otherwise. +static bool reap_pid(pid_t pid) +{ + pid_t wait_result = ::waitpid(pid, NULL, WNOHANG); + if (wait_result == pid) + { + return true; + } + if (wait_result == -1 && errno == ECHILD) + { + // No such process -- this may mean we're ignoring SIGCHILD. + return true; + } + + return false; +} + +void LLProcess::launch(const LLSD& params) +{ + // flush all buffers before the child inherits them + ::fflush(NULL); + + pid_t child = vfork(); + if (child == 0) + { + // child process + + std::string cwd(params["cwd"]); + if (! cwd.empty()) + { + // change to the desired child working directory + if (::chdir(cwd.c_str())) + { + // chdir failed + LL_WARNS("LLProcess") << "could not chdir(\"" << cwd << "\")" << LL_ENDL; + // pointless to throw; this is child process... + _exit(248); + } + } + + // create an argv vector for the child process + std::vector fake_argv; + + // add the executable path + std::string executable(params["executable"]); + fake_argv.push_back(executable.c_str()); + + // and any arguments + const LLSD& params_args(params["args"]); + std::vector args(params_args.beginArray(), params_args.endArray()); + BOOST_FOREACH(const std::string& arg, args) + { + fake_argv.push_back(arg.c_str()); + } + + // terminate with a null pointer + fake_argv.push_back(NULL); + + ::execv(executable.c_str(), const_cast(&fake_argv[0])); + + // If we reach this point, the exec failed. + LL_WARNS("LLProcess") << "failed to launch: "; + BOOST_FOREACH(const char* arg, fake_argv) + { + LL_CONT << arg << ' '; + } + LL_CONT << LL_ENDL; + // Use _exit() instead of exit() per the vfork man page. Exit with a + // distinctive rc: someday soon we'll be able to retrieve it, and it + // would be nice to be able to tell that the child process failed! + _exit(249); + } + + // parent process + mProcessID = child; +} + +LLProcess::id LLProcess::isRunning(id pid) +{ + if (! pid) + return 0; + + // Check whether the process has exited, and reap it if it has. + if(reap_pid(pid)) + { + // the process has exited. + return 0; + } + + return pid; +} + +bool LLProcess::kill(void) +{ + if (! mProcessID) + return false; + + // Try to kill the process. We'll do approximately the same thing whether + // the kill returns an error or not, so we ignore the result. + (void)::kill(mProcessID, SIGTERM); + + // This will have the side-effect of reaping the zombie if the process has exited. + return ! isRunning(); +} + +/*==========================================================================*| +static std::list sZombies; + +void LLProcess::orphan(void) +{ + // Disassociate the process from this object + if(mProcessID != 0) + { + // We may still need to reap the process's zombie eventually + sZombies.push_back(mProcessID); + + mProcessID = 0; + } +} + +// static +void LLProcess::reap(void) +{ + // Attempt to real all saved process ID's. + + std::list::iterator iter = sZombies.begin(); + while(iter != sZombies.end()) + { + if(reap_pid(*iter)) + { + iter = sZombies.erase(iter); + } + else + { + iter++; + } + } +} +|*==========================================================================*/ + +#endif diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h new file mode 100644 index 0000000000..9a74cfe829 --- /dev/null +++ b/indra/llcommon/llprocess.h @@ -0,0 +1,106 @@ +/** + * @file llprocess.h + * @brief Utility class for launching, terminating, and tracking child processes. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPROCESS_H +#define LL_LLPROCESS_H + +#include +#include + +#if LL_WINDOWS +#define WIN32_LEAN_AND_MEAN +#include +#endif + +class LLSD; + +class LLProcess; +/// LLProcess instances are created on the heap by static factory methods and +/// managed by ref-counted pointers. +typedef boost::shared_ptr LLProcessPtr; + +/** + * LLProcess handles launching external processes with specified command line arguments. + * It also keeps track of whether the process is still running, and can kill it if required. +*/ +class LL_COMMON_API LLProcess: public boost::noncopyable +{ + LOG_CLASS(LLProcess); +public: + + /** + * Factory accepting LLSD::Map. + * MAY RETURN DEFAULT-CONSTRUCTED LLProcessPtr if params invalid! + * + * executable (required, string): executable pathname + * args (optional, string array): extra command-line arguments + * cwd (optional, string, dft no chdir): change to this directory before executing + * autokill (optional, bool, dft true): implicit kill() on ~LLProcess + */ + static LLProcessPtr create(const LLSD& params); + virtual ~LLProcess(); + + // isRunning isn't const because, if child isn't running, it clears stored + // process ID + bool isRunning(void); + + // Attempt to kill the process -- returns true if the process is no longer running when it returns. + // Note that even if this returns false, the process may exit some time after it's called. + bool kill(void); + +#if LL_WINDOWS + typedef HANDLE id; +#else + typedef pid_t id; +#endif + /// Get platform-specific process ID + id getProcessID() const { return mProcessID; }; + + /** + * Test if a process (id obtained from getProcessID()) is still + * running. Return is same nonzero id value if still running, else + * zero, so you can test it like a bool. But if you want to update a + * stored variable as a side effect, you can write code like this: + * @code + * childpid = LLProcess::isRunning(childpid); + * @endcode + * @note This method is intended as a unit-test hook, not as the first of + * a whole set of operations supported on freestanding @c id values. New + * functionality should be added as nonstatic members operating on + * mProcessID. + */ + static id isRunning(id); + +private: + /// constructor is private: use create() instead + LLProcess(const LLSD& params); + void launch(const LLSD& params); + + id mProcessID; + bool mAutokill; +}; + +#endif // LL_LLPROCESS_H diff --git a/indra/llcommon/llprocesslauncher.cpp b/indra/llcommon/llprocesslauncher.cpp deleted file mode 100644 index 5791d14ec0..0000000000 --- a/indra/llcommon/llprocesslauncher.cpp +++ /dev/null @@ -1,394 +0,0 @@ -/** - * @file llprocesslauncher.cpp - * @brief Utility class for launching, terminating, and tracking the state of processes. - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llprocesslauncher.h" - -#include -#if LL_DARWIN || LL_LINUX -// not required or present on Win32 -#include -#endif - -LLProcessLauncher::LLProcessLauncher() -{ -#if LL_WINDOWS - mProcessHandle = 0; -#else - mProcessID = 0; -#endif -} - -LLProcessLauncher::~LLProcessLauncher() -{ - kill(); -} - -void LLProcessLauncher::setExecutable(const std::string &executable) -{ - mExecutable = executable; -} - -void LLProcessLauncher::setWorkingDirectory(const std::string &dir) -{ - mWorkingDir = dir; -} - -const std::string& LLProcessLauncher::getExecutable() const -{ - return mExecutable; -} - -void LLProcessLauncher::clearArguments() -{ - mLaunchArguments.clear(); -} - -void LLProcessLauncher::addArgument(const std::string &arg) -{ - mLaunchArguments.push_back(arg); -} - -#if LL_WINDOWS - -static std::string quote(const std::string& str) -{ - std::string::size_type len(str.length()); - // If the string is already quoted, assume user knows what s/he's doing. - if (len >= 2 && str[0] == '"' && str[len-1] == '"') - { - return str; - } - - // Not already quoted: do it. - std::string result("\""); - for (std::string::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) - { - if (*ci == '"') - { - result.append("\\"); - } - result.push_back(*ci); - } - return result + "\""; -} - -int LLProcessLauncher::launch(void) -{ - // If there was already a process associated with this object, kill it. - kill(); - orphan(); - - int result = 0; - - PROCESS_INFORMATION pinfo; - STARTUPINFOA sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - - std::string args = quote(mExecutable); - for(int i = 0; i < (int)mLaunchArguments.size(); i++) - { - args += " "; - args += quote(mLaunchArguments[i]); - } - - // So retarded. Windows requires that the second parameter to CreateProcessA be a writable (non-const) string... - char *args2 = new char[args.size() + 1]; - strcpy(args2, args.c_str()); - - const char * working_directory = 0; - if(!mWorkingDir.empty()) working_directory = mWorkingDir.c_str(); - if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) ) - { - result = GetLastError(); - - LPTSTR error_str = 0; - if( - FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - result, - 0, - (LPTSTR)&error_str, - 0, - NULL) - != 0) - { - char message[256]; - wcstombs(message, error_str, 256); - message[255] = 0; - llwarns << "CreateProcessA failed: " << message << llendl; - LocalFree(error_str); - } - - if(result == 0) - { - // Make absolutely certain we return a non-zero value on failure. - result = -1; - } - } - else - { - // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on - // CloseHandle(pinfo.hProcess); // stops leaks - nothing else - mProcessHandle = pinfo.hProcess; - CloseHandle(pinfo.hThread); // stops leaks - nothing else - } - - delete[] args2; - - return result; -} - -bool LLProcessLauncher::isRunning(void) -{ - mProcessHandle = isRunning(mProcessHandle); - return (mProcessHandle != 0); -} - -LLProcessLauncher::ll_pid_t LLProcessLauncher::isRunning(ll_pid_t handle) -{ - if (! handle) - return 0; - - DWORD waitresult = WaitForSingleObject(handle, 0); - if(waitresult == WAIT_OBJECT_0) - { - // the process has completed. - return 0; - } - - return handle; -} - -bool LLProcessLauncher::kill(void) -{ - bool result = true; - - if(mProcessHandle != 0) - { - TerminateProcess(mProcessHandle,0); - - if(isRunning()) - { - result = false; - } - } - - return result; -} - -void LLProcessLauncher::orphan(void) -{ - // Forget about the process - mProcessHandle = 0; -} - -// static -void LLProcessLauncher::reap(void) -{ - // No actions necessary on Windows. -} - -#else // Mac and linux - -#include -#include -#include - -static std::list sZombies; - -// Attempt to reap a process ID -- returns true if the process has exited and been reaped, false otherwise. -static bool reap_pid(pid_t pid) -{ - bool result = false; - - pid_t wait_result = ::waitpid(pid, NULL, WNOHANG); - if(wait_result == pid) - { - result = true; - } - else if(wait_result == -1) - { - if(errno == ECHILD) - { - // No such process -- this may mean we're ignoring SIGCHILD. - result = true; - } - } - - return result; -} - -int LLProcessLauncher::launch(void) -{ - // If there was already a process associated with this object, kill it. - kill(); - orphan(); - - int result = 0; - int current_wd = -1; - - // create an argv vector for the child process - const char ** fake_argv = new const char *[mLaunchArguments.size() + 2]; // 1 for the executable path, 1 for the NULL terminator - - int i = 0; - - // add the executable path - fake_argv[i++] = mExecutable.c_str(); - - // and any arguments - for(int j=0; j < mLaunchArguments.size(); j++) - fake_argv[i++] = mLaunchArguments[j].c_str(); - - // terminate with a null pointer - fake_argv[i] = NULL; - - if(!mWorkingDir.empty()) - { - // save the current working directory - current_wd = ::open(".", O_RDONLY); - - // and change to the one the child will be executed in - if (::chdir(mWorkingDir.c_str())) - { - // chdir failed - } - } - - // flush all buffers before the child inherits them - ::fflush(NULL); - - pid_t id = vfork(); - if(id == 0) - { - // child process - ::execv(mExecutable.c_str(), (char * const *)fake_argv); - - // If we reach this point, the exec failed. - LL_WARNS("LLProcessLauncher") << "failed to launch: "; - for (const char * const * ai = fake_argv; *ai; ++ai) - { - LL_CONT << *ai << ' '; - } - LL_CONT << LL_ENDL; - // Use _exit() instead of exit() per the vfork man page. Exit with a - // distinctive rc: someday soon we'll be able to retrieve it, and it - // would be nice to be able to tell that the child process failed! - _exit(249); - } - - // parent process - - if(current_wd >= 0) - { - // restore the previous working directory - if (::fchdir(current_wd)) - { - // chdir failed - } - ::close(current_wd); - } - - delete[] fake_argv; - - mProcessID = id; - - return result; -} - -bool LLProcessLauncher::isRunning(void) -{ - mProcessID = isRunning(mProcessID); - return (mProcessID != 0); -} - -LLProcessLauncher::ll_pid_t LLProcessLauncher::isRunning(ll_pid_t pid) -{ - if (! pid) - return 0; - - // Check whether the process has exited, and reap it if it has. - if(reap_pid(pid)) - { - // the process has exited. - return 0; - } - - return pid; -} - -bool LLProcessLauncher::kill(void) -{ - bool result = true; - - if(mProcessID != 0) - { - // Try to kill the process. We'll do approximately the same thing whether the kill returns an error or not, so we ignore the result. - (void)::kill(mProcessID, SIGTERM); - - // This will have the side-effect of reaping the zombie if the process has exited. - if(isRunning()) - { - result = false; - } - } - - return result; -} - -void LLProcessLauncher::orphan(void) -{ - // Disassociate the process from this object - if(mProcessID != 0) - { - // We may still need to reap the process's zombie eventually - sZombies.push_back(mProcessID); - - mProcessID = 0; - } -} - -// static -void LLProcessLauncher::reap(void) -{ - // Attempt to real all saved process ID's. - - std::list::iterator iter = sZombies.begin(); - while(iter != sZombies.end()) - { - if(reap_pid(*iter)) - { - iter = sZombies.erase(iter); - } - else - { - iter++; - } - } -} - -#endif diff --git a/indra/llcommon/llprocesslauncher.h b/indra/llcommon/llprocesslauncher.h deleted file mode 100644 index 63193abd8f..0000000000 --- a/indra/llcommon/llprocesslauncher.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @file llprocesslauncher.h - * @brief Utility class for launching, terminating, and tracking the state of processes. - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPROCESSLAUNCHER_H -#define LL_LLPROCESSLAUNCHER_H - -#if LL_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include -#endif - - -/* - LLProcessLauncher handles launching external processes with specified command line arguments. - It also keeps track of whether the process is still running, and can kill it if required. -*/ - -class LL_COMMON_API LLProcessLauncher -{ - LOG_CLASS(LLProcessLauncher); -public: - LLProcessLauncher(); - virtual ~LLProcessLauncher(); - - void setExecutable(const std::string &executable); - void setWorkingDirectory(const std::string &dir); - - const std::string& getExecutable() const; - - void clearArguments(); - void addArgument(const std::string &arg); - - int launch(void); - // isRunning isn't const because, if child isn't running, it clears stored - // process ID - bool isRunning(void); - - // Attempt to kill the process -- returns true if the process is no longer running when it returns. - // Note that even if this returns false, the process may exit some time after it's called. - bool kill(void); - - // Use this if you want the external process to continue execution after the LLProcessLauncher instance controlling it is deleted. - // Normally, the destructor will attempt to kill the process and wait for termination. - // This should only be used if the viewer is about to exit -- otherwise, the child process will become a zombie after it exits. - void orphan(void); - - // This needs to be called periodically on Mac/Linux to clean up zombie processes. - // (However, as of 2012-01-12 there are no such calls in the viewer code base. :-P ) - static void reap(void); - - // Accessors for platform-specific process ID -#if LL_WINDOWS - // (Windows flavor unused as of 2012-01-12) - typedef HANDLE ll_pid_t; - HANDLE getProcessHandle() const { return mProcessHandle; } - ll_pid_t getProcessID() const { return mProcessHandle; } -#else - typedef pid_t ll_pid_t; - ll_pid_t getProcessID() const { return mProcessID; }; -#endif - /** - * Test if a process (ll_pid_t obtained from getProcessID()) is still - * running. Return is same nonzero ll_pid_t value if still running, else - * zero, so you can test it like a bool. But if you want to update a - * stored variable as a side effect, you can write code like this: - * @code - * childpid = LLProcessLauncher::isRunning(childpid); - * @endcode - */ - static ll_pid_t isRunning(ll_pid_t); - -private: - std::string mExecutable; - std::string mWorkingDir; - std::vector mLaunchArguments; - -#if LL_WINDOWS - HANDLE mProcessHandle; -#else - pid_t mProcessID; -#endif -}; - -#endif // LL_LLPROCESSLAUNCHER_H diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp new file mode 100644 index 0000000000..55e22abd81 --- /dev/null +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -0,0 +1,706 @@ +/** + * @file llprocess_test.cpp + * @author Nat Goodspeed + * @date 2011-12-19 + * @brief Test for llprocess. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Copyright (c) 2011, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llprocess.h" +// STL headers +#include +#include +// std headers +#include +// external library headers +#include "llapr.h" +#include "apr_thread_proc.h" +#include +#include +#include +#include +//#include +//#include +// other Linden headers +#include "../test/lltut.h" +#include "../test/manageapr.h" +#include "../test/namedtempfile.h" +#include "stringize.h" +#include "llsdutil.h" + +#if defined(LL_WINDOWS) +#define sleep(secs) _sleep((secs) * 1000) +#define EOL "\r\n" +#else +#define EOL "\n" +#include +#endif + +//namespace lambda = boost::lambda; + +// static instance of this manages APR init/cleanup +static ManageAPR manager; + +/***************************************************************************** +* Helpers +*****************************************************************************/ + +#define ensure_equals_(left, right) \ + ensure_equals(STRINGIZE(#left << " != " << #right), (left), (right)) + +#define aprchk(expr) aprchk_(#expr, (expr)) +static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR_SUCCESS) +{ + tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << manager.strerror(rv)), + rv, expected); +} + +/** + * Read specified file using std::getline(). It is assumed to be an error if + * the file is empty: don't use this function if that's an acceptable case. + * Last line will not end with '\n'; this is to facilitate the usual case of + * string compares with a single line of output. + * @param pathname The file to read. + * @param desc Optional description of the file for error message; + * defaults to "in " + */ +static std::string readfile(const std::string& pathname, const std::string& desc="") +{ + std::string use_desc(desc); + if (use_desc.empty()) + { + use_desc = STRINGIZE("in " << pathname); + } + std::ifstream inf(pathname.c_str()); + std::string output; + tut::ensure(STRINGIZE("No output " << use_desc), std::getline(inf, output)); + std::string more; + while (std::getline(inf, more)) + { + output += '\n' + more; + } + return output; +} + +/** + * Construct an LLProcess to run a Python script. + */ +struct PythonProcessLauncher +{ + /** + * @param desc Arbitrary description for error messages + * @param script Python script, any form acceptable to NamedTempFile, + * typically either a std::string or an expression of the form + * (lambda::_1 << "script content with " << variable_data) + */ + template + PythonProcessLauncher(const std::string& desc, const CONTENT& script): + mDesc(desc), + mScript("py", script) + { + const char* PYTHON(getenv("PYTHON")); + tut::ensure("Set $PYTHON to the Python interpreter", PYTHON); + + mParams["executable"] = PYTHON; + mParams["args"].append(mScript.getName()); + } + + /// Run Python script and wait for it to complete. + void run() + { + mPy = LLProcess::create(mParams); + tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), mPy); + // One of the irritating things about LLProcess is that + // there's no API to wait for the child to terminate -- but given + // its use in our graphics-intensive interactive viewer, it's + // understandable. + while (mPy->isRunning()) + { + sleep(1); + } + } + + /** + * Run a Python script using LLProcess, expecting that it will + * write to the file passed as its sys.argv[1]. Retrieve that output. + * + * Until January 2012, LLProcess provided distressingly few + * mechanisms for a child process to communicate back to its caller -- + * not even its return code. We've introduced a convention by which we + * create an empty temp file, pass the name of that file to our child + * as sys.argv[1] and expect the script to write its output to that + * file. This function implements the C++ (parent process) side of + * that convention. + */ + std::string run_read() + { + NamedTempFile out("out", ""); // placeholder + // pass name of this temporary file to the script + mParams["args"].append(out.getName()); + run(); + // assuming the script wrote to that file, read it + return readfile(out.getName(), STRINGIZE("from " << mDesc << " script")); + } + + LLSD mParams; + LLProcessPtr mPy; + std::string mDesc; + NamedTempFile mScript; +}; + +/// convenience function for PythonProcessLauncher::run() +template +static void python(const std::string& desc, const CONTENT& script) +{ + PythonProcessLauncher py(desc, script); + py.run(); +} + +/// convenience function for PythonProcessLauncher::run_read() +template +static std::string python_out(const std::string& desc, const CONTENT& script) +{ + PythonProcessLauncher py(desc, script); + return py.run_read(); +} + +/// Create a temporary directory and clean it up later. +class NamedTempDir: public boost::noncopyable +{ +public: + // Use python() function to create a temp directory: I've found + // nothing in either Boost.Filesystem or APR quite like Python's + // tempfile.mkdtemp(). + // Special extra bonus: on Mac, mkdtemp() reports a pathname + // starting with /var/folders/something, whereas that's really a + // symlink to /private/var/folders/something. Have to use + // realpath() to compare properly. + NamedTempDir(): + mPath(python_out("mkdtemp()", + "from __future__ import with_statement\n" + "import os.path, sys, tempfile\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write(os.path.realpath(tempfile.mkdtemp()))\n")) + {} + + ~NamedTempDir() + { + aprchk(apr_dir_remove(mPath.c_str(), gAPRPoolp)); + } + + std::string getName() const { return mPath; } + +private: + std::string mPath; +}; + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct llprocess_data + { + LLAPRPool pool; + }; + typedef test_group llprocess_group; + typedef llprocess_group::object object; + llprocess_group llprocessgrp("llprocess"); + + struct Item + { + Item(): tries(0) {} + unsigned tries; + std::string which; + std::string what; + }; + +/*==========================================================================*| +#define tabent(symbol) { symbol, #symbol } + static struct ReasonCode + { + int code; + const char* name; + } reasons[] = + { + tabent(APR_OC_REASON_DEATH), + tabent(APR_OC_REASON_UNWRITABLE), + tabent(APR_OC_REASON_RESTART), + tabent(APR_OC_REASON_UNREGISTER), + tabent(APR_OC_REASON_LOST), + tabent(APR_OC_REASON_RUNNING) + }; +#undef tabent +|*==========================================================================*/ + + struct WaitInfo + { + WaitInfo(apr_proc_t* child_): + child(child_), + rv(-1), // we haven't yet called apr_proc_wait() + rc(0), + why(apr_exit_why_e(0)) + {} + apr_proc_t* child; // which subprocess + apr_status_t rv; // return from apr_proc_wait() + int rc; // child's exit code + apr_exit_why_e why; // APR_PROC_EXIT, APR_PROC_SIGNAL, APR_PROC_SIGNAL_CORE + }; + + void child_status_callback(int reason, void* data, int status) + { +/*==========================================================================*| + std::string reason_str; + BOOST_FOREACH(const ReasonCode& rcp, reasons) + { + if (reason == rcp.code) + { + reason_str = rcp.name; + break; + } + } + if (reason_str.empty()) + { + reason_str = STRINGIZE("unknown reason " << reason); + } + std::cout << "child_status_callback(" << reason_str << ")\n"; +|*==========================================================================*/ + + if (reason == APR_OC_REASON_DEATH || reason == APR_OC_REASON_LOST) + { + // Somewhat oddly, APR requires that you explicitly unregister + // even when it already knows the child has terminated. + apr_proc_other_child_unregister(data); + + WaitInfo* wi(static_cast(data)); + // It's just wrong to call apr_proc_wait() here. The only way APR + // knows to call us with APR_OC_REASON_DEATH is that it's already + // reaped this child process, so calling wait() will only produce + // "huh?" from the OS. We must rely on the status param passed in, + // which unfortunately comes straight from the OS wait() call. +// wi->rv = apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT); + wi->rv = APR_CHILD_DONE; // fake apr_proc_wait() results +#if defined(LL_WINDOWS) + wi->why = APR_PROC_EXIT; + wi->rc = status; // no encoding on Windows (no signals) +#else // Posix + if (WIFEXITED(status)) + { + wi->why = APR_PROC_EXIT; + wi->rc = WEXITSTATUS(status); + } + else if (WIFSIGNALED(status)) + { + wi->why = APR_PROC_SIGNAL; + wi->rc = WTERMSIG(status); + } + else // uh, shouldn't happen? + { + wi->why = APR_PROC_EXIT; + wi->rc = status; // someone else will have to decode + } +#endif // Posix + } + } + + template<> template<> + void object::test<1>() + { + set_test_name("raw APR nonblocking I/O"); + + // Create a script file in a temporary place. + NamedTempFile script("py", + "import sys" EOL + "import time" EOL + EOL + "time.sleep(2)" EOL + "print >>sys.stdout, 'stdout after wait'" EOL + "sys.stdout.flush()" EOL + "time.sleep(2)" EOL + "print >>sys.stderr, 'stderr after wait'" EOL + "sys.stderr.flush()" EOL + ); + + // Arrange to track the history of our interaction with child: what we + // fetched, which pipe it came from, how many tries it took before we + // got it. + std::vector history; + history.push_back(Item()); + + // Run the child process. + apr_procattr_t *procattr = NULL; + aprchk(apr_procattr_create(&procattr, pool.getAPRPool())); + aprchk(apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK)); + aprchk(apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH)); + + std::vector argv; + apr_proc_t child; + argv.push_back("python"); + // Have to have a named copy of this std::string so its c_str() value + // will persist. + std::string scriptname(script.getName()); + argv.push_back(scriptname.c_str()); + argv.push_back(NULL); + + aprchk(apr_proc_create(&child, argv[0], + &argv[0], + NULL, // if we wanted to pass explicit environment + procattr, + pool.getAPRPool())); + + // We do not want this child process to outlive our APR pool. On + // destruction of the pool, forcibly kill the process. Tell APR to try + // SIGTERM and wait 3 seconds. If that didn't work, use SIGKILL. + apr_pool_note_subprocess(pool.getAPRPool(), &child, APR_KILL_AFTER_TIMEOUT); + + // arrange to call child_status_callback() + WaitInfo wi(&child); + apr_proc_other_child_register(&child, child_status_callback, &wi, child.in, pool.getAPRPool()); + + // TODO: + // Stuff child.in until it (would) block to verify EWOULDBLOCK/EAGAIN. + // Have child script clear it later, then write one more line to prove + // that it gets through. + + // Monitor two different output pipes. Because one will be closed + // before the other, keep them in a list so we can drop whichever of + // them is closed first. + typedef std::pair DescFile; + typedef std::list DescFileList; + DescFileList outfiles; + outfiles.push_back(DescFile("out", child.out)); + outfiles.push_back(DescFile("err", child.err)); + + while (! outfiles.empty()) + { + // This peculiar for loop is designed to let us erase(dfli). With + // a list, that invalidates only dfli itself -- but even so, we + // lose the ability to increment it for the next item. So at the + // top of every loop, while dfli is still valid, increment + // dflnext. Then before the next iteration, set dfli to dflnext. + for (DescFileList::iterator + dfli(outfiles.begin()), dflnext(outfiles.begin()), dflend(outfiles.end()); + dfli != dflend; dfli = dflnext) + { + // Only valid to increment dflnext once we're sure it's not + // already at dflend. + ++dflnext; + + char buf[4096]; + + apr_status_t rv = apr_file_gets(buf, sizeof(buf), dfli->second); + if (APR_STATUS_IS_EOF(rv)) + { +// std::cout << "(EOF on " << dfli->first << ")\n"; +// history.back().which = dfli->first; +// history.back().what = "*eof*"; +// history.push_back(Item()); + outfiles.erase(dfli); + continue; + } + if (rv == EWOULDBLOCK || rv == EAGAIN) + { +// std::cout << "(waiting; apr_file_gets(" << dfli->first << ") => " << rv << ": " << manager.strerror(rv) << ")\n"; + ++history.back().tries; + continue; + } + aprchk_("apr_file_gets(buf, sizeof(buf), dfli->second)", rv); + // Is it even possible to get APR_SUCCESS but read 0 bytes? + // Hope not, but defend against that anyway. + if (buf[0]) + { +// std::cout << dfli->first << ": " << buf; + history.back().which = dfli->first; + history.back().what.append(buf); + if (buf[strlen(buf) - 1] == '\n') + history.push_back(Item()); + else + { + // Just for pretty output... if we only read a partial + // line, terminate it. +// std::cout << "...\n"; + } + } + } + // Do this once per tick, as we expect the viewer will + apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); + sleep(1); + } + apr_file_close(child.in); + apr_file_close(child.out); + apr_file_close(child.err); + + // Okay, we've broken the loop because our pipes are all closed. If we + // haven't yet called wait, give the callback one more chance. This + // models the fact that unlike this small test program, the viewer + // will still be running. + if (wi.rv == -1) + { + std::cout << "last gasp apr_proc_other_child_refresh_all()\n"; + apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); + } + + if (wi.rv == -1) + { + std::cout << "child_status_callback(APR_OC_REASON_DEATH) wasn't called" << std::endl; + wi.rv = apr_proc_wait(wi.child, &wi.rc, &wi.why, APR_NOWAIT); + } +// std::cout << "child done: rv = " << rv << " (" << manager.strerror(rv) << "), why = " << why << ", rc = " << rc << '\n'; + aprchk_("apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT)", wi.rv, APR_CHILD_DONE); + ensure_equals_(wi.why, APR_PROC_EXIT); + ensure_equals_(wi.rc, 0); + + // Beyond merely executing all the above successfully, verify that we + // obtained expected output -- and that we duly got control while + // waiting, proving the non-blocking nature of these pipes. + try + { + unsigned i = 0; + ensure("blocking I/O on child pipe (0)", history[i].tries); + ensure_equals_(history[i].which, "out"); + ensure_equals_(history[i].what, "stdout after wait" EOL); +// ++i; +// ensure_equals_(history[i].which, "out"); +// ensure_equals_(history[i].what, "*eof*"); + ++i; + ensure("blocking I/O on child pipe (1)", history[i].tries); + ensure_equals_(history[i].which, "err"); + ensure_equals_(history[i].what, "stderr after wait" EOL); +// ++i; +// ensure_equals_(history[i].which, "err"); +// ensure_equals_(history[i].what, "*eof*"); + } + catch (const failure&) + { + std::cout << "History:\n"; + BOOST_FOREACH(const Item& item, history) + { + std::string what(item.what); + if ((! what.empty()) && what[what.length() - 1] == '\n') + { + what.erase(what.length() - 1); + if ((! what.empty()) && what[what.length() - 1] == '\r') + { + what.erase(what.length() - 1); + what.append("\\r"); + } + what.append("\\n"); + } + std::cout << " " << item.which << ": '" << what << "' (" + << item.tries << " tries)\n"; + } + std::cout << std::flush; + // re-raise same error; just want to enrich the output + throw; + } + } + + template<> template<> + void object::test<2>() + { + set_test_name("setWorkingDirectory()"); + // We want to test setWorkingDirectory(). But what directory is + // guaranteed to exist on every machine, under every OS? Have to + // create one. Naturally, ensure we clean it up when done. + NamedTempDir tempdir; + PythonProcessLauncher py("getcwd()", + "from __future__ import with_statement\n" + "import os, sys\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write(os.getcwd())\n"); + // Before running, call setWorkingDirectory() + py.mParams["cwd"] = tempdir.getName(); + ensure_equals("os.getcwd()", py.run_read(), tempdir.getName()); + } + + template<> template<> + void object::test<3>() + { + set_test_name("arguments"); + PythonProcessLauncher py("args", + "from __future__ import with_statement\n" + "import sys\n" + // note nonstandard output-file arg! + "with open(sys.argv[3], 'w') as f:\n" + " for arg in sys.argv[1:]:\n" + " print >>f, arg\n"); + // We expect that PythonProcessLauncher has already appended + // its own NamedTempFile to mParams["args"] (sys.argv[0]). + py.mParams["args"].append("first arg"); // sys.argv[1] + py.mParams["args"].append("second arg"); // sys.argv[2] + // run_read() appends() one more argument, hence [3] + std::string output(py.run_read()); + boost::split_iterator + li(output, boost::first_finder("\n")), lend; + ensure("didn't get first arg", li != lend); + std::string arg(li->begin(), li->end()); + ensure_equals(arg, "first arg"); + ++li; + ensure("didn't get second arg", li != lend); + arg.assign(li->begin(), li->end()); + ensure_equals(arg, "second arg"); + ++li; + ensure("didn't get output filename?!", li != lend); + arg.assign(li->begin(), li->end()); + ensure("output filename empty?!", ! arg.empty()); + ++li; + ensure("too many args", li == lend); + } + + template<> template<> + void object::test<4>() + { + set_test_name("explicit kill()"); + PythonProcessLauncher py("kill()", + "from __future__ import with_statement\n" + "import sys, time\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('ok')\n" + "# now sleep; expect caller to kill\n" + "time.sleep(120)\n" + "# if caller hasn't managed to kill by now, bad\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('bad')\n"); + NamedTempFile out("out", "not started"); + py.mParams["args"].append(out.getName()); + py.mPy = LLProcess::create(py.mParams); + ensure("couldn't launch kill() script", py.mPy); + // Wait for the script to wake up and do its first write + int i = 0, timeout = 60; + for ( ; i < timeout; ++i) + { + sleep(1); + if (readfile(out.getName(), "from kill() script") == "ok") + break; + } + // If we broke this loop because of the counter, something's wrong + ensure("script never started", i < timeout); + // script has performed its first write and should now be sleeping. + py.mPy->kill(); + // wait for the script to terminate... one way or another. + while (py.mPy->isRunning()) + { + sleep(1); + } + // If kill() failed, the script would have woken up on its own and + // overwritten the file with 'bad'. But if kill() succeeded, it should + // not have had that chance. + ensure_equals("kill() script output", readfile(out.getName()), "ok"); + } + + template<> template<> + void object::test<5>() + { + set_test_name("implicit kill()"); + NamedTempFile out("out", "not started"); + LLProcess::id pid(0); + { + PythonProcessLauncher py("kill()", + "from __future__ import with_statement\n" + "import sys, time\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('ok')\n" + "# now sleep; expect caller to kill\n" + "time.sleep(120)\n" + "# if caller hasn't managed to kill by now, bad\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('bad')\n"); + py.mParams["args"].append(out.getName()); + py.mPy = LLProcess::create(py.mParams); + ensure("couldn't launch kill() script", py.mPy); + // Capture id for later + pid = py.mPy->getProcessID(); + // Wait for the script to wake up and do its first write + int i = 0, timeout = 60; + for ( ; i < timeout; ++i) + { + sleep(1); + if (readfile(out.getName(), "from kill() script") == "ok") + break; + } + // If we broke this loop because of the counter, something's wrong + ensure("script never started", i < timeout); + // Script has performed its first write and should now be sleeping. + // Destroy the LLProcess, which should kill the child. + } + // wait for the script to terminate... one way or another. + while (LLProcess::isRunning(pid)) + { + sleep(1); + } + // If kill() failed, the script would have woken up on its own and + // overwritten the file with 'bad'. But if kill() succeeded, it should + // not have had that chance. + ensure_equals("kill() script output", readfile(out.getName()), "ok"); + } + + template<> template<> + void object::test<6>() + { + set_test_name("autokill"); + NamedTempFile from("from", "not started"); + NamedTempFile to("to", ""); + LLProcess::id pid(0); + { + PythonProcessLauncher py("autokill", + "from __future__ import with_statement\n" + "import sys, time\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('ok')\n" + "# wait for 'go' from test program\n" + "for i in xrange(60):\n" + " time.sleep(1)\n" + " with open(sys.argv[2]) as f:\n" + " go = f.read()\n" + " if go == 'go':\n" + " break\n" + "else:\n" + " with open(sys.argv[1], 'w') as f:\n" + " f.write('never saw go')\n" + " sys.exit(1)\n" + "# okay, saw 'go', write 'ack'\n" + "with open(sys.argv[1], 'w') as f:\n" + " f.write('ack')\n"); + py.mParams["args"].append(from.getName()); + py.mParams["args"].append(to.getName()); + py.mParams["autokill"] = false; + py.mPy = LLProcess::create(py.mParams); + ensure("couldn't launch kill() script", py.mPy); + // Capture id for later + pid = py.mPy->getProcessID(); + // Wait for the script to wake up and do its first write + int i = 0, timeout = 60; + for ( ; i < timeout; ++i) + { + sleep(1); + if (readfile(from.getName(), "from autokill script") == "ok") + break; + } + // If we broke this loop because of the counter, something's wrong + ensure("script never started", i < timeout); + // Now destroy the LLProcess, which should NOT kill the child! + } + // If the destructor killed the child anyway, give it time to die + sleep(2); + // How do we know it's not terminated? By making it respond to + // a specific stimulus in a specific way. + { + std::ofstream outf(to.getName().c_str()); + outf << "go"; + } // flush and close. + // now wait for the script to terminate... one way or another. + while (LLProcess::isRunning(pid)) + { + sleep(1); + } + // If the LLProcess destructor implicitly called kill(), the + // script could not have written 'ack' as we expect. + ensure_equals("autokill script output", readfile(from.getName()), "ack"); + } +} // namespace tut diff --git a/indra/llcommon/tests/llprocesslauncher_test.cpp b/indra/llcommon/tests/llprocesslauncher_test.cpp deleted file mode 100644 index 057f83631e..0000000000 --- a/indra/llcommon/tests/llprocesslauncher_test.cpp +++ /dev/null @@ -1,718 +0,0 @@ -/** - * @file llprocesslauncher_test.cpp - * @author Nat Goodspeed - * @date 2011-12-19 - * @brief Test for llprocesslauncher. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Copyright (c) 2011, Linden Research, Inc. - * $/LicenseInfo$ - */ - -// Precompiled header -#include "linden_common.h" -// associated header -#include "llprocesslauncher.h" -// STL headers -#include -#include -// std headers -#include -// external library headers -#include "llapr.h" -#include "apr_thread_proc.h" -#include -#include -#include -#include -//#include -//#include -// other Linden headers -#include "../test/lltut.h" -#include "../test/manageapr.h" -#include "../test/namedtempfile.h" -#include "stringize.h" - -#if defined(LL_WINDOWS) -#define sleep(secs) _sleep((secs) * 1000) -#define EOL "\r\n" -#else -#define EOL "\n" -#include -#endif - -//namespace lambda = boost::lambda; - -// static instance of this manages APR init/cleanup -static ManageAPR manager; - -/***************************************************************************** -* Helpers -*****************************************************************************/ - -#define ensure_equals_(left, right) \ - ensure_equals(STRINGIZE(#left << " != " << #right), (left), (right)) - -#define aprchk(expr) aprchk_(#expr, (expr)) -static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR_SUCCESS) -{ - tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << manager.strerror(rv)), - rv, expected); -} - -/** - * Read specified file using std::getline(). It is assumed to be an error if - * the file is empty: don't use this function if that's an acceptable case. - * Last line will not end with '\n'; this is to facilitate the usual case of - * string compares with a single line of output. - * @param pathname The file to read. - * @param desc Optional description of the file for error message; - * defaults to "in " - */ -static std::string readfile(const std::string& pathname, const std::string& desc="") -{ - std::string use_desc(desc); - if (use_desc.empty()) - { - use_desc = STRINGIZE("in " << pathname); - } - std::ifstream inf(pathname.c_str()); - std::string output; - tut::ensure(STRINGIZE("No output " << use_desc), std::getline(inf, output)); - std::string more; - while (std::getline(inf, more)) - { - output += '\n' + more; - } - return output; -} - -/** - * Construct an LLProcessLauncher to run a Python script. - */ -struct PythonProcessLauncher -{ - /** - * @param desc Arbitrary description for error messages - * @param script Python script, any form acceptable to NamedTempFile, - * typically either a std::string or an expression of the form - * (lambda::_1 << "script content with " << variable_data) - */ - template - PythonProcessLauncher(const std::string& desc, const CONTENT& script): - mDesc(desc), - mScript("py", script) - { - const char* PYTHON(getenv("PYTHON")); - tut::ensure("Set $PYTHON to the Python interpreter", PYTHON); - - mPy.setExecutable(PYTHON); - mPy.addArgument(mScript.getName()); - } - - /// Run Python script and wait for it to complete. - void run() - { - tut::ensure_equals(STRINGIZE("Couldn't launch " << mDesc << " script"), - mPy.launch(), 0); - // One of the irritating things about LLProcessLauncher is that - // there's no API to wait for the child to terminate -- but given - // its use in our graphics-intensive interactive viewer, it's - // understandable. - while (mPy.isRunning()) - { - sleep(1); - } - } - - /** - * Run a Python script using LLProcessLauncher, expecting that it will - * write to the file passed as its sys.argv[1]. Retrieve that output. - * - * Until January 2012, LLProcessLauncher provided distressingly few - * mechanisms for a child process to communicate back to its caller -- - * not even its return code. We've introduced a convention by which we - * create an empty temp file, pass the name of that file to our child - * as sys.argv[1] and expect the script to write its output to that - * file. This function implements the C++ (parent process) side of - * that convention. - */ - std::string run_read() - { - NamedTempFile out("out", ""); // placeholder - // pass name of this temporary file to the script - mPy.addArgument(out.getName()); - run(); - // assuming the script wrote to that file, read it - return readfile(out.getName(), STRINGIZE("from " << mDesc << " script")); - } - - LLProcessLauncher mPy; - std::string mDesc; - NamedTempFile mScript; -}; - -/// convenience function for PythonProcessLauncher::run() -template -static void python(const std::string& desc, const CONTENT& script) -{ - PythonProcessLauncher py(desc, script); - py.run(); -} - -/// convenience function for PythonProcessLauncher::run_read() -template -static std::string python_out(const std::string& desc, const CONTENT& script) -{ - PythonProcessLauncher py(desc, script); - return py.run_read(); -} - -/// Create a temporary directory and clean it up later. -class NamedTempDir: public boost::noncopyable -{ -public: - // Use python() function to create a temp directory: I've found - // nothing in either Boost.Filesystem or APR quite like Python's - // tempfile.mkdtemp(). - // Special extra bonus: on Mac, mkdtemp() reports a pathname - // starting with /var/folders/something, whereas that's really a - // symlink to /private/var/folders/something. Have to use - // realpath() to compare properly. - NamedTempDir(): - mPath(python_out("mkdtemp()", - "from __future__ import with_statement\n" - "import os.path, sys, tempfile\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write(os.path.realpath(tempfile.mkdtemp()))\n")) - {} - - ~NamedTempDir() - { - aprchk(apr_dir_remove(mPath.c_str(), gAPRPoolp)); - } - - std::string getName() const { return mPath; } - -private: - std::string mPath; -}; - -/***************************************************************************** -* TUT -*****************************************************************************/ -namespace tut -{ - struct llprocesslauncher_data - { - LLAPRPool pool; - }; - typedef test_group llprocesslauncher_group; - typedef llprocesslauncher_group::object object; - llprocesslauncher_group llprocesslaunchergrp("llprocesslauncher"); - - struct Item - { - Item(): tries(0) {} - unsigned tries; - std::string which; - std::string what; - }; - -/*==========================================================================*| -#define tabent(symbol) { symbol, #symbol } - static struct ReasonCode - { - int code; - const char* name; - } reasons[] = - { - tabent(APR_OC_REASON_DEATH), - tabent(APR_OC_REASON_UNWRITABLE), - tabent(APR_OC_REASON_RESTART), - tabent(APR_OC_REASON_UNREGISTER), - tabent(APR_OC_REASON_LOST), - tabent(APR_OC_REASON_RUNNING) - }; -#undef tabent -|*==========================================================================*/ - - struct WaitInfo - { - WaitInfo(apr_proc_t* child_): - child(child_), - rv(-1), // we haven't yet called apr_proc_wait() - rc(0), - why(apr_exit_why_e(0)) - {} - apr_proc_t* child; // which subprocess - apr_status_t rv; // return from apr_proc_wait() - int rc; // child's exit code - apr_exit_why_e why; // APR_PROC_EXIT, APR_PROC_SIGNAL, APR_PROC_SIGNAL_CORE - }; - - void child_status_callback(int reason, void* data, int status) - { -/*==========================================================================*| - std::string reason_str; - BOOST_FOREACH(const ReasonCode& rcp, reasons) - { - if (reason == rcp.code) - { - reason_str = rcp.name; - break; - } - } - if (reason_str.empty()) - { - reason_str = STRINGIZE("unknown reason " << reason); - } - std::cout << "child_status_callback(" << reason_str << ")\n"; -|*==========================================================================*/ - - if (reason == APR_OC_REASON_DEATH || reason == APR_OC_REASON_LOST) - { - // Somewhat oddly, APR requires that you explicitly unregister - // even when it already knows the child has terminated. - apr_proc_other_child_unregister(data); - - WaitInfo* wi(static_cast(data)); - // It's just wrong to call apr_proc_wait() here. The only way APR - // knows to call us with APR_OC_REASON_DEATH is that it's already - // reaped this child process, so calling wait() will only produce - // "huh?" from the OS. We must rely on the status param passed in, - // which unfortunately comes straight from the OS wait() call. -// wi->rv = apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT); - wi->rv = APR_CHILD_DONE; // fake apr_proc_wait() results -#if defined(LL_WINDOWS) - wi->why = APR_PROC_EXIT; - wi->rc = status; // no encoding on Windows (no signals) -#else // Posix - if (WIFEXITED(status)) - { - wi->why = APR_PROC_EXIT; - wi->rc = WEXITSTATUS(status); - } - else if (WIFSIGNALED(status)) - { - wi->why = APR_PROC_SIGNAL; - wi->rc = WTERMSIG(status); - } - else // uh, shouldn't happen? - { - wi->why = APR_PROC_EXIT; - wi->rc = status; // someone else will have to decode - } -#endif // Posix - } - } - - template<> template<> - void object::test<1>() - { - set_test_name("raw APR nonblocking I/O"); - - // Create a script file in a temporary place. - NamedTempFile script("py", - "import sys" EOL - "import time" EOL - EOL - "time.sleep(2)" EOL - "print >>sys.stdout, 'stdout after wait'" EOL - "sys.stdout.flush()" EOL - "time.sleep(2)" EOL - "print >>sys.stderr, 'stderr after wait'" EOL - "sys.stderr.flush()" EOL - ); - - // Arrange to track the history of our interaction with child: what we - // fetched, which pipe it came from, how many tries it took before we - // got it. - std::vector history; - history.push_back(Item()); - - // Run the child process. - apr_procattr_t *procattr = NULL; - aprchk(apr_procattr_create(&procattr, pool.getAPRPool())); - aprchk(apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK)); - aprchk(apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH)); - - std::vector argv; - apr_proc_t child; - argv.push_back("python"); - // Have to have a named copy of this std::string so its c_str() value - // will persist. - std::string scriptname(script.getName()); - argv.push_back(scriptname.c_str()); - argv.push_back(NULL); - - aprchk(apr_proc_create(&child, argv[0], - &argv[0], - NULL, // if we wanted to pass explicit environment - procattr, - pool.getAPRPool())); - - // We do not want this child process to outlive our APR pool. On - // destruction of the pool, forcibly kill the process. Tell APR to try - // SIGTERM and wait 3 seconds. If that didn't work, use SIGKILL. - apr_pool_note_subprocess(pool.getAPRPool(), &child, APR_KILL_AFTER_TIMEOUT); - - // arrange to call child_status_callback() - WaitInfo wi(&child); - apr_proc_other_child_register(&child, child_status_callback, &wi, child.in, pool.getAPRPool()); - - // TODO: - // Stuff child.in until it (would) block to verify EWOULDBLOCK/EAGAIN. - // Have child script clear it later, then write one more line to prove - // that it gets through. - - // Monitor two different output pipes. Because one will be closed - // before the other, keep them in a list so we can drop whichever of - // them is closed first. - typedef std::pair DescFile; - typedef std::list DescFileList; - DescFileList outfiles; - outfiles.push_back(DescFile("out", child.out)); - outfiles.push_back(DescFile("err", child.err)); - - while (! outfiles.empty()) - { - // This peculiar for loop is designed to let us erase(dfli). With - // a list, that invalidates only dfli itself -- but even so, we - // lose the ability to increment it for the next item. So at the - // top of every loop, while dfli is still valid, increment - // dflnext. Then before the next iteration, set dfli to dflnext. - for (DescFileList::iterator - dfli(outfiles.begin()), dflnext(outfiles.begin()), dflend(outfiles.end()); - dfli != dflend; dfli = dflnext) - { - // Only valid to increment dflnext once we're sure it's not - // already at dflend. - ++dflnext; - - char buf[4096]; - - apr_status_t rv = apr_file_gets(buf, sizeof(buf), dfli->second); - if (APR_STATUS_IS_EOF(rv)) - { -// std::cout << "(EOF on " << dfli->first << ")\n"; -// history.back().which = dfli->first; -// history.back().what = "*eof*"; -// history.push_back(Item()); - outfiles.erase(dfli); - continue; - } - if (rv == EWOULDBLOCK || rv == EAGAIN) - { -// std::cout << "(waiting; apr_file_gets(" << dfli->first << ") => " << rv << ": " << manager.strerror(rv) << ")\n"; - ++history.back().tries; - continue; - } - aprchk_("apr_file_gets(buf, sizeof(buf), dfli->second)", rv); - // Is it even possible to get APR_SUCCESS but read 0 bytes? - // Hope not, but defend against that anyway. - if (buf[0]) - { -// std::cout << dfli->first << ": " << buf; - history.back().which = dfli->first; - history.back().what.append(buf); - if (buf[strlen(buf) - 1] == '\n') - history.push_back(Item()); - else - { - // Just for pretty output... if we only read a partial - // line, terminate it. -// std::cout << "...\n"; - } - } - } - // Do this once per tick, as we expect the viewer will - apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); - sleep(1); - } - apr_file_close(child.in); - apr_file_close(child.out); - apr_file_close(child.err); - - // Okay, we've broken the loop because our pipes are all closed. If we - // haven't yet called wait, give the callback one more chance. This - // models the fact that unlike this small test program, the viewer - // will still be running. - if (wi.rv == -1) - { - std::cout << "last gasp apr_proc_other_child_refresh_all()\n"; - apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); - } - - if (wi.rv == -1) - { - std::cout << "child_status_callback(APR_OC_REASON_DEATH) wasn't called" << std::endl; - wi.rv = apr_proc_wait(wi.child, &wi.rc, &wi.why, APR_NOWAIT); - } -// std::cout << "child done: rv = " << rv << " (" << manager.strerror(rv) << "), why = " << why << ", rc = " << rc << '\n'; - aprchk_("apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT)", wi.rv, APR_CHILD_DONE); - ensure_equals_(wi.why, APR_PROC_EXIT); - ensure_equals_(wi.rc, 0); - - // Beyond merely executing all the above successfully, verify that we - // obtained expected output -- and that we duly got control while - // waiting, proving the non-blocking nature of these pipes. - try - { - unsigned i = 0; - ensure("blocking I/O on child pipe (0)", history[i].tries); - ensure_equals_(history[i].which, "out"); - ensure_equals_(history[i].what, "stdout after wait" EOL); -// ++i; -// ensure_equals_(history[i].which, "out"); -// ensure_equals_(history[i].what, "*eof*"); - ++i; - ensure("blocking I/O on child pipe (1)", history[i].tries); - ensure_equals_(history[i].which, "err"); - ensure_equals_(history[i].what, "stderr after wait" EOL); -// ++i; -// ensure_equals_(history[i].which, "err"); -// ensure_equals_(history[i].what, "*eof*"); - } - catch (const failure&) - { - std::cout << "History:\n"; - BOOST_FOREACH(const Item& item, history) - { - std::string what(item.what); - if ((! what.empty()) && what[what.length() - 1] == '\n') - { - what.erase(what.length() - 1); - if ((! what.empty()) && what[what.length() - 1] == '\r') - { - what.erase(what.length() - 1); - what.append("\\r"); - } - what.append("\\n"); - } - std::cout << " " << item.which << ": '" << what << "' (" - << item.tries << " tries)\n"; - } - std::cout << std::flush; - // re-raise same error; just want to enrich the output - throw; - } - } - - template<> template<> - void object::test<2>() - { - set_test_name("set/getExecutable()"); - LLProcessLauncher child; - child.setExecutable("nonsense string"); - ensure_equals("setExecutable() 0", child.getExecutable(), "nonsense string"); - child.setExecutable("python"); - ensure_equals("setExecutable() 1", child.getExecutable(), "python"); - } - - template<> template<> - void object::test<3>() - { - set_test_name("setWorkingDirectory()"); - // We want to test setWorkingDirectory(). But what directory is - // guaranteed to exist on every machine, under every OS? Have to - // create one. Naturally, ensure we clean it up when done. - NamedTempDir tempdir; - PythonProcessLauncher py("getcwd()", - "from __future__ import with_statement\n" - "import os, sys\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write(os.getcwd())\n"); - // Before running, call setWorkingDirectory() - py.mPy.setWorkingDirectory(tempdir.getName()); - ensure_equals("os.getcwd()", py.run_read(), tempdir.getName()); - } - - template<> template<> - void object::test<4>() - { - set_test_name("clearArguments()"); - PythonProcessLauncher py("args", - "from __future__ import with_statement\n" - "import sys\n" - // note nonstandard output-file arg! - "with open(sys.argv[3], 'w') as f:\n" - " for arg in sys.argv[1:]:\n" - " print >>f, arg\n"); - // We expect that PythonProcessLauncher has already called - // addArgument() with the name of its own NamedTempFile. But let's - // change it up. - py.mPy.clearArguments(); - // re-add script pathname - py.mPy.addArgument(py.mScript.getName()); // sys.argv[0] - py.mPy.addArgument("first arg"); // sys.argv[1] - py.mPy.addArgument("second arg"); // sys.argv[2] - // run_read() calls addArgument() one more time, hence [3] - std::string output(py.run_read()); - boost::split_iterator - li(output, boost::first_finder("\n")), lend; - ensure("didn't get first arg", li != lend); - std::string arg(li->begin(), li->end()); - ensure_equals(arg, "first arg"); - ++li; - ensure("didn't get second arg", li != lend); - arg.assign(li->begin(), li->end()); - ensure_equals(arg, "second arg"); - ++li; - ensure("didn't get output filename?!", li != lend); - arg.assign(li->begin(), li->end()); - ensure("output filename empty?!", ! arg.empty()); - ++li; - ensure("too many args", li == lend); - } - - template<> template<> - void object::test<5>() - { - set_test_name("explicit kill()"); - PythonProcessLauncher py("kill()", - "from __future__ import with_statement\n" - "import sys, time\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('ok')\n" - "# now sleep; expect caller to kill\n" - "time.sleep(120)\n" - "# if caller hasn't managed to kill by now, bad\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('bad')\n"); - NamedTempFile out("out", "not started"); - py.mPy.addArgument(out.getName()); - ensure_equals("couldn't launch kill() script", py.mPy.launch(), 0); - // Wait for the script to wake up and do its first write - int i = 0, timeout = 60; - for ( ; i < timeout; ++i) - { - sleep(1); - if (readfile(out.getName(), "from kill() script") == "ok") - break; - } - // If we broke this loop because of the counter, something's wrong - ensure("script never started", i < timeout); - // script has performed its first write and should now be sleeping. - py.mPy.kill(); - // wait for the script to terminate... one way or another. - while (py.mPy.isRunning()) - { - sleep(1); - } - // If kill() failed, the script would have woken up on its own and - // overwritten the file with 'bad'. But if kill() succeeded, it should - // not have had that chance. - ensure_equals("kill() script output", readfile(out.getName()), "ok"); - } - - template<> template<> - void object::test<6>() - { - set_test_name("implicit kill()"); - NamedTempFile out("out", "not started"); - LLProcessLauncher::ll_pid_t pid(0); - { - PythonProcessLauncher py("kill()", - "from __future__ import with_statement\n" - "import sys, time\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('ok')\n" - "# now sleep; expect caller to kill\n" - "time.sleep(120)\n" - "# if caller hasn't managed to kill by now, bad\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('bad')\n"); - py.mPy.addArgument(out.getName()); - ensure_equals("couldn't launch kill() script", py.mPy.launch(), 0); - // Capture ll_pid_t for later - pid = py.mPy.getProcessID(); - // Wait for the script to wake up and do its first write - int i = 0, timeout = 60; - for ( ; i < timeout; ++i) - { - sleep(1); - if (readfile(out.getName(), "from kill() script") == "ok") - break; - } - // If we broke this loop because of the counter, something's wrong - ensure("script never started", i < timeout); - // Script has performed its first write and should now be sleeping. - // Destroy the LLProcessLauncher, which should kill the child. - } - // wait for the script to terminate... one way or another. - while (LLProcessLauncher::isRunning(pid)) - { - sleep(1); - } - // If kill() failed, the script would have woken up on its own and - // overwritten the file with 'bad'. But if kill() succeeded, it should - // not have had that chance. - ensure_equals("kill() script output", readfile(out.getName()), "ok"); - } - - template<> template<> - void object::test<7>() - { - set_test_name("orphan()"); - NamedTempFile from("from", "not started"); - NamedTempFile to("to", ""); - LLProcessLauncher::ll_pid_t pid(0); - { - PythonProcessLauncher py("orphan()", - "from __future__ import with_statement\n" - "import sys, time\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('ok')\n" - "# wait for 'go' from test program\n" - "for i in xrange(60):\n" - " time.sleep(1)\n" - " with open(sys.argv[2]) as f:\n" - " go = f.read()\n" - " if go == 'go':\n" - " break\n" - "else:\n" - " with open(sys.argv[1], 'w') as f:\n" - " f.write('never saw go')\n" - " sys.exit(1)\n" - "# okay, saw 'go', write 'ack'\n" - "with open(sys.argv[1], 'w') as f:\n" - " f.write('ack')\n"); - py.mPy.addArgument(from.getName()); - py.mPy.addArgument(to.getName()); - ensure_equals("couldn't launch kill() script", py.mPy.launch(), 0); - // Capture ll_pid_t for later - pid = py.mPy.getProcessID(); - // Wait for the script to wake up and do its first write - int i = 0, timeout = 60; - for ( ; i < timeout; ++i) - { - sleep(1); - if (readfile(from.getName(), "from orphan() script") == "ok") - break; - } - // If we broke this loop because of the counter, something's wrong - ensure("script never started", i < timeout); - // Script has performed its first write and should now be waiting - // for us. Orphan it. - py.mPy.orphan(); - // Now destroy the LLProcessLauncher, which should NOT kill the child! - } - // If the destructor killed the child anyway, give it time to die - sleep(2); - // How do we know it's not terminated? By making it respond to - // a specific stimulus in a specific way. - { - std::ofstream outf(to.getName().c_str()); - outf << "go"; - } // flush and close. - // now wait for the script to terminate... one way or another. - while (LLProcessLauncher::isRunning(pid)) - { - sleep(1); - } - // If the LLProcessLauncher destructor implicitly called kill(), the - // script could not have written 'ack' as we expect. - ensure_equals("orphan() script output", readfile(from.getName()), "ack"); - } -} // namespace tut diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 4359e9afb9..7756ba6226 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -40,7 +40,7 @@ typedef U32 uint32_t; #include #include #include -#include "llprocesslauncher.h" +#include "llprocess.h" #endif #include "boost/range.hpp" @@ -1557,14 +1557,15 @@ namespace tut } #else // LL_DARWIN, LL_LINUX - LLProcessLauncher py; - py.setExecutable(PYTHON); - py.addArgument(scriptfile.getName()); - ensure_equals(STRINGIZE("Couldn't launch " << desc << " script"), py.launch(), 0); + LLSD params; + params["executable"] = PYTHON; + params["args"].append(scriptfile.getName()); + LLProcessPtr py(LLProcess::create(params)); + ensure(STRINGIZE("Couldn't launch " << desc << " script"), py); // Implementing timeout would mean messing with alarm() and // catching SIGALRM... later maybe... int status(0); - if (waitpid(py.getProcessID(), &status, 0) == -1) + if (waitpid(py->getProcessID(), &status, 0) == -1) { int waitpid_errno(errno); ensure_equals(STRINGIZE("Couldn't retrieve rc from " << desc << " script: " diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 110fac0f23..9b225cabb8 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -31,6 +31,7 @@ #include "llpluginprocessparent.h" #include "llpluginmessagepipe.h" #include "llpluginmessageclasses.h" +#include "stringize.h" #include "llapr.h" @@ -134,7 +135,10 @@ LLPluginProcessParent::~LLPluginProcessParent() mSharedMemoryRegions.erase(iter); } - mProcess.kill(); + if (mProcess) + { + mProcess->kill(); + } killSockets(); } @@ -159,8 +163,8 @@ void LLPluginProcessParent::errorState(void) void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug) { - mProcess.setExecutable(launcher_filename); - mProcess.setWorkingDirectory(plugin_dir); + mProcessParams["executable"] = launcher_filename; + mProcessParams["cwd"] = plugin_dir; mPluginFile = plugin_filename; mPluginDir = plugin_dir; mCPUUsage = 0.0f; @@ -371,10 +375,8 @@ void LLPluginProcessParent::idle(void) // Launch the plugin process. // Only argument to the launcher is the port number we're listening on - std::stringstream stream; - stream << mBoundPort; - mProcess.addArgument(stream.str()); - if(mProcess.launch() != 0) + mProcessParams["args"].append(stringize(mBoundPort)); + if (! (mProcess = LLProcess::create(mProcessParams))) { errorState(); } @@ -388,19 +390,18 @@ void LLPluginProcessParent::idle(void) // The command we're constructing would look like this on the command line: // osascript -e 'tell application "Terminal"' -e 'set win to do script "gdb -pid 12345"' -e 'do script "continue" in win' -e 'end tell' - std::stringstream cmd; - - mDebugger.setExecutable("/usr/bin/osascript"); - mDebugger.addArgument("-e"); - mDebugger.addArgument("tell application \"Terminal\""); - mDebugger.addArgument("-e"); - cmd << "set win to do script \"gdb -pid " << mProcess.getProcessID() << "\""; - mDebugger.addArgument(cmd.str()); - mDebugger.addArgument("-e"); - mDebugger.addArgument("do script \"continue\" in win"); - mDebugger.addArgument("-e"); - mDebugger.addArgument("end tell"); - mDebugger.launch(); + LLSD params; + params["executable"] = "/usr/bin/osascript"; + params["args"].append("-e"); + params["args"].append("tell application \"Terminal\""); + params["args"].append("-e"); + params["args"].append(STRINGIZE("set win to do script \"gdb -pid " + << mProcess->getProcessID() << "\"")); + params["args"].append("-e"); + params["args"].append("do script \"continue\" in win"); + params["args"].append("-e"); + params["args"].append("end tell"); + mDebugger = LLProcess::create(params); #endif } @@ -470,7 +471,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_EXITING: - if(!mProcess.isRunning()) + if (! mProcess->isRunning()) { setState(STATE_CLEANUP); } @@ -498,7 +499,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_CLEANUP: - mProcess.kill(); + mProcess->kill(); killSockets(); setState(STATE_DONE); break; @@ -1077,7 +1078,7 @@ bool LLPluginProcessParent::pluginLockedUpOrQuit() { bool result = false; - if(!mProcess.isRunning()) + if (! mProcess->isRunning()) { LL_WARNS("Plugin") << "child exited" << LL_ENDL; result = true; diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index c66723f175..e8bcba75e0 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -30,13 +30,14 @@ #define LL_LLPLUGINPROCESSPARENT_H #include "llapr.h" -#include "llprocesslauncher.h" +#include "llprocess.h" #include "llpluginmessage.h" #include "llpluginmessagepipe.h" #include "llpluginsharedmemory.h" #include "lliosocket.h" #include "llthread.h" +#include "llsd.h" class LLPluginProcessParentOwner { @@ -148,8 +149,9 @@ private: LLSocket::ptr_t mListenSocket; LLSocket::ptr_t mSocket; U32 mBoundPort; - - LLProcessLauncher mProcess; + + LLSD mProcessParams; + LLProcessPtr mProcess; std::string mPluginFile; std::string mPluginDir; @@ -171,7 +173,7 @@ private: bool mBlocked; bool mPolledInput; - LLProcessLauncher mDebugger; + LLProcessPtr mDebugger; F32 mPluginLaunchTimeout; // Somewhat longer timeout for initial launch. F32 mPluginLockupTimeout; // If we don't receive a heartbeat in this many seconds, we declare the plugin locked up. diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index ed1d7e860a..ba58cd8067 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -29,6 +29,9 @@ #include "lltrans.h" #include "llui.h" +#include "llprocess.h" +#include "llsdutil.h" +#include // static const std::string LLExternalEditor::sFilenameMarker = "%s"; @@ -45,19 +48,8 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env return EC_NOT_SPECIFIED; } - // Add the filename marker if missing. - if (cmd.find(sFilenameMarker) == std::string::npos) - { - cmd += " \"" + sFilenameMarker + "\""; - llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; - } - string_vec_t tokens; - if (tokenize(tokens, cmd) < 2) // 2 = bin + at least one arg (%s) - { - llwarns << "Error parsing editor command" << llendl; - return EC_PARSE_ERROR; - } + tokenize(tokens, cmd); // Check executable for existence. std::string bin_path = tokens[0]; @@ -68,51 +60,60 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env } // Save command. - mProcess.setExecutable(bin_path); - mArgs.clear(); + mProcessParams["executable"] = bin_path; + mProcessParams["args"].clear(); for (size_t i = 1; i < tokens.size(); ++i) { - if (i > 1) mArgs += " "; - mArgs += "\"" + tokens[i] + "\""; + mProcessParams["args"].append(tokens[i]); + } + + // Add the filename marker if missing. + if (cmd.find(sFilenameMarker) == std::string::npos) + { + mProcessParams["args"].append(sFilenameMarker); + llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; + } + + llinfos << "Setting command [" << bin_path; + BOOST_FOREACH(const std::string& arg, llsd::inArray(mProcessParams["args"])) + { + llcont << " \"" << arg << "\""; } - llinfos << "Setting command [" << bin_path << " " << mArgs << "]" << llendl; + llcont << "]" << llendl; return EC_SUCCESS; } LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) { - std::string args = mArgs; - if (mProcess.getExecutable().empty() || args.empty()) + if (mProcessParams["executable"].asString().empty() || ! mProcessParams["args"].size()) { llwarns << "Editor command not set" << llendl; return EC_NOT_SPECIFIED; } - // Substitute the filename marker in the command with the actual passed file name. - LLStringUtil::replaceString(args, sFilenameMarker, file_path); - - // Split command into separate tokens. - string_vec_t tokens; - tokenize(tokens, args); + // Copy params block so we can replace sFilenameMarker + LLSD params(mProcessParams); - // Set process arguments taken from the command. - mProcess.clearArguments(); - for (string_vec_t::const_iterator arg_it = tokens.begin(); arg_it != tokens.end(); ++arg_it) + // Substitute the filename marker in the command with the actual passed file name. + LLSD& args(params["args"]); + for (LLSD::array_iterator ai(args.beginArray()), aend(args.endArray()); ai != aend; ++ai) { - mProcess.addArgument(*arg_it); + std::string sarg(*ai); + LLStringUtil::replaceString(sarg, sFilenameMarker, file_path); + *ai = sarg; } // Run the editor. - llinfos << "Running editor command [" << mProcess.getExecutable() + " " + args << "]" << llendl; - int result = mProcess.launch(); - if (result == 0) + llinfos << "Running editor command [" << params["executable"]; + BOOST_FOREACH(const std::string& arg, llsd::inArray(params["args"])) { - // Prevent killing the process in destructor (will add it to the zombies list). - mProcess.orphan(); + llcont << " \"" << arg << "\""; } - - return result == 0 ? EC_SUCCESS : EC_FAILED_TO_RUN; + llcont << "]" << llendl; + // Prevent killing the process in destructor. + params["autokill"] = false; + return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN; } // static diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h index ef5db56c6e..e81c360c24 100644 --- a/indra/newview/llexternaleditor.h +++ b/indra/newview/llexternaleditor.h @@ -27,7 +27,7 @@ #ifndef LL_LLEXTERNALEDITOR_H #define LL_LLEXTERNALEDITOR_H -#include +#include "llsd.h" /** * Usage: @@ -98,8 +98,7 @@ private: static const std::string sSetting; - std::string mArgs; - LLProcessLauncher mProcess; + LLSD mProcessParams; }; #endif // LL_LLEXTERNALEDITOR_H diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index 84f23b3acc..e99fd0af7e 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -26,10 +26,10 @@ #include "linden_common.h" #include #include "llapr.h" -#include "llprocesslauncher.h" +#include "llprocess.h" #include "llupdateinstaller.h" #include "lldir.h" - +#include "llsd.h" #if defined(LL_WINDOWS) #pragma warning(disable: 4702) // disable 'unreachable code' so we can use lexical_cast (really!). @@ -78,15 +78,13 @@ int ll_install_update(std::string const & script, llinfos << "UpdateInstaller: installing " << updatePath << " using " << actualScriptPath << LL_ENDL; - LLProcessLauncher launcher; - launcher.setExecutable(actualScriptPath); - launcher.addArgument(updatePath); - launcher.addArgument(ll_install_failed_marker_path()); - launcher.addArgument(boost::lexical_cast(required)); - int result = launcher.launch(); - launcher.orphan(); - - return result; + LLSD params; + params["executable"] = actualScriptPath; + params["args"].append(updatePath); + params["args"].append(ll_install_failed_marker_path()); + params["args"].append(boost::lexical_cast(required)); + params["autokill"] = false; + return LLProcess::create(params)? 0 : -1; } -- cgit v1.2.3 From c8a2f6515a47c625d97802bd9f7bd833be65fe2c Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 20 Jan 2012 16:10:32 -0800 Subject: EXP-1799 FIX -- Replace and Add to Outfit options appear as grayed out in Inventory * Refactored LLFolderBridge::buildContextMenu fetch to clear and rebuild basic context menu options after the fetch rather than trying to merge the two. --- indra/newview/llinventorybridge.cpp | 86 +++++++++++++++++++++++-------------- indra/newview/llinventorybridge.h | 8 +++- 2 files changed, 59 insertions(+), 35 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 97e61f4c99..472be8cf5c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -519,6 +519,8 @@ void hide_context_entries(LLMenuGL& menu, { menu_item->setVisible(FALSE); } + + menu_item->setEnabled(FALSE); } else { @@ -601,13 +603,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Marketplace Separator")); - bool copyable = true; - LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); - if (inv_item) - { - copyable = inv_item->getPermissions().allowCopyBy(gAgent.getID()); - } - items.push_back(std::string("Merchant Copy")); if (!canListOnMarketplaceNow()) { @@ -1138,12 +1133,6 @@ bool LLInvFVBridge::canListOnMarketplace() const return false; } - const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); - if (outbox_id.isNull()) - { - return false; - } - LLViewerInventoryItem * item = model->getItem(mUUID); if (item) { @@ -2415,7 +2404,6 @@ public: delete this; } - protected: LLUUID mCatID; bool mCopyItems; @@ -2945,12 +2933,38 @@ void LLFolderBridge::staticFolderOptionsMenu() LLFolderBridge* selfp = sSelf.get(); if (selfp) { - selfp->folderOptionsMenu(); + selfp->folderOptionsMenuAfterFetch(); } } -void LLFolderBridge::folderOptionsMenu() +void LLFolderBridge::folderOptionsMenuAfterFetch() { + const U32 flags = mContextMenuFlags; + + mItems.clear(); + mDisabledItems.clear(); + mContextMenuFlags = 0x0; + + LLMenuGL* menup = dynamic_cast(mMenu.get()); + if (!menup) return; + + // Reset the menu + { + const LLView::child_list_t *list = menup->getChildList(); + + LLView::child_list_t::const_iterator menu_itor; + for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) + { + (*menu_itor)->setVisible(FALSE); + (*menu_itor)->pushVisible(TRUE); + (*menu_itor)->setEnabled(TRUE); + } + } + + // Build basic menu back up + buildContextMenuBaseOptions(*menup, flags); + + // Build folder specific options back up LLInventoryModel* model = getInventoryModel(); if(!model) return; @@ -3032,15 +3046,12 @@ void LLFolderBridge::folderOptionsMenu() } mItems.push_back(std::string("Outfit Separator")); } - LLMenuGL* menup = dynamic_cast(mMenu.get()); - if (menup) - { - hide_context_entries(*menup, mItems, mDisabledItems); - // Reposition the menu, in case we're adding items to an existing menu. - menup->needsArrange(); - menup->arrangeAndClear(); - } + hide_context_entries(*menup, mItems, mDisabledItems); + + // Reposition the menu, in case we're adding items to an existing menu. + menup->needsArrange(); + menup->arrangeAndClear(); } BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) @@ -3055,17 +3066,11 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv return ((item_array.count() > 0) ? TRUE : FALSE ); } -// Flags unused -void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags) { - mItems.clear(); - mDisabledItems.clear(); - - lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; - -// menuentry_vec_t disabled_items; LLInventoryModel* model = getInventoryModel(); - if(!model) return; + llassert(model != NULL); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); @@ -3186,6 +3191,21 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mDisabledItems.push_back(std::string("Share")); } } +} + +// Flags unused +void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + mItems.clear(); + mDisabledItems.clear(); + mContextMenuFlags = flags; + + lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; + + LLInventoryModel* model = getInventoryModel(); + if(!model) return; + + buildContextMenuBaseOptions(menu, flags); hide_context_entries(menu, mItems, mDisabledItems); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index cb378b7d7a..56301ce728 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -235,7 +235,8 @@ public: const LLUUID& uuid) : LLInvFVBridge(inventory, root, uuid), mCallingCards(FALSE), - mWearables(FALSE) + mWearables(FALSE), + mContextMenuFlags(0x0) {} BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg); @@ -282,6 +283,8 @@ public: LLHandle getHandle() { mHandle.bind(this); return mHandle; } protected: + void buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags); + //-------------------------------------------------------------------- // Menu callbacks //-------------------------------------------------------------------- @@ -317,7 +320,7 @@ protected: public: static LLHandle sSelf; static void staticFolderOptionsMenu(); - void folderOptionsMenu(); + void folderOptionsMenuAfterFetch(); private: BOOL mCallingCards; @@ -325,6 +328,7 @@ private: LLHandle mMenu; menuentry_vec_t mItems; menuentry_vec_t mDisabledItems; + U32 mContextMenuFlags; LLRootHandle mHandle; }; -- cgit v1.2.3 From 039cd701c4fa1dcc32bc63f57aab5a5f995f7498 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 20 Jan 2012 16:36:25 -0800 Subject: * Modified so "Copy" context menu option is not available for "no copy" items. --- indra/newview/llinventorybridge.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 472be8cf5c..bce3511c80 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1654,11 +1654,7 @@ BOOL LLItemBridge::isItemCopyable() const return FALSE; } - // All items can be copied in god mode since you can - // at least paste-as-link the item, though you - // still may not be able paste the item. - return TRUE; - // return (item->getPermissions().allowCopyBy(gAgent.getID())); + return item->getPermissions().allowCopyBy(gAgent.getID()) || gSavedSettings.getBOOL("InventoryLinking"); } return FALSE; } @@ -1771,12 +1767,8 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { - if (gSavedSettings.getBOOL("InventoryLinking")) - { - // Can copy folders to paste-as-link, but not for straight paste. - return TRUE; - } - return FALSE; + // Can copy folders to paste-as-link, but not for straight paste. + return gSavedSettings.getBOOL("InventoryLinking"); } BOOL LLFolderBridge::copyToClipboard() const -- cgit v1.2.3 From 6e214960ce203d1d50d7bd6bd04eedee3afd0fa3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 20 Jan 2012 20:19:50 -0500 Subject: Define LLProcess::Params; accept create(const LLSDParamAdapter&). This allows callers to pass either LLSD formatted as before -- which all callers still do -- or an actual LLProcess::Params block. --- indra/llcommon/llprocess.cpp | 31 +++++++++++++------------------ indra/llcommon/llprocess.h | 33 +++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 8c0caca680..dfb2ed69e9 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" #include "llprocess.h" -#include "llsd.h" #include "llsdserialize.h" #include "stringize.h" @@ -41,7 +40,7 @@ struct LLProcessError: public std::runtime_error LLProcessError(const std::string& msg): std::runtime_error(msg) {} }; -LLProcessPtr LLProcess::create(const LLSD& params) +LLProcessPtr LLProcess::create(const LLSDParamAdapter& params) { try { @@ -54,16 +53,13 @@ LLProcessPtr LLProcess::create(const LLSD& params) } } -LLProcess::LLProcess(const LLSD& params): +LLProcess::LLProcess(const LLSDParamAdapter& params): mProcessID(0), - mAutokill(params["autokill"].asBoolean()) + mAutokill(params.autokill) { - // nonstandard default bool value - if (! params.has("autokill")) - mAutokill = true; - if (! params.has("executable")) + if (! params.validateBlock(true)) { - throw LLProcessError(STRINGIZE("not launched: missing 'executable'\n" + throw LLProcessError(STRINGIZE("not launched: failed parameter validation\n" << LLSDNotationStreamer(params))); } @@ -108,14 +104,14 @@ static std::string quote(const std::string& str) return result + "\""; } -void LLProcess::launch(const LLSD& params) +void LLProcess::launch(const LLSDParamAdapter& params) { PROCESS_INFORMATION pinfo; STARTUPINFOA sinfo; memset(&sinfo, 0, sizeof(sinfo)); - std::string args = quote(params["executable"]); - BOOST_FOREACH(const std::string& arg, llsd::inArray(params["args"])) + std::string args = quote(params.executable); + BOOST_FOREACH(const std::string& arg, params.args) { args += " "; args += quote(arg); @@ -128,7 +124,7 @@ void LLProcess::launch(const LLSD& params) // Convert wrapper to a real std::string so we can use c_str(); but use a // named variable instead of a temporary so c_str() pointer remains valid. - std::string cwd(params["cwd"]); + std::string cwd(params.cwd); const char * working_directory = 0; if (! cwd.empty()) working_directory = cwd.c_str(); @@ -212,7 +208,7 @@ static bool reap_pid(pid_t pid) return false; } -void LLProcess::launch(const LLSD& params) +void LLProcess::launch(const LLSDParamAdapter& params) { // flush all buffers before the child inherits them ::fflush(NULL); @@ -222,7 +218,7 @@ void LLProcess::launch(const LLSD& params) { // child process - std::string cwd(params["cwd"]); + std::string cwd(params.cwd); if (! cwd.empty()) { // change to the desired child working directory @@ -239,12 +235,11 @@ void LLProcess::launch(const LLSD& params) std::vector fake_argv; // add the executable path - std::string executable(params["executable"]); + std::string executable(params.executable); fake_argv.push_back(executable.c_str()); // and any arguments - const LLSD& params_args(params["args"]); - std::vector args(params_args.beginArray(), params_args.endArray()); + std::vector args(params.args.begin(), params.args.end()); BOOST_FOREACH(const std::string& arg, args) { fake_argv.push_back(arg.c_str()); diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 9a74cfe829..9ea129baf2 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -27,6 +27,8 @@ #ifndef LL_LLPROCESS_H #define LL_LLPROCESS_H +#include "llinitparam.h" +#include "llsdparam.h" #include #include @@ -35,8 +37,6 @@ #include #endif -class LLSD; - class LLProcess; /// LLProcess instances are created on the heap by static factory methods and /// managed by ref-counted pointers. @@ -50,17 +50,38 @@ class LL_COMMON_API LLProcess: public boost::noncopyable { LOG_CLASS(LLProcess); public: + /// Param block definition + struct Params: public LLInitParam::Block + { + Params(): + executable("executable"), + args("args"), + cwd("cwd"), + autokill("autokill", true) + {} + + /// pathname of executable + Mandatory executable; + /// zero or more additional command-line arguments + Multiple args; + /// current working directory, if need it changed + Optional cwd; + /// implicitly kill process on destruction of LLProcess object + Optional autokill; + }; /** - * Factory accepting LLSD::Map. + * Factory accepting either plain LLSD::Map or Params block. * MAY RETURN DEFAULT-CONSTRUCTED LLProcessPtr if params invalid! * + * Redundant with Params definition above? + * * executable (required, string): executable pathname * args (optional, string array): extra command-line arguments * cwd (optional, string, dft no chdir): change to this directory before executing * autokill (optional, bool, dft true): implicit kill() on ~LLProcess */ - static LLProcessPtr create(const LLSD& params); + static LLProcessPtr create(const LLSDParamAdapter& params); virtual ~LLProcess(); // isRunning isn't const because, if child isn't running, it clears stored @@ -96,8 +117,8 @@ public: private: /// constructor is private: use create() instead - LLProcess(const LLSD& params); - void launch(const LLSD& params); + LLProcess(const LLSDParamAdapter& params); + void launch(const LLSDParamAdapter& params); id mProcessID; bool mAutokill; -- cgit v1.2.3 From 47d94757075e338c480ba4d7d24948242a85a9bb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 21 Jan 2012 11:45:15 -0500 Subject: Convert LLProcess consumers from LLSD to LLProcess::Params block. Using a Params block gives compile-time checking against attribute typos. One might inadvertently set myLLSD["autofill"] = false and only discover it when things behave strangely at runtime; but trying to set myParams.autofill will produce a compile error. However, it's excellent that the same LLProcess::create() method can accept either LLProcess::Params or a properly-constructed LLSD block. --- indra/llcommon/tests/llprocess_test.cpp | 26 ++++++++--------- indra/llcommon/tests/llsdserialize_test.cpp | 6 ++-- indra/llplugin/llpluginprocessparent.cpp | 28 +++++++++--------- indra/llplugin/llpluginprocessparent.h | 12 ++++---- indra/newview/llexternaleditor.cpp | 33 ++++++++++++---------- indra/newview/llexternaleditor.h | 5 ++-- .../updater/llupdateinstaller.cpp | 12 ++++---- 7 files changed, 62 insertions(+), 60 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 55e22abd81..405540e436 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -107,8 +107,8 @@ struct PythonProcessLauncher const char* PYTHON(getenv("PYTHON")); tut::ensure("Set $PYTHON to the Python interpreter", PYTHON); - mParams["executable"] = PYTHON; - mParams["args"].append(mScript.getName()); + mParams.executable = PYTHON; + mParams.args.add(mScript.getName()); } /// Run Python script and wait for it to complete. @@ -142,13 +142,13 @@ struct PythonProcessLauncher { NamedTempFile out("out", ""); // placeholder // pass name of this temporary file to the script - mParams["args"].append(out.getName()); + mParams.args.add(out.getName()); run(); // assuming the script wrote to that file, read it return readfile(out.getName(), STRINGIZE("from " << mDesc << " script")); } - LLSD mParams; + LLProcess::Params mParams; LLProcessPtr mPy; std::string mDesc; NamedTempFile mScript; @@ -515,7 +515,7 @@ namespace tut "with open(sys.argv[1], 'w') as f:\n" " f.write(os.getcwd())\n"); // Before running, call setWorkingDirectory() - py.mParams["cwd"] = tempdir.getName(); + py.mParams.cwd = tempdir.getName(); ensure_equals("os.getcwd()", py.run_read(), tempdir.getName()); } @@ -531,9 +531,9 @@ namespace tut " for arg in sys.argv[1:]:\n" " print >>f, arg\n"); // We expect that PythonProcessLauncher has already appended - // its own NamedTempFile to mParams["args"] (sys.argv[0]). - py.mParams["args"].append("first arg"); // sys.argv[1] - py.mParams["args"].append("second arg"); // sys.argv[2] + // its own NamedTempFile to mParams.args (sys.argv[0]). + py.mParams.args.add("first arg"); // sys.argv[1] + py.mParams.args.add("second arg"); // sys.argv[2] // run_read() appends() one more argument, hence [3] std::string output(py.run_read()); boost::split_iterator @@ -568,7 +568,7 @@ namespace tut "with open(sys.argv[1], 'w') as f:\n" " f.write('bad')\n"); NamedTempFile out("out", "not started"); - py.mParams["args"].append(out.getName()); + py.mParams.args.add(out.getName()); py.mPy = LLProcess::create(py.mParams); ensure("couldn't launch kill() script", py.mPy); // Wait for the script to wake up and do its first write @@ -611,7 +611,7 @@ namespace tut "# if caller hasn't managed to kill by now, bad\n" "with open(sys.argv[1], 'w') as f:\n" " f.write('bad')\n"); - py.mParams["args"].append(out.getName()); + py.mParams.args.add(out.getName()); py.mPy = LLProcess::create(py.mParams); ensure("couldn't launch kill() script", py.mPy); // Capture id for later @@ -667,9 +667,9 @@ namespace tut "# okay, saw 'go', write 'ack'\n" "with open(sys.argv[1], 'w') as f:\n" " f.write('ack')\n"); - py.mParams["args"].append(from.getName()); - py.mParams["args"].append(to.getName()); - py.mParams["autokill"] = false; + py.mParams.args.add(from.getName()); + py.mParams.args.add(to.getName()); + py.mParams.autokill = false; py.mPy = LLProcess::create(py.mParams); ensure("couldn't launch kill() script", py.mPy); // Capture id for later diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 7756ba6226..e625545763 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1557,9 +1557,9 @@ namespace tut } #else // LL_DARWIN, LL_LINUX - LLSD params; - params["executable"] = PYTHON; - params["args"].append(scriptfile.getName()); + LLProcess::Params params; + params.executable = PYTHON; + params.args.add(scriptfile.getName()); LLProcessPtr py(LLProcess::create(params)); ensure(STRINGIZE("Couldn't launch " << desc << " script"), py); // Implementing timeout would mean messing with alarm() and diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 9b225cabb8..f10eaee5b4 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -163,8 +163,8 @@ void LLPluginProcessParent::errorState(void) void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug) { - mProcessParams["executable"] = launcher_filename; - mProcessParams["cwd"] = plugin_dir; + mProcessParams.executable = launcher_filename; + mProcessParams.cwd = plugin_dir; mPluginFile = plugin_filename; mPluginDir = plugin_dir; mCPUUsage = 0.0f; @@ -375,7 +375,7 @@ void LLPluginProcessParent::idle(void) // Launch the plugin process. // Only argument to the launcher is the port number we're listening on - mProcessParams["args"].append(stringize(mBoundPort)); + mProcessParams.args.add(stringize(mBoundPort)); if (! (mProcess = LLProcess::create(mProcessParams))) { errorState(); @@ -390,17 +390,17 @@ void LLPluginProcessParent::idle(void) // The command we're constructing would look like this on the command line: // osascript -e 'tell application "Terminal"' -e 'set win to do script "gdb -pid 12345"' -e 'do script "continue" in win' -e 'end tell' - LLSD params; - params["executable"] = "/usr/bin/osascript"; - params["args"].append("-e"); - params["args"].append("tell application \"Terminal\""); - params["args"].append("-e"); - params["args"].append(STRINGIZE("set win to do script \"gdb -pid " - << mProcess->getProcessID() << "\"")); - params["args"].append("-e"); - params["args"].append("do script \"continue\" in win"); - params["args"].append("-e"); - params["args"].append("end tell"); + LLProcess::Params params; + params.executable = "/usr/bin/osascript"; + params.args.add("-e"); + params.args.add("tell application \"Terminal\""); + params.args.add("-e"); + params.args.add(STRINGIZE("set win to do script \"gdb -pid " + << mProcess->getProcessID() << "\"")); + params.args.add("-e"); + params.args.add("do script \"continue\" in win"); + params.args.add("-e"); + params.args.add("end tell"); mDebugger = LLProcess::create(params); #endif diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index e8bcba75e0..990fc5cbae 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -140,27 +140,27 @@ private: }; EState mState; void setState(EState state); - + bool pluginLockedUp(); bool pluginLockedUpOrQuit(); bool accept(); - + LLSocket::ptr_t mListenSocket; LLSocket::ptr_t mSocket; U32 mBoundPort; - LLSD mProcessParams; + LLProcess::Params mProcessParams; LLProcessPtr mProcess; - + std::string mPluginFile; std::string mPluginDir; LLPluginProcessParentOwner *mOwner; - + typedef std::map sharedMemoryRegionsType; sharedMemoryRegionsType mSharedMemoryRegions; - + LLSD mMessageClassVersions; std::string mPluginVersionString; diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index ba58cd8067..3dfebad958 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -60,22 +60,22 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env } // Save command. - mProcessParams["executable"] = bin_path; - mProcessParams["args"].clear(); + mProcessParams = LLProcess::Params(); + mProcessParams.executable = bin_path; for (size_t i = 1; i < tokens.size(); ++i) { - mProcessParams["args"].append(tokens[i]); + mProcessParams.args.add(tokens[i]); } // Add the filename marker if missing. if (cmd.find(sFilenameMarker) == std::string::npos) { - mProcessParams["args"].append(sFilenameMarker); + mProcessParams.args.add(sFilenameMarker); llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; } llinfos << "Setting command [" << bin_path; - BOOST_FOREACH(const std::string& arg, llsd::inArray(mProcessParams["args"])) + BOOST_FOREACH(const std::string& arg, mProcessParams.args) { llcont << " \"" << arg << "\""; } @@ -86,33 +86,36 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) { - if (mProcessParams["executable"].asString().empty() || ! mProcessParams["args"].size()) + // LLInitParams type wrappers don't seem to have empty() or size() + // methods; try determining emptiness by comparing begin/end iterators. + if (std::string(mProcessParams.executable).empty() || + (mProcessParams.args.begin() == mProcessParams.args.end())) { llwarns << "Editor command not set" << llendl; return EC_NOT_SPECIFIED; } // Copy params block so we can replace sFilenameMarker - LLSD params(mProcessParams); + LLProcess::Params params; + params.executable = mProcessParams.executable; // Substitute the filename marker in the command with the actual passed file name. - LLSD& args(params["args"]); - for (LLSD::array_iterator ai(args.beginArray()), aend(args.endArray()); ai != aend; ++ai) + BOOST_FOREACH(const std::string& arg, mProcessParams.args) { - std::string sarg(*ai); - LLStringUtil::replaceString(sarg, sFilenameMarker, file_path); - *ai = sarg; + std::string fixed(arg); + LLStringUtil::replaceString(fixed, sFilenameMarker, file_path); + params.args.add(fixed); } // Run the editor. - llinfos << "Running editor command [" << params["executable"]; - BOOST_FOREACH(const std::string& arg, llsd::inArray(params["args"])) + llinfos << "Running editor command [" << std::string(params.executable); + BOOST_FOREACH(const std::string& arg, params.args) { llcont << " \"" << arg << "\""; } llcont << "]" << llendl; // Prevent killing the process in destructor. - params["autokill"] = false; + params.autokill = false; return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN; } diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h index e81c360c24..fd2c25020c 100644 --- a/indra/newview/llexternaleditor.h +++ b/indra/newview/llexternaleditor.h @@ -27,7 +27,7 @@ #ifndef LL_LLEXTERNALEDITOR_H #define LL_LLEXTERNALEDITOR_H -#include "llsd.h" +#include "llprocess.h" /** * Usage: @@ -97,8 +97,7 @@ private: */ static const std::string sSetting; - - LLSD mProcessParams; + LLProcess::Params mProcessParams; }; #endif // LL_LLEXTERNALEDITOR_H diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp index e99fd0af7e..2f87d59373 100644 --- a/indra/viewer_components/updater/llupdateinstaller.cpp +++ b/indra/viewer_components/updater/llupdateinstaller.cpp @@ -78,12 +78,12 @@ int ll_install_update(std::string const & script, llinfos << "UpdateInstaller: installing " << updatePath << " using " << actualScriptPath << LL_ENDL; - LLSD params; - params["executable"] = actualScriptPath; - params["args"].append(updatePath); - params["args"].append(ll_install_failed_marker_path()); - params["args"].append(boost::lexical_cast(required)); - params["autokill"] = false; + LLProcess::Params params; + params.executable = actualScriptPath; + params.args.add(updatePath); + params.args.add(ll_install_failed_marker_path()); + params.args.add(boost::lexical_cast(required)); + params.autokill = false; return LLProcess::create(params)? 0 : -1; } -- cgit v1.2.3 From e690373b059117e316f7704309321aaca2839668 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 21 Jan 2012 19:46:46 -0500 Subject: Since lltrans.h moved to llui, fix linux_updater/CMakeLists.txt. --- indra/linux_updater/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/linux_updater/CMakeLists.txt b/indra/linux_updater/CMakeLists.txt index 00a78b2a8f..4377a6333c 100644 --- a/indra/linux_updater/CMakeLists.txt +++ b/indra/linux_updater/CMakeLists.txt @@ -10,14 +10,14 @@ include(UI) include(LLCommon) include(LLVFS) include(LLXML) -include(LLXUIXML) +include(LLUI) include(Linking) include_directories( ${LLCOMMON_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} + ${LLUI_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${CARES_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} @@ -42,7 +42,7 @@ target_link_libraries(linux-updater ${CRYPTO_LIBRARIES} ${UI_LIBRARIES} ${LLXML_LIBRARIES} - ${LLXUIXML_LIBRARIES} + ${LLUI_LIBRARIES} ${LLVFS_LIBRARIES} ${LLCOMMON_LIBRARIES} ) -- cgit v1.2.3 From b9a03b95aafb07eb32a8f99a671f2216acce96d4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 22 Jan 2012 09:16:11 -0500 Subject: On Windows, introduce viewer Job Object and assign children to it. The idea is that, with the right flag settings, this will cause the OS to terminate remaining viewer child processes when the viewer terminates -- whether or not it terminates intentionally. Of course, if LLProcess's caller specifies autokill=false, e.g. to run the viewer updater, that asserts that we WANT the child to persist beyond the viewer session itself. --- indra/llcommon/llprocess.cpp | 167 +++++++++++++++++++++++++++++++++---------- 1 file changed, 128 insertions(+), 39 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index dfb2ed69e9..d30d87411d 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -27,6 +27,7 @@ #include "linden_common.h" #include "llprocess.h" #include "llsdserialize.h" +#include "llsingleton.h" #include "stringize.h" #include @@ -80,43 +81,84 @@ bool LLProcess::isRunning(void) return (mProcessID != 0); } +/***************************************************************************** +* Windows specific +*****************************************************************************/ #if LL_WINDOWS -static std::string quote(const std::string& str) +static std::string WindowsErrorString(const std::string& operation); +static std::string quote(const std::string&); + +/** + * Wrap a Windows Job Object for use in managing child-process lifespan. + * + * On Windows, we use a Job Object to constrain the lifespan of any + * autokill=true child process to the viewer's own lifespan: + * http://stackoverflow.com/questions/53208/how-do-i-automatically-destroy-child-processes-in-windows + * (thanks Richard!). + * + * We manage it using an LLSingleton for a couple of reasons: + * + * # Lazy initialization: if some viewer session never launches a child + * process, we should never have to create a Job Object. + * # Cross-DLL support: be wary of C++ statics when multiple DLLs are + * involved. + */ +class LLJob: public LLSingleton { - std::string::size_type len(str.length()); - // If the string is already quoted, assume user knows what s/he's doing. - if (len >= 2 && str[0] == '"' && str[len-1] == '"') +public: + void assignProcess(const std::string& prog, HANDLE hProcess) { - return str; + // If we never managed to initialize this Job Object, can't use it -- + // but don't keep spamming the log, we already emitted warnings when + // we first tried to create. + if (! mJob) + return; + + if (! AssignProcessToJobObject(mJob, hProcess)) + { + LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject(\"" + << prog << "\")")) << LL_ENDL; + } } - // Not already quoted: do it. - std::string result("\""); - for (std::string::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) +private: + LLJob(): + mJob(0) { - if (*ci == '"') + mJob = CreateJobObject(NULL, NULL); + if (! mJob) { - result.append("\\"); + LL_WARNS("LLProcess") << WindowsErrorString("CreateJobObject()") << LL_ENDL; + return; + } + + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; + + // Configure all child processes associated with this new job object + // to terminate when the calling process (us!) terminates. + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + if (! SetInformationJobObject(mJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) + { + LL_WARNS("LLProcess") << WindowsErrorString("SetInformationJobObject()") << LL_ENDL; } - result.push_back(*ci); } - return result + "\""; -} + + HANDLE mJob; +}; void LLProcess::launch(const LLSDParamAdapter& params) { PROCESS_INFORMATION pinfo; - STARTUPINFOA sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - + STARTUPINFOA sinfo = { sizeof(sinfo) }; + std::string args = quote(params.executable); BOOST_FOREACH(const std::string& arg, params.args) { args += " "; args += quote(arg); } - + // So retarded. Windows requires that the second parameter to // CreateProcessA be a writable (non-const) string... std::vector args2(args.begin(), args.end()); @@ -130,28 +172,14 @@ void LLProcess::launch(const LLSDParamAdapter& params) working_directory = cwd.c_str(); if( ! CreateProcessA( NULL, &args2[0], NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) ) { - int result = GetLastError(); - - LPTSTR error_str = 0; - if( - FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - result, - 0, - (LPTSTR)&error_str, - 0, - NULL) - != 0) - { - char message[256]; - wcstombs(message, error_str, sizeof(message)); - message[sizeof(message)-1] = 0; - LocalFree(error_str); - throw LLProcessError(STRINGIZE("CreateProcessA failed (" << result << "): " - << message)); - } - throw LLProcessError(STRINGIZE("CreateProcessA failed (" << result - << "), but FormatMessage() did not explain")); + throw LLProcessError(WindowsErrorString("CreateProcessA")); + } + + // Now associate the new child process with our Job Object -- unless + // autokill is false, i.e. caller asserts the child should persist. + if (params.autokill) + { + LLJob::instance().assignProcess(params.executable, pinfo.hProcess); } // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on @@ -184,6 +212,67 @@ bool LLProcess::kill(void) return ! isRunning(); } +/** + * Double-quote an argument string, unless it's already double-quoted. If we + * quote it, escape any embedded double-quote with backslash. + * + * LLProcess::create()'s caller passes a Unix-style array of strings for + * command-line arguments. Our caller can and should expect that these will be + * passed to the child process as individual arguments, regardless of content + * (e.g. embedded spaces). But because Windows invokes any child process with + * a single command-line string, this means we must quote each argument behind + * the scenes. + */ +static std::string quote(const std::string& str) +{ + std::string::size_type len(str.length()); + // If the string is already quoted, assume user knows what s/he's doing. + if (len >= 2 && str[0] == '"' && str[len-1] == '"') + { + return str; + } + + // Not already quoted: do it. + std::string result("\""); + for (std::string::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) + { + if (*ci == '"') + { + result.append("\\"); + } + result.push_back(*ci); + } + return result + "\""; +} + +/// GetLastError()/FormatMessage() boilerplate +static std::string WindowsErrorString(const std::string& operation) +{ + int result = GetLastError(); + + LPTSTR error_str = 0; + if (FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + result, + 0, + (LPTSTR)&error_str, + 0, + NULL) + != 0) + { + char message[256]; + wcstombs(message, error_str, sizeof(message)); + message[sizeof(message)-1] = 0; + LocalFree(error_str); + return STRINGIZE(operation << " failed (" << result << "): " << message); + } + return STRINGIZE(operation << " failed (" << result + << "), but FormatMessage() did not explain"); +} + +/***************************************************************************** +* Non-Windows specific +*****************************************************************************/ #else // Mac and linux #include -- cgit v1.2.3 From aa1bbe3277842a9a6e7db5227b35f1fbea50b7a6 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 22 Jan 2012 10:58:16 -0500 Subject: Make LLProcess::Params streamable; use that in LLExternalEditor. --- indra/llcommon/llprocess.cpp | 15 +++++++++++++++ indra/llcommon/llprocess.h | 4 ++++ indra/newview/llexternaleditor.cpp | 14 ++------------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index d30d87411d..9d6c19f1dd 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -81,6 +81,21 @@ bool LLProcess::isRunning(void) return (mProcessID != 0); } +std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) +{ + std::string cwd(params.cwd); + if (! cwd.empty()) + { + out << "cd '" << cwd << "': "; + } + out << '"' << std::string(params.executable) << '"'; + BOOST_FOREACH(const std::string& arg, params.args) + { + out << " \"" << arg << '"'; + } + return out; +} + /***************************************************************************** * Windows specific *****************************************************************************/ diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 9ea129baf2..7dbdf23679 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -31,6 +31,7 @@ #include "llsdparam.h" #include #include +#include // std::ostream #if LL_WINDOWS #define WIN32_LEAN_AND_MEAN @@ -124,4 +125,7 @@ private: bool mAutokill; }; +/// for logging +LL_COMMON_API std::ostream& operator<<(std::ostream&, const LLProcess::Params&); + #endif // LL_LLPROCESS_H diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 3dfebad958..0d3ed0ba35 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -74,12 +74,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; } - llinfos << "Setting command [" << bin_path; - BOOST_FOREACH(const std::string& arg, mProcessParams.args) - { - llcont << " \"" << arg << "\""; - } - llcont << "]" << llendl; + llinfos << "Setting command [" << mProcessParams << "]" << llendl; return EC_SUCCESS; } @@ -108,12 +103,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) } // Run the editor. - llinfos << "Running editor command [" << std::string(params.executable); - BOOST_FOREACH(const std::string& arg, params.args) - { - llcont << " \"" << arg << "\""; - } - llcont << "]" << llendl; + llinfos << "Running editor command [" << params << "]" << llendl; // Prevent killing the process in destructor. params.autokill = false; return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN; -- cgit v1.2.3 From 748d1b311fdecf123df40bd7d22dd7e19afaca84 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 22 Jan 2012 11:56:38 -0500 Subject: Add LLProcess logging on launch(), kill(), isRunning(). Much as I dislike viewer log spam, seems to me starting a child process, killing it and observing its termination are noteworthy events. New logging makes LLExternalEditor launch message redundant; removed. --- indra/llcommon/llprocess.cpp | 34 +++++++++++++++++++++++++--------- indra/llcommon/llprocess.h | 7 ++++--- indra/newview/llexternaleditor.cpp | 4 +--- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 9d6c19f1dd..6d329a3fa1 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -77,7 +77,7 @@ LLProcess::~LLProcess() bool LLProcess::isRunning(void) { - mProcessID = isRunning(mProcessID); + mProcessID = isRunning(mProcessID, mDesc); return (mProcessID != 0); } @@ -190,20 +190,23 @@ void LLProcess::launch(const LLSDParamAdapter& params) throw LLProcessError(WindowsErrorString("CreateProcessA")); } + // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on + // CloseHandle(pinfo.hProcess); // stops leaks - nothing else + mProcessID = pinfo.hProcess; + CloseHandle(pinfo.hThread); // stops leaks - nothing else + + mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << pinfo.dwProcessId << ')'); + LL_INFOS("LLProcess") << "Launched " << params << " (" << pinfo.dwProcessId << ")" << LL_ENDL; + // Now associate the new child process with our Job Object -- unless // autokill is false, i.e. caller asserts the child should persist. if (params.autokill) { - LLJob::instance().assignProcess(params.executable, pinfo.hProcess); + LLJob::instance().assignProcess(mDesc, mProcessID); } - - // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on - // CloseHandle(pinfo.hProcess); // stops leaks - nothing else - mProcessID = pinfo.hProcess; - CloseHandle(pinfo.hThread); // stops leaks - nothing else } -LLProcess::id LLProcess::isRunning(id handle) +LLProcess::id LLProcess::isRunning(id handle, const std::string& desc) { if (! handle) return 0; @@ -212,6 +215,10 @@ LLProcess::id LLProcess::isRunning(id handle) if(waitresult == WAIT_OBJECT_0) { // the process has completed. + if (! desc.empty()) + { + LL_INFOS("LLProcess") << desc << " terminated" << LL_ENDL; + } return 0; } @@ -223,6 +230,7 @@ bool LLProcess::kill(void) if (! mProcessID) return false; + LL_INFOS("LLProcess") << "killing " << mDesc << LL_ENDL; TerminateProcess(mProcessID, 0); return ! isRunning(); } @@ -369,9 +377,12 @@ void LLProcess::launch(const LLSDParamAdapter& params) // parent process mProcessID = child; + + mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << mProcessID << ')'); + LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; } -LLProcess::id LLProcess::isRunning(id pid) +LLProcess::id LLProcess::isRunning(id pid, const std::string& desc) { if (! pid) return 0; @@ -380,6 +391,10 @@ LLProcess::id LLProcess::isRunning(id pid) if(reap_pid(pid)) { // the process has exited. + if (! desc.empty()) + { + LL_INFOS("LLProcess") << desc << " terminated" << LL_ENDL; + } return 0; } @@ -393,6 +408,7 @@ bool LLProcess::kill(void) // Try to kill the process. We'll do approximately the same thing whether // the kill returns an error or not, so we ignore the result. + LL_INFOS("LLProcess") << "killing " << mDesc << LL_ENDL; (void)::kill(mProcessID, SIGTERM); // This will have the side-effect of reaping the zombie if the process has exited. diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 7dbdf23679..019c33592c 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -97,7 +97,7 @@ public: typedef HANDLE id; #else typedef pid_t id; -#endif +#endif /// Get platform-specific process ID id getProcessID() const { return mProcessID; }; @@ -114,13 +114,14 @@ public: * functionality should be added as nonstatic members operating on * mProcessID. */ - static id isRunning(id); - + static id isRunning(id, const std::string& desc=""); + private: /// constructor is private: use create() instead LLProcess(const LLSDParamAdapter& params); void launch(const LLSDParamAdapter& params); + std::string mDesc; id mProcessID; bool mAutokill; }; diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 0d3ed0ba35..561b87618c 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -102,9 +102,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) params.args.add(fixed); } - // Run the editor. - llinfos << "Running editor command [" << params << "]" << llendl; - // Prevent killing the process in destructor. + // Run the editor. Prevent killing the process in destructor. params.autokill = false; return LLProcess::create(params) ? EC_SUCCESS : EC_FAILED_TO_RUN; } -- cgit v1.2.3 From 323c0ef64ee02d64c983c35eee4f7ac09851e116 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 22 Jan 2012 12:06:26 -0500 Subject: Use LLProcess::create() to launch SLVoice, rather than inline code. This appears to close a long-pending action item, as it seems the original LLProcessLauncher implementation was in fact cloned-and-edited from this logic in LLVivoxVoiceClient::stateMachine(). In any case, leveraging LLProcess buys us: - reduced redundancy; fewer maintenance points - logging for both success and errors - (possibly) better SLVoice.exe lifespan management. --- indra/newview/llvoicevivox.cpp | 140 +++++------------------------------------ 1 file changed, 16 insertions(+), 124 deletions(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index df1d3f2955..820d1d73e1 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -27,8 +27,6 @@ #include "llviewerprecompiledheaders.h" #include "llvoicevivox.h" -#include - #include "llsdutil.h" // Linden library includes @@ -47,6 +45,7 @@ #include "llbase64.h" #include "llviewercontrol.h" #include "llappviewer.h" // for gDisconnected, gDisableVoice +#include "llprocess.h" // Viewer includes #include "llmutelist.h" // to check for muted avatars @@ -242,59 +241,21 @@ void LLVivoxVoiceClientCapResponder::result(const LLSD& content) } } - - -#if LL_WINDOWS -static HANDLE sGatewayHandle = 0; +static LLProcessPtr sGatewayPtr; static bool isGatewayRunning() { - bool result = false; - if(sGatewayHandle != 0) - { - DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0); - if(waitresult != WAIT_OBJECT_0) - { - result = true; - } - } - return result; -} -static void killGateway() -{ - if(sGatewayHandle != 0) - { - TerminateProcess(sGatewayHandle,0); - } -} - -#else // Mac and linux - -static pid_t sGatewayPID = 0; -static bool isGatewayRunning() -{ - bool result = false; - if(sGatewayPID != 0) - { - // A kill with signal number 0 has no effect, just does error checking. It should return an error if the process no longer exists. - if(kill(sGatewayPID, 0) == 0) - { - result = true; - } - } - return result; + return sGatewayPtr && sGatewayPtr->isRunning(); } static void killGateway() { - if(sGatewayPID != 0) + if (sGatewayPtr) { - kill(sGatewayPID, SIGTERM); + sGatewayPtr->kill(); } } -#endif - /////////////////////////////////////////////////////////////////////////////////////////////// LLVivoxVoiceClient::LLVivoxVoiceClient() : @@ -790,7 +751,7 @@ void LLVivoxVoiceClient::stateMachine() } else if(!isGatewayRunning()) { - if(true) + if (true) // production build, not test { // Launch the voice daemon @@ -809,102 +770,33 @@ void LLVivoxVoiceClient::stateMachine() #endif // See if the vivox executable exists llstat s; - if(!LLFile::stat(exe_path, &s)) + if (!LLFile::stat(exe_path, &s)) { // vivox executable exists. Build the command line and launch the daemon. + LLProcess::Params params; + params.executable = exe_path; // SLIM SDK: these arguments are no longer necessary. // std::string args = " -p tcp -h -c"; - std::string args; - std::string cmd; std::string loglevel = gSavedSettings.getString("VivoxDebugLevel"); - if(loglevel.empty()) { loglevel = "-1"; // turn logging off completely } - - args += " -ll "; - args += loglevel; - - LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL; - -#if LL_WINDOWS - PROCESS_INFORMATION pinfo; - STARTUPINFOA sinfo; - - memset(&sinfo, 0, sizeof(sinfo)); - - std::string exe_dir = gDirUtilp->getAppRODataDir(); - cmd = "SLVoice.exe"; - cmd += args; - - // So retarded. Windows requires that the second parameter to CreateProcessA be writable (non-const) string... - char *args2 = new char[args.size() + 1]; - strcpy(args2, args.c_str()); - if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo)) - { -// DWORD dwErr = GetLastError(); - } - else - { - // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on - // CloseHandle(pinfo.hProcess); // stops leaks - nothing else - sGatewayHandle = pinfo.hProcess; - CloseHandle(pinfo.hThread); // stops leaks - nothing else - } - - delete[] args2; -#else // LL_WINDOWS - // This should be the same for mac and linux - { - std::vector arglist; - arglist.push_back(exe_path); - - // Split the argument string into separate strings for each argument - typedef boost::tokenizer > tokenizer; - boost::char_separator sep(" "); - tokenizer tokens(args, sep); - tokenizer::iterator token_iter; - for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - arglist.push_back(*token_iter); - } - - // create an argv vector for the child process - char **fakeargv = new char*[arglist.size() + 1]; - int i; - for(i=0; i < arglist.size(); i++) - fakeargv[i] = const_cast(arglist[i].c_str()); + params.args.add("-ll"); + params.args.add(loglevel); + params.cwd = gDirUtilp->getAppRODataDir(); + sGatewayPtr = LLProcess::create(params); - fakeargv[i] = NULL; - - fflush(NULL); // flush all buffers before the child inherits them - pid_t id = vfork(); - if(id == 0) - { - // child - execv(exe_path.c_str(), fakeargv); - - // If we reach this point, the exec failed. - // Use _exit() instead of exit() per the vfork man page. - _exit(0); - } - - // parent - delete[] fakeargv; - sGatewayPID = id; - } -#endif // LL_WINDOWS mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort")); - } + } else { LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL; - } + } } else - { + { // SLIM SDK: port changed from 44124 to 44125. // We can connect to a client gateway running on another host. This is useful for testing. // To do this, launch the gateway on a nearby host like this: -- cgit v1.2.3 From 738483e6302af5a9ad00fa3df17efe5336a03a41 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 22 Jan 2012 13:05:34 -0500 Subject: Every singleton needs a friend... --- indra/llcommon/llprocess.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 6d329a3fa1..eb7ce4129b 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -138,6 +138,7 @@ public: } private: + friend class LLSingleton; LLJob(): mJob(0) { -- cgit v1.2.3 From e2d4309ba56b103bbcd215b09c9d877ceb71dc38 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 23 Jan 2012 11:45:47 -0800 Subject: EXP-1799 FIX -- Replace and Add to Outfit options and Copy to Merchant Outbox options can appear in invalid state when a valid folder is last selection EXP-1834 FIX -- Right click context menus on Folders in Merchant Outbox and Library folders can show all inventory options including admin options EXP-1835 FIX -- Right clicking on a folder and selecting New Folder creates folder under My Inventory not within selected folder * Updated folder context menu building to build full options in one step or trigger a load which will rebuild top-level context menu for all selected items when complete. Previous code had an implicit assumption that the selected folder was the only selection after background fetch. --- indra/newview/llinventorybridge.cpp | 257 ++++++++++++++++-------------------- indra/newview/llinventorybridge.h | 9 +- 2 files changed, 116 insertions(+), 150 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bce3511c80..9e21e2fceb 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2923,127 +2923,11 @@ void LLFolderBridge::pasteLinkFromClipboard() void LLFolderBridge::staticFolderOptionsMenu() { LLFolderBridge* selfp = sSelf.get(); - if (selfp) - { - selfp->folderOptionsMenuAfterFetch(); - } -} - -void LLFolderBridge::folderOptionsMenuAfterFetch() -{ - const U32 flags = mContextMenuFlags; - - mItems.clear(); - mDisabledItems.clear(); - mContextMenuFlags = 0x0; - - LLMenuGL* menup = dynamic_cast(mMenu.get()); - if (!menup) return; - - // Reset the menu - { - const LLView::child_list_t *list = menup->getChildList(); - - LLView::child_list_t::const_iterator menu_itor; - for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) - { - (*menu_itor)->setVisible(FALSE); - (*menu_itor)->pushVisible(TRUE); - (*menu_itor)->setEnabled(TRUE); - } - } - - // Build basic menu back up - buildContextMenuBaseOptions(*menup, flags); - - // Build folder specific options back up - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - - const LLInventoryCategory* category = model->getCategory(mUUID); - if(!category) return; - - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - if (trash_id == mUUID) return; - if (isItemInTrash()) return; - if (!isAgentInventory()) return; - if (isOutboxFolder()) return; - - LLFolderType::EType type = category->getPreferredType(); - const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); - // BAP change once we're no longer treating regular categories as ensembles. - const bool is_ensemble = (type == LLFolderType::FT_NONE || - LLFolderType::lookupIsEnsembleType(type)); - - // Only enable calling-card related options for non-system folders. - if (!is_system_folder) - { - LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); - if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard)) - { - mItems.push_back(std::string("Calling Card Separator")); - mItems.push_back(std::string("Conference Chat Folder")); - mItems.push_back(std::string("IM All Contacts In Folder")); - } - } - - if (!isItemRemovable()) - { - mDisabledItems.push_back(std::string("Delete")); - } -#ifndef LL_RELEASE_FOR_DOWNLOAD - if (LLFolderType::lookupIsProtectedType(type)) + if (selfp && selfp->mRoot) { - mItems.push_back(std::string("Delete System Folder")); + selfp->mRoot->updateMenu(); } -#endif - - // wearables related functionality for folders. - //is_wearable - LLFindWearables is_wearable; - LLIsType is_object( LLAssetType::AT_OBJECT ); - LLIsType is_gesture( LLAssetType::AT_GESTURE ); - - if (mWearables || - checkFolderForContentsOfType(model, is_wearable) || - checkFolderForContentsOfType(model, is_object) || - checkFolderForContentsOfType(model, is_gesture) ) - { - mItems.push_back(std::string("Folder Wearables Separator")); - - // Only enable add/replace outfit for non-system folders. - if (!is_system_folder) - { - // Adding an outfit onto another (versus replacing) doesn't make sense. - if (type != LLFolderType::FT_OUTFIT) - { - mItems.push_back(std::string("Add To Outfit")); - } - - mItems.push_back(std::string("Replace Outfit")); - } - if (is_ensemble) - { - mItems.push_back(std::string("Wear As Ensemble")); - } - mItems.push_back(std::string("Remove From Outfit")); - if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID)) - { - mDisabledItems.push_back(std::string("Remove From Outfit")); - } - if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) - { - mDisabledItems.push_back(std::string("Replace Outfit")); - } - mItems.push_back(std::string("Outfit Separator")); - } - - hide_context_entries(*menup, mItems, mDisabledItems); - - // Reposition the menu, in case we're adding items to an existing menu. - menup->needsArrange(); - menup->arrangeAndClear(); } BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) @@ -3058,7 +2942,7 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv return ((item_array.count() > 0) ? TRUE : FALSE ); } -void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags) +void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) { LLInventoryModel* model = getInventoryModel(); llassert(model != NULL); @@ -3079,10 +2963,6 @@ void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags) mDisabledItems.push_back(std::string("New Body Parts")); } - // clear out old menu and folder pointers - mMenu.markDead(); - sSelf.markDead(); - if(trash_id == mUUID) { // This is the trash. @@ -3185,45 +3065,134 @@ void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags) } } +void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) +{ + // Build folder specific options back up + LLInventoryModel* model = getInventoryModel(); + if(!model) return; + + const LLInventoryCategory* category = model->getCategory(mUUID); + if(!category) return; + + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); + if (trash_id == mUUID) return; + if (isItemInTrash()) return; + if (!isAgentInventory()) return; + if (isOutboxFolder()) return; + + LLFolderType::EType type = category->getPreferredType(); + const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); + // BAP change once we're no longer treating regular categories as ensembles. + const bool is_ensemble = (type == LLFolderType::FT_NONE || + LLFolderType::lookupIsEnsembleType(type)); + + // Only enable calling-card related options for non-system folders. + if (!is_system_folder) + { + LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); + if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard)) + { + mItems.push_back(std::string("Calling Card Separator")); + mItems.push_back(std::string("Conference Chat Folder")); + mItems.push_back(std::string("IM All Contacts In Folder")); + } + } + + if (!isItemRemovable()) + { + mDisabledItems.push_back(std::string("Delete")); + } + +#ifndef LL_RELEASE_FOR_DOWNLOAD + if (LLFolderType::lookupIsProtectedType(type)) + { + mItems.push_back(std::string("Delete System Folder")); + } +#endif + + // wearables related functionality for folders. + //is_wearable + LLFindWearables is_wearable; + LLIsType is_object( LLAssetType::AT_OBJECT ); + LLIsType is_gesture( LLAssetType::AT_GESTURE ); + + if (mWearables || + checkFolderForContentsOfType(model, is_wearable) || + checkFolderForContentsOfType(model, is_object) || + checkFolderForContentsOfType(model, is_gesture) ) + { + mItems.push_back(std::string("Folder Wearables Separator")); + + // Only enable add/replace outfit for non-system folders. + if (!is_system_folder) + { + // Adding an outfit onto another (versus replacing) doesn't make sense. + if (type != LLFolderType::FT_OUTFIT) + { + mItems.push_back(std::string("Add To Outfit")); + } + + mItems.push_back(std::string("Replace Outfit")); + } + if (is_ensemble) + { + mItems.push_back(std::string("Wear As Ensemble")); + } + mItems.push_back(std::string("Remove From Outfit")); + if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID)) + { + mDisabledItems.push_back(std::string("Remove From Outfit")); + } + if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) + { + mDisabledItems.push_back(std::string("Replace Outfit")); + } + mItems.push_back(std::string("Outfit Separator")); + } +} + // Flags unused void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { + sSelf.markDead(); + mItems.clear(); mDisabledItems.clear(); - mContextMenuFlags = flags; lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; LLInventoryModel* model = getInventoryModel(); if(!model) return; - buildContextMenuBaseOptions(menu, flags); - - hide_context_entries(menu, mItems, mDisabledItems); + buildContextMenuBaseOptions(flags); // Add menu items that are dependent on the contents of the folder. - uuid_vec_t folders; - LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); + LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID); if (category) { + uuid_vec_t folders; folders.push_back(category->getUUID()); - } - mMenu = menu.getHandle(); - sSelf = getHandle(); - LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); - fetch->startFetch(); - inc_busy_count(); - if(fetch->isFinished()) - { - // everything is already here - call done. - fetch->done(); - } - else - { - // it's all on its way - add an observer, and the inventory will call done for us when everything is here. - gInventory.addObserver(fetch); + sSelf = getHandle(); + LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); + fetch->startFetch(); + inc_busy_count(); + if (fetch->isFinished()) + { + buildContextMenuFolderOptions(flags); + } + else + { + // it's all on its way - add an observer, and the inventory will call done for us when everything is here. + gInventory.addObserver(fetch); + } } + + hide_context_entries(menu, mItems, mDisabledItems); + + // Reposition the menu, in case we're adding items to an existing menu. + menu.needsArrange(); + menu.arrangeAndClear(); } BOOL LLFolderBridge::hasChildren() const diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 56301ce728..871657a58a 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -235,8 +235,7 @@ public: const LLUUID& uuid) : LLInvFVBridge(inventory, root, uuid), mCallingCards(FALSE), - mWearables(FALSE), - mContextMenuFlags(0x0) + mWearables(FALSE) {} BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg); @@ -283,7 +282,8 @@ public: LLHandle getHandle() { mHandle.bind(this); return mHandle; } protected: - void buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags); + void buildContextMenuBaseOptions(U32 flags); + void buildContextMenuFolderOptions(U32 flags); //-------------------------------------------------------------------- // Menu callbacks @@ -320,15 +320,12 @@ protected: public: static LLHandle sSelf; static void staticFolderOptionsMenu(); - void folderOptionsMenuAfterFetch(); private: BOOL mCallingCards; BOOL mWearables; - LLHandle mMenu; menuentry_vec_t mItems; menuentry_vec_t mDisabledItems; - U32 mContextMenuFlags; LLRootHandle mHandle; }; -- cgit v1.2.3 From 507e136f9a25179992b2093e10ade1093cc71698 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 23 Jan 2012 16:24:33 -0500 Subject: Per Richard: close unusable Job Object; move quote() to LLStringUtil. If LLProcess can't set the right flag on a Windows Job Object, the object isn't useful to us, so we might as well discard it. quote() is sufficiently general that it belongs in LLStringUtil instead of buried as a static helper function in llprocess.cpp. --- indra/llcommon/llprocess.cpp | 49 +++------- indra/llcommon/llstring.h | 223 +++++++++++++++++++++++++------------------ 2 files changed, 141 insertions(+), 131 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index eb7ce4129b..2c7512419d 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -28,6 +28,7 @@ #include "llprocess.h" #include "llsdserialize.h" #include "llsingleton.h" +#include "llstring.h" #include "stringize.h" #include @@ -102,7 +103,6 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) #if LL_WINDOWS static std::string WindowsErrorString(const std::string& operation); -static std::string quote(const std::string&); /** * Wrap a Windows Job Object for use in managing child-process lifespan. @@ -157,6 +157,10 @@ private: if (! SetInformationJobObject(mJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) { LL_WARNS("LLProcess") << WindowsErrorString("SetInformationJobObject()") << LL_ENDL; + // This Job Object is useless to us + CloseHandle(mJob); + // prevent assignProcess() from trying to use it + mJob = 0; } } @@ -168,11 +172,17 @@ void LLProcess::launch(const LLSDParamAdapter& params) PROCESS_INFORMATION pinfo; STARTUPINFOA sinfo = { sizeof(sinfo) }; - std::string args = quote(params.executable); + // LLProcess::create()'s caller passes a Unix-style array of strings for + // command-line arguments. Our caller can and should expect that these will be + // passed to the child process as individual arguments, regardless of content + // (e.g. embedded spaces). But because Windows invokes any child process with + // a single command-line string, this means we must quote each argument behind + // the scenes. + std::string args = LLStringUtil::quote(params.executable); BOOST_FOREACH(const std::string& arg, params.args) { args += " "; - args += quote(arg); + args += LLStringUtil::quote(arg); } // So retarded. Windows requires that the second parameter to @@ -236,39 +246,6 @@ bool LLProcess::kill(void) return ! isRunning(); } -/** - * Double-quote an argument string, unless it's already double-quoted. If we - * quote it, escape any embedded double-quote with backslash. - * - * LLProcess::create()'s caller passes a Unix-style array of strings for - * command-line arguments. Our caller can and should expect that these will be - * passed to the child process as individual arguments, regardless of content - * (e.g. embedded spaces). But because Windows invokes any child process with - * a single command-line string, this means we must quote each argument behind - * the scenes. - */ -static std::string quote(const std::string& str) -{ - std::string::size_type len(str.length()); - // If the string is already quoted, assume user knows what s/he's doing. - if (len >= 2 && str[0] == '"' && str[len-1] == '"') - { - return str; - } - - // Not already quoted: do it. - std::string result("\""); - for (std::string::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) - { - if (*ci == '"') - { - result.append("\\"); - } - result.push_back(*ci); - } - return result + "\""; -} - /// GetLastError()/FormatMessage() boilerplate static std::string WindowsErrorString(const std::string& operation) { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 7e41e787b5..d3f1d01aa2 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -237,40 +237,41 @@ private: static std::string sLocale; public: - typedef typename std::basic_string::size_type size_type; + typedef std::basic_string string_type; + typedef typename string_type::size_type size_type; public: ///////////////////////////////////////////////////////////////////////////////////////// // Static Utility functions that operate on std::strings - static const std::basic_string null; + static const string_type null; typedef std::map format_map_t; - LL_COMMON_API static void getTokens(const std::basic_string& instr, std::vector >& tokens, const std::basic_string& delims); - LL_COMMON_API static void formatNumber(std::basic_string& numStr, std::basic_string decimals); - LL_COMMON_API static bool formatDatetime(std::basic_string& replacement, std::basic_string token, std::basic_string param, S32 secFromEpoch); - LL_COMMON_API static S32 format(std::basic_string& s, const format_map_t& substitutions); - LL_COMMON_API static S32 format(std::basic_string& s, const LLSD& substitutions); - LL_COMMON_API static bool simpleReplacement(std::basic_string& replacement, std::basic_string token, const format_map_t& substitutions); - LL_COMMON_API static bool simpleReplacement(std::basic_string& replacement, std::basic_string token, const LLSD& substitutions); + LL_COMMON_API static void getTokens(const string_type& instr, std::vector& tokens, const string_type& delims); + LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals); + LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch); + LL_COMMON_API static S32 format(string_type& s, const format_map_t& substitutions); + LL_COMMON_API static S32 format(string_type& s, const LLSD& substitutions); + LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const format_map_t& substitutions); + LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const LLSD& substitutions); LL_COMMON_API static void setLocale (std::string inLocale); LL_COMMON_API static std::string getLocale (void); - static bool isValidIndex(const std::basic_string& string, size_type i) + static bool isValidIndex(const string_type& string, size_type i) { return !string.empty() && (0 <= i) && (i <= string.size()); } - static void trimHead(std::basic_string& string); - static void trimTail(std::basic_string& string); - static void trim(std::basic_string& string) { trimHead(string); trimTail(string); } - static void truncate(std::basic_string& string, size_type count); + static void trimHead(string_type& string); + static void trimTail(string_type& string); + static void trim(string_type& string) { trimHead(string); trimTail(string); } + static void truncate(string_type& string, size_type count); - static void toUpper(std::basic_string& string); - static void toLower(std::basic_string& string); + static void toUpper(string_type& string); + static void toLower(string_type& string); // True if this is the head of s. - static BOOL isHead( const std::basic_string& string, const T* s ); + static BOOL isHead( const string_type& string, const T* s ); /** * @brief Returns true if string starts with substr @@ -278,8 +279,8 @@ public: * If etither string or substr are empty, this method returns false. */ static bool startsWith( - const std::basic_string& string, - const std::basic_string& substr); + const string_type& string, + const string_type& substr); /** * @brief Returns true if string ends in substr @@ -287,19 +288,26 @@ public: * If etither string or substr are empty, this method returns false. */ static bool endsWith( - const std::basic_string& string, - const std::basic_string& substr); + const string_type& string, + const string_type& substr); - static void addCRLF(std::basic_string& string); - static void removeCRLF(std::basic_string& string); + static void addCRLF(string_type& string); + static void removeCRLF(string_type& string); - static void replaceTabsWithSpaces( std::basic_string& string, size_type spaces_per_tab ); - static void replaceNonstandardASCII( std::basic_string& string, T replacement ); - static void replaceChar( std::basic_string& string, T target, T replacement ); - static void replaceString( std::basic_string& string, std::basic_string target, std::basic_string replacement ); + static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab ); + static void replaceNonstandardASCII( string_type& string, T replacement ); + static void replaceChar( string_type& string, T target, T replacement ); + static void replaceString( string_type& string, string_type target, string_type replacement ); - static BOOL containsNonprintable(const std::basic_string& string); - static void stripNonprintable(std::basic_string& string); + static BOOL containsNonprintable(const string_type& string); + static void stripNonprintable(string_type& string); + + /** + * Double-quote an argument string, unless it's already double-quoted. If we + * quote it, escape any embedded double-quote with the escape string (default + * backslash). + */ + string_type quote(const string_type& str, const string_type& escape="\\"); /** * @brief Unsafe way to make ascii characters. You should probably @@ -308,18 +316,18 @@ public: * The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII * should work. */ - static void _makeASCII(std::basic_string& string); + static void _makeASCII(string_type& string); // Conversion to other data types - static BOOL convertToBOOL(const std::basic_string& string, BOOL& value); - static BOOL convertToU8(const std::basic_string& string, U8& value); - static BOOL convertToS8(const std::basic_string& string, S8& value); - static BOOL convertToS16(const std::basic_string& string, S16& value); - static BOOL convertToU16(const std::basic_string& string, U16& value); - static BOOL convertToU32(const std::basic_string& string, U32& value); - static BOOL convertToS32(const std::basic_string& string, S32& value); - static BOOL convertToF32(const std::basic_string& string, F32& value); - static BOOL convertToF64(const std::basic_string& string, F64& value); + static BOOL convertToBOOL(const string_type& string, BOOL& value); + static BOOL convertToU8(const string_type& string, U8& value); + static BOOL convertToS8(const string_type& string, S8& value); + static BOOL convertToS16(const string_type& string, S16& value); + static BOOL convertToU16(const string_type& string, U16& value); + static BOOL convertToU32(const string_type& string, U32& value); + static BOOL convertToS32(const string_type& string, S32& value); + static BOOL convertToF32(const string_type& string, F32& value); + static BOOL convertToF64(const string_type& string, F64& value); ///////////////////////////////////////////////////////////////////////////////////////// // Utility functions for working with char*'s and strings @@ -327,24 +335,24 @@ public: // Like strcmp but also handles empty strings. Uses // current locale. static S32 compareStrings(const T* lhs, const T* rhs); - static S32 compareStrings(const std::basic_string& lhs, const std::basic_string& rhs); + static S32 compareStrings(const string_type& lhs, const string_type& rhs); // case insensitive version of above. Uses current locale on // Win32, and falls back to a non-locale aware comparison on // Linux. static S32 compareInsensitive(const T* lhs, const T* rhs); - static S32 compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs); + static S32 compareInsensitive(const string_type& lhs, const string_type& rhs); // Case sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() - static S32 compareDict(const std::basic_string& a, const std::basic_string& b); + static S32 compareDict(const string_type& a, const string_type& b); // Case *in*sensitive comparison with good handling of numbers. Does not use current locale. // a.k.a. strdictcmp() - static S32 compareDictInsensitive(const std::basic_string& a, const std::basic_string& b); + static S32 compareDictInsensitive(const string_type& a, const string_type& b); // Puts compareDict() in a form appropriate for LL container classes to use for sorting. - static BOOL precedesDict( const std::basic_string& a, const std::basic_string& b ); + static BOOL precedesDict( const string_type& a, const string_type& b ); // A replacement for strncpy. // If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds @@ -352,7 +360,7 @@ public: static void copy(T* dst, const T* src, size_type dst_size); // Copies src into dst at a given offset. - static void copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset); + static void copyInto(string_type& dst, const string_type& src, size_type offset); static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); } @@ -362,7 +370,7 @@ public: #endif private: - LL_COMMON_API static size_type getSubstitution(const std::basic_string& instr, size_type& start, std::vector >& tokens); + LL_COMMON_API static size_type getSubstitution(const string_type& instr, size_type& start, std::vector& tokens); }; template const std::basic_string LLStringUtilBase::null; @@ -669,7 +677,7 @@ S32 LLStringUtilBase::compareStrings(const T* lhs, const T* rhs) //static template -S32 LLStringUtilBase::compareStrings(const std::basic_string& lhs, const std::basic_string& rhs) +S32 LLStringUtilBase::compareStrings(const string_type& lhs, const string_type& rhs) { return LLStringOps::collate(lhs.c_str(), rhs.c_str()); } @@ -695,8 +703,8 @@ S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) } else { - std::basic_string lhs_string(lhs); - std::basic_string rhs_string(rhs); + string_type lhs_string(lhs); + string_type rhs_string(rhs); LLStringUtilBase::toUpper(lhs_string); LLStringUtilBase::toUpper(rhs_string); result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); @@ -706,10 +714,10 @@ S32 LLStringUtilBase::compareInsensitive(const T* lhs, const T* rhs ) //static template -S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, const std::basic_string& rhs) +S32 LLStringUtilBase::compareInsensitive(const string_type& lhs, const string_type& rhs) { - std::basic_string lhs_string(lhs); - std::basic_string rhs_string(rhs); + string_type lhs_string(lhs); + string_type rhs_string(rhs); LLStringUtilBase::toUpper(lhs_string); LLStringUtilBase::toUpper(rhs_string); return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str()); @@ -720,7 +728,7 @@ S32 LLStringUtilBase::compareInsensitive(const std::basic_string& lhs, con //static template -S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDict(const string_type& astr, const string_type& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -761,7 +769,7 @@ S32 LLStringUtilBase::compareDict(const std::basic_string& astr, const std // static template -S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr, const std::basic_string& bstr) +S32 LLStringUtilBase::compareDictInsensitive(const string_type& astr, const string_type& bstr) { const T* a = astr.c_str(); const T* b = bstr.c_str(); @@ -796,7 +804,7 @@ S32 LLStringUtilBase::compareDictInsensitive(const std::basic_string& astr // Puts compareDict() in a form appropriate for LL container classes to use for sorting. // static template -BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std::basic_string& b ) +BOOL LLStringUtilBase::precedesDict( const string_type& a, const string_type& b ) { if( a.size() && b.size() ) { @@ -810,7 +818,7 @@ BOOL LLStringUtilBase::precedesDict( const std::basic_string& a, const std //static template -void LLStringUtilBase::toUpper(std::basic_string& string) +void LLStringUtilBase::toUpper(string_type& string) { if( !string.empty() ) { @@ -824,7 +832,7 @@ void LLStringUtilBase::toUpper(std::basic_string& string) //static template -void LLStringUtilBase::toLower(std::basic_string& string) +void LLStringUtilBase::toLower(string_type& string) { if( !string.empty() ) { @@ -838,7 +846,7 @@ void LLStringUtilBase::toLower(std::basic_string& string) //static template -void LLStringUtilBase::trimHead(std::basic_string& string) +void LLStringUtilBase::trimHead(string_type& string) { if( !string.empty() ) { @@ -853,7 +861,7 @@ void LLStringUtilBase::trimHead(std::basic_string& string) //static template -void LLStringUtilBase::trimTail(std::basic_string& string) +void LLStringUtilBase::trimTail(string_type& string) { if( string.size() ) { @@ -872,7 +880,7 @@ void LLStringUtilBase::trimTail(std::basic_string& string) // Replace line feeds with carriage return-line feed pairs. //static template -void LLStringUtilBase::addCRLF(std::basic_string& string) +void LLStringUtilBase::addCRLF(string_type& string) { const T LF = 10; const T CR = 13; @@ -914,7 +922,7 @@ void LLStringUtilBase::addCRLF(std::basic_string& string) // Remove all carriage returns //static template -void LLStringUtilBase::removeCRLF(std::basic_string& string) +void LLStringUtilBase::removeCRLF(string_type& string) { const T CR = 13; @@ -935,10 +943,10 @@ void LLStringUtilBase::removeCRLF(std::basic_string& string) //static template -void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T replacement ) +void LLStringUtilBase::replaceChar( string_type& string, T target, T replacement ) { size_type found_pos = 0; - while( (found_pos = string.find(target, found_pos)) != std::basic_string::npos ) + while( (found_pos = string.find(target, found_pos)) != string_type::npos ) { string[found_pos] = replacement; found_pos++; // avoid infinite defeat if target == replacement @@ -947,10 +955,10 @@ void LLStringUtilBase::replaceChar( std::basic_string& string, T target, T //static template -void LLStringUtilBase::replaceString( std::basic_string& string, std::basic_string target, std::basic_string replacement ) +void LLStringUtilBase::replaceString( string_type& string, string_type target, string_type replacement ) { size_type found_pos = 0; - while( (found_pos = string.find(target, found_pos)) != std::basic_string::npos ) + while( (found_pos = string.find(target, found_pos)) != string_type::npos ) { string.replace( found_pos, target.length(), replacement ); found_pos += replacement.length(); // avoid infinite defeat if replacement contains target @@ -959,7 +967,7 @@ void LLStringUtilBase::replaceString( std::basic_string& string, std::basi //static template -void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, T replacement ) +void LLStringUtilBase::replaceNonstandardASCII( string_type& string, T replacement ) { const char LF = 10; const S8 MIN = 32; @@ -979,12 +987,12 @@ void LLStringUtilBase::replaceNonstandardASCII( std::basic_string& string, //static template -void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size_type spaces_per_tab ) +void LLStringUtilBase::replaceTabsWithSpaces( string_type& str, size_type spaces_per_tab ) { const T TAB = '\t'; const T SPACE = ' '; - std::basic_string out_str; + string_type out_str; // Replace tabs with spaces for (size_type i = 0; i < str.length(); i++) { @@ -1003,7 +1011,7 @@ void LLStringUtilBase::replaceTabsWithSpaces( std::basic_string& str, size //static template -BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& string) +BOOL LLStringUtilBase::containsNonprintable(const string_type& string) { const char MIN = 32; BOOL rv = FALSE; @@ -1020,7 +1028,7 @@ BOOL LLStringUtilBase::containsNonprintable(const std::basic_string& strin //static template -void LLStringUtilBase::stripNonprintable(std::basic_string& string) +void LLStringUtilBase::stripNonprintable(string_type& string) { const char MIN = 32; size_type j = 0; @@ -1051,8 +1059,33 @@ void LLStringUtilBase::stripNonprintable(std::basic_string& string) delete []c_string; } +template +std::basic_string LLStringUtilBase::quote(const string_type& str, const string_type& escape) +{ + size_type len(str.length()); + // If the string is already quoted, assume user knows what s/he's doing. + if (len >= 2 && str[0] == '"' && str[len-1] == '"') + { + return str; + } + + // Not already quoted: do it. + string_type result; + result.push_back('"'); + for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) + { + if (*ci == '"') + { + result.append(escape); + } + result.push_back(*ci); + } + result.push_back('"'); + return result; +} + template -void LLStringUtilBase::_makeASCII(std::basic_string& string) +void LLStringUtilBase::_makeASCII(string_type& string) { // Replace non-ASCII chars with LL_UNKNOWN_CHAR for (size_type i = 0; i < string.length(); i++) @@ -1082,7 +1115,7 @@ void LLStringUtilBase::copy( T* dst, const T* src, size_type dst_size ) // static template -void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_string& src, size_type offset) +void LLStringUtilBase::copyInto(string_type& dst, const string_type& src, size_type offset) { if ( offset == dst.length() ) { @@ -1092,7 +1125,7 @@ void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_s } else { - std::basic_string tail = dst.substr(offset); + string_type tail = dst.substr(offset); dst = dst.substr(0, offset); dst += src; @@ -1103,7 +1136,7 @@ void LLStringUtilBase::copyInto(std::basic_string& dst, const std::basic_s // True if this is the head of s. //static template -BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s ) +BOOL LLStringUtilBase::isHead( const string_type& string, const T* s ) { if( string.empty() ) { @@ -1119,8 +1152,8 @@ BOOL LLStringUtilBase::isHead( const std::basic_string& string, const T* s // static template bool LLStringUtilBase::startsWith( - const std::basic_string& string, - const std::basic_string& substr) + const string_type& string, + const string_type& substr) { if(string.empty() || (substr.empty())) return false; if(0 == string.find(substr)) return true; @@ -1130,8 +1163,8 @@ bool LLStringUtilBase::startsWith( // static template bool LLStringUtilBase::endsWith( - const std::basic_string& string, - const std::basic_string& substr) + const string_type& string, + const string_type& substr) { if(string.empty() || (substr.empty())) return false; std::string::size_type idx = string.rfind(substr); @@ -1141,14 +1174,14 @@ bool LLStringUtilBase::endsWith( template -BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL& value) +BOOL LLStringUtilBase::convertToBOOL(const string_type& string, BOOL& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); if( (temp == "1") || @@ -1178,7 +1211,7 @@ BOOL LLStringUtilBase::convertToBOOL(const std::basic_string& string, BOOL } template -BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& value) +BOOL LLStringUtilBase::convertToU8(const string_type& string, U8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1191,7 +1224,7 @@ BOOL LLStringUtilBase::convertToU8(const std::basic_string& string, U8& va } template -BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& value) +BOOL LLStringUtilBase::convertToS8(const string_type& string, S8& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1204,7 +1237,7 @@ BOOL LLStringUtilBase::convertToS8(const std::basic_string& string, S8& va } template -BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& value) +BOOL LLStringUtilBase::convertToS16(const string_type& string, S16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1217,7 +1250,7 @@ BOOL LLStringUtilBase::convertToS16(const std::basic_string& string, S16& } template -BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& value) +BOOL LLStringUtilBase::convertToU16(const string_type& string, U16& value) { S32 value32 = 0; BOOL success = convertToS32(string, value32); @@ -1230,17 +1263,17 @@ BOOL LLStringUtilBase::convertToU16(const std::basic_string& string, U16& } template -BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& value) +BOOL LLStringUtilBase::convertToU32(const string_type& string, U32& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); U32 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { value = v; @@ -1250,17 +1283,17 @@ BOOL LLStringUtilBase::convertToU32(const std::basic_string& string, U32& } template -BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& value) +BOOL LLStringUtilBase::convertToS32(const string_type& string, S32& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); S32 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { //TODO: figure out overflow and underflow reporting here @@ -1277,7 +1310,7 @@ BOOL LLStringUtilBase::convertToS32(const std::basic_string& string, S32& } template -BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& value) +BOOL LLStringUtilBase::convertToF32(const string_type& string, F32& value) { F64 value64 = 0.0; BOOL success = convertToF64(string, value64); @@ -1290,17 +1323,17 @@ BOOL LLStringUtilBase::convertToF32(const std::basic_string& string, F32& } template -BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& value) +BOOL LLStringUtilBase::convertToF64(const string_type& string, F64& value) { if( string.empty() ) { return FALSE; } - std::basic_string temp( string ); + string_type temp( string ); trim(temp); F64 v; - std::basic_istringstream i_stream((std::basic_string)temp); + std::basic_istringstream i_stream((string_type)temp); if(i_stream >> v) { //TODO: figure out overflow and underflow reporting here @@ -1317,7 +1350,7 @@ BOOL LLStringUtilBase::convertToF64(const std::basic_string& string, F64& } template -void LLStringUtilBase::truncate(std::basic_string& string, size_type count) +void LLStringUtilBase::truncate(string_type& string, size_type count) { size_type cur_size = string.size(); string.resize(count < cur_size ? count : cur_size); -- cgit v1.2.3 From ca9f000289f93068386835d7040e5a574507f859 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 23 Jan 2012 13:40:20 -0800 Subject: * Optimization to not waste some time doing std::string assignment all over the graphics code. Reviewed by davep. --- indra/newview/pipeline.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index df8f8793d1..50adbad140 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1217,10 +1217,12 @@ void LLPipeline::restoreGL() BOOL LLPipeline::canUseVertexShaders() { + static const std::string vertex_shader_enable_feature_string = "VertexShaderEnable"; + if (sDisableShaders || !gGLManager.mHasVertexShader || !gGLManager.mHasFragmentShader || - !LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || + !LLFeatureManager::getInstance()->isFeatureAvailable(vertex_shader_enable_feature_string) || (assertInitialized() && mVertexShadersLoaded != 1) ) { return FALSE; -- cgit v1.2.3 From 199e875210435cbc914e80bf3eb6be6c985fce1c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 23 Jan 2012 17:04:18 -0500 Subject: Use LLProcess::Params::args::empty() instead of comparing iterators. --- indra/newview/llexternaleditor.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 561b87618c..db482f023e 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -81,10 +81,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) { - // LLInitParams type wrappers don't seem to have empty() or size() - // methods; try determining emptiness by comparing begin/end iterators. - if (std::string(mProcessParams.executable).empty() || - (mProcessParams.args.begin() == mProcessParams.args.end())) + if (std::string(mProcessParams.executable).empty() || mProcessParams.args.empty()) { llwarns << "Editor command not set" << llendl; return EC_NOT_SPECIFIED; -- cgit v1.2.3 From da5d243c8f76f43a6bb4000402fade76eee0be33 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 23 Jan 2012 17:29:42 -0500 Subject: LLStringUtil methods are conventionally static. --- indra/llcommon/llstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index d3f1d01aa2..4c3936f9ab 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -307,7 +307,7 @@ public: * quote it, escape any embedded double-quote with the escape string (default * backslash). */ - string_type quote(const string_type& str, const string_type& escape="\\"); + static string_type quote(const string_type& str, const string_type& escape="\\"); /** * @brief Unsafe way to make ascii characters. You should probably -- cgit v1.2.3 From 61e98256df80822f9504a2037d5cbb029c39506d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 23 Jan 2012 17:38:06 -0500 Subject: Clarify that items in LLProcess::Params::args are implicitly quoted. That is, we try to pass through each args entry as a separate child-process arvg[] entry, whitespace and all. --- indra/llcommon/llprocess.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 019c33592c..51c42582ea 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -63,7 +63,16 @@ public: /// pathname of executable Mandatory executable; - /// zero or more additional command-line arguments + /** + * zero or more additional command-line arguments. Arguments are + * passed through as exactly as we can manage, whitespace and all. + * @note On Windows we manage this by implicitly double-quoting each + * argument while assembling the command line. BUT if a given argument + * is already double-quoted, we don't double-quote it again. Try to + * avoid making use of this, though, as on Mac and Linux explicitly + * double-quoted args will be passed to the child process including + * the double quotes. + */ Multiple args; /// current working directory, if need it changed Optional cwd; -- cgit v1.2.3 From 83ca425158fb56cab08c8a44ddad93ca222e58d7 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 23 Jan 2012 15:34:01 -0800 Subject: Reverting rev 22217 changes to background fetch so search and recent will fully fetch user inventory --- indra/newview/llinventorymodelbackgroundfetch.cpp | 328 +++++++--------------- indra/newview/llinventorymodelbackgroundfetch.h | 16 +- 2 files changed, 115 insertions(+), 229 deletions(-) diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 5f0c744192..91fdd67806 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -50,7 +50,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() : mMinTimeBetweenFetches(0.3f), mMaxTimeBetweenFetches(10.f), mTimelyFetchPending(FALSE), - mFetchCount(0) + mBulkFetchCount(0) { } @@ -60,7 +60,7 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const { - return mFetchQueue.empty() && mFetchCount<=0; + return mFetchQueue.empty() && mBulkFetchCount<=0; } bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const @@ -103,60 +103,44 @@ BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() const return mBackgroundFetchActive; } -void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive) +void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive) { - if (id.isNull()) return; + if (!mAllFoldersFetched || cat_id.notNull()) + { + LL_DEBUGS("InventoryFetch") << "Start fetching category: " << cat_id << ", recursive: " << recursive << LL_ENDL; - LLViewerInventoryCategory* cat = gInventory.getCategory(id); - if (cat) - { // it's a folder, do a bulk fetch - if (!mAllFoldersFetched) + mBackgroundFetchActive = TRUE; + if (cat_id.isNull()) { - LL_DEBUGS("InventoryFetch") << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL; - - mBackgroundFetchActive = TRUE; - if (id.isNull()) + if (!mRecursiveInventoryFetchStarted) { - if (!mRecursiveInventoryFetchStarted) - { - mRecursiveInventoryFetchStarted |= recursive; - mFetchQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursive)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); - } - if (!mRecursiveLibraryFetchStarted) - { - mRecursiveLibraryFetchStarted |= recursive; - mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursive)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); - } + mRecursiveInventoryFetchStarted |= recursive; + mFetchQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursive)); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } - else + if (!mRecursiveLibraryFetchStarted) { - // Specific folder requests go to front of queue. - if (mFetchQueue.empty() || mFetchQueue.front().mUUID != id) - { - mFetchQueue.push_front(FetchQueueInfo(id, recursive)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); - } - if (id == gInventory.getLibraryRootFolderID()) - { - mRecursiveLibraryFetchStarted |= recursive; - } - if (id == gInventory.getRootFolderID()) - { - mRecursiveInventoryFetchStarted |= recursive; - } + mRecursiveLibraryFetchStarted |= recursive; + mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursive)); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } } - } - else if (LLViewerInventoryItem* itemp = gInventory.getItem(id)) - { - if (!itemp->mIsComplete && (mFetchQueue.empty() || mFetchQueue.front().mUUID != id)) + else { - mBackgroundFetchActive = TRUE; - - mFetchQueue.push_front(FetchQueueInfo(id, false, false)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + // Specific folder requests go to front of queue. + if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id) + { + mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive)); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + } + if (cat_id == gInventory.getLibraryRootFolderID()) + { + mRecursiveLibraryFetchStarted |= recursive; + } + if (cat_id == gInventory.getRootFolderID()) + { + mRecursiveInventoryFetchStarted |= recursive; + } } } } @@ -174,7 +158,7 @@ void LLInventoryModelBackgroundFetch::stopBackgroundFetch() { mBackgroundFetchActive = FALSE; gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); - mFetchCount=0; + mBulkFetchCount=0; mMinTimeBetweenFetches=0.0f; } } @@ -199,9 +183,10 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() if (mBackgroundFetchActive && gAgent.getRegion()) { // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - if (gSavedSettings.getBOOL("UseHTTPInventory")) + std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2"); + if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty()) { - bulkFetch(); + bulkFetch(url); return; } @@ -245,7 +230,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() } const FetchQueueInfo info = mFetchQueue.front(); - LLViewerInventoryCategory* cat = gInventory.getCategory(info.mUUID); + LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID); // Category has been deleted, remove from queue. if (!cat) @@ -273,7 +258,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() } } // Do I have all my children? - else if (gInventory.isCategoryComplete(info.mUUID)) + else if (gInventory.isCategoryComplete(info.mCatUUID)) { // Finished with this category, remove from queue. mFetchQueue.pop_front(); @@ -328,35 +313,15 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() } } -void LLInventoryModelBackgroundFetch::incrFetchCount(S16 fetching) +void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) { - mFetchCount += fetching; - if (mFetchCount < 0) + mBulkFetchCount += fetching; + if (mBulkFetchCount < 0) { - mFetchCount = 0; + mBulkFetchCount = 0; } } -class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInventoryResponder -{ -public: - LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); -}; - -void LLInventoryModelFetchItemResponder::result( const LLSD& content ) -{ - LLInventoryModel::fetchInventoryResponder::result(content); - LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); -} - -void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& reason ) -{ - LLInventoryModel::fetchInventoryResponder::error(status, reason); - LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); -} - class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder { @@ -493,7 +458,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) } } - fetcher->incrFetchCount(-1); + fetcher->incrBulkFetch(-1); if (fetcher->isBulkFetchProcessingComplete()) { @@ -512,7 +477,7 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str llinfos << "LLInventoryModelFetchDescendentsResponder::error " << status << ": " << reason << llendl; - fetcher->incrFetchCount(-1); + fetcher->incrBulkFetch(-1); if (status==499) // timed out { @@ -543,14 +508,12 @@ BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat // Bundle up a bunch of requests to send all at once. // static -void LLInventoryModelBackgroundFetch::bulkFetch() +void LLInventoryModelBackgroundFetch::bulkFetch(std::string url) { //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was //sent. If it exceeds our retry time, go ahead and fire off another batch. //Stopbackgroundfetch will be run from the Responder instead of here. - LLViewerRegion* region = gAgent.getRegion(); - if (!region) return; S16 max_concurrent_fetches=8; F32 new_min_time = 0.5f; //HACK! Clean this up when old code goes away entirely. @@ -560,13 +523,12 @@ void LLInventoryModelBackgroundFetch::bulkFetch() } if (gDisconnected || - (mFetchCount > max_concurrent_fetches) || + (mBulkFetchCount > max_concurrent_fetches) || (mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches)) { return; // just bail if we are disconnected } - U32 item_count=0; U32 folder_count=0; U32 max_batch_size=5; @@ -574,159 +536,83 @@ void LLInventoryModelBackgroundFetch::bulkFetch() uuid_vec_t recursive_cats; - LLSD folder_request_body; - LLSD folder_request_body_lib; - LLSD item_request_body; - LLSD item_request_body_lib; + LLSD body; + LLSD body_lib; - while (!(mFetchQueue.empty()) && ((item_count + folder_count) < max_batch_size)) + while (!(mFetchQueue.empty()) && (folder_count < max_batch_size)) { const FetchQueueInfo& fetch_info = mFetchQueue.front(); - if (fetch_info.mIsCategory) - { - - const LLUUID &cat_id = fetch_info.mUUID; - if (cat_id.isNull()) //DEV-17797 - { - LLSD folder_sd; - folder_sd["folder_id"] = LLUUID::null.asString(); - folder_sd["owner_id"] = gAgent.getID(); - folder_sd["sort_order"] = (LLSD::Integer)sort_order; - folder_sd["fetch_folders"] = (LLSD::Boolean)FALSE; - folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; - folder_request_body["folders"].append(folder_sd); - folder_count++; - } - else - { - const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + const LLUUID &cat_id = fetch_info.mCatUUID; + if (cat_id.isNull()) //DEV-17797 + { + LLSD folder_sd; + folder_sd["folder_id"] = LLUUID::null.asString(); + folder_sd["owner_id"] = gAgent.getID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = (LLSD::Boolean)FALSE; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + body["folders"].append(folder_sd); + folder_count++; + } + else + { + const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat) - { - if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) - { - LLSD folder_sd; - folder_sd["folder_id"] = cat->getUUID(); - folder_sd["owner_id"] = cat->getOwnerID(); - folder_sd["sort_order"] = (LLSD::Integer)sort_order; - folder_sd["fetch_folders"] = TRUE; //(LLSD::Boolean)sFullFetchStarted; - folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; + if (cat) + { + if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) + { + LLSD folder_sd; + folder_sd["folder_id"] = cat->getUUID(); + folder_sd["owner_id"] = cat->getOwnerID(); + folder_sd["sort_order"] = (LLSD::Integer)sort_order; + folder_sd["fetch_folders"] = TRUE; //(LLSD::Boolean)sFullFetchStarted; + folder_sd["fetch_items"] = (LLSD::Boolean)TRUE; - if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) - folder_request_body_lib["folders"].append(folder_sd); - else - folder_request_body["folders"].append(folder_sd); - folder_count++; - } - // May already have this folder, but append child folders to list. - if (fetch_info.mRecursive) - { - LLInventoryModel::cat_array_t* categories; - LLInventoryModel::item_array_t* items; - gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); - for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); - it != categories->end(); - ++it) - { - mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive)); - } - } - } - } - if (fetch_info.mRecursive) - recursive_cats.push_back(cat_id); - } - else - { - LLViewerInventoryItem* itemp = gInventory.getItem(fetch_info.mUUID); - if (itemp) - { - LLSD item_sd; - item_sd["owner_id"] = itemp->getPermissions().getOwner(); - item_sd["item_id"] = itemp->getUUID(); - if (itemp->getPermissions().getOwner() == gAgent.getID()) - { - item_request_body.append(item_sd); - } - else - { - item_request_body_lib.append(item_sd); - } - //itemp->fetchFromServer(); - item_count++; - } - } + if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) + body_lib["folders"].append(folder_sd); + else + body["folders"].append(folder_sd); + folder_count++; + } + // May already have this folder, but append child folders to list. + if (fetch_info.mRecursive) + { + LLInventoryModel::cat_array_t* categories; + LLInventoryModel::item_array_t* items; + gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); + it != categories->end(); + ++it) + { + mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive)); + } + } + } + } + if (fetch_info.mRecursive) + recursive_cats.push_back(cat_id); mFetchQueue.pop_front(); } - if (item_count + folder_count > 0) + if (folder_count > 0) { - if (folder_count) + mBulkFetchCount++; + if (body["folders"].size()) { - std::string url = region->getCapability("FetchInventoryDescendents2"); - mFetchCount++; - if (folder_request_body["folders"].size()) - { - LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats); - LLHTTPClient::post(url, folder_request_body, fetcher, 300.0); - } - if (folder_request_body_lib["folders"].size()) - { - std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2"); - - LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats); - LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher, 300.0); - } + LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body, recursive_cats); + LLHTTPClient::post(url, body, fetcher, 300.0); } - if (item_count) + if (body_lib["folders"].size()) { - std::string url; - - if (item_request_body.size()) - { - mFetchCount++; - url = region->getCapability("FetchInventory2"); - if (!url.empty()) - { - LLSD body; - body["agent_id"] = gAgent.getID(); - body["items"] = item_request_body; - - LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body)); - } - //else - //{ - // LLMessageSystem* msg = gMessageSystem; - // msg->newMessage("FetchInventory"); - // msg->nextBlock("AgentData"); - // msg->addUUID("AgentID", gAgent.getID()); - // msg->addUUID("SessionID", gAgent.getSessionID()); - // msg->nextBlock("InventoryData"); - // msg->addUUID("OwnerID", mPermissions.getOwner()); - // msg->addUUID("ItemID", mUUID); - // gAgent.sendReliableMessage(); - //} - } - - if (item_request_body_lib.size()) - { - mFetchCount++; - - url = region->getCapability("FetchLib2"); - if (!url.empty()) - { - LLSD body; - body["agent_id"] = gAgent.getID(); - body["items"] = item_request_body_lib; - - LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body)); - } - } + std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2"); + + LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats); + LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0); } mFetchTimer.reset(); } - else if (isBulkFetchProcessingComplete()) { setAllFoldersFetched(); @@ -738,7 +624,7 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL for (fetch_queue_t::const_iterator it = mFetchQueue.begin(); it != mFetchQueue.end(); ++it) { - const LLUUID& fetch_id = (*it).mUUID; + const LLUUID& fetch_id = (*it).mCatUUID; if (gInventory.isObjectDescendentOf(fetch_id, cat_id)) return false; } diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index 0745407a8c..c35c785ceb 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -60,10 +60,10 @@ public: bool inventoryFetchInProgress() const; void findLostItems(); - void incrFetchCount(S16 fetching); protected: + void incrBulkFetch(S16 fetching); bool isBulkFetchProcessingComplete() const; - void bulkFetch(); + void bulkFetch(std::string url); void backgroundFetch(); static void backgroundFetchCB(void*); // background fetch idle function @@ -77,7 +77,7 @@ private: BOOL mAllFoldersFetched; BOOL mBackgroundFetchActive; - S16 mFetchCount; + S16 mBulkFetchCount; BOOL mTimelyFetchPending; S32 mNumFetchRetries; @@ -87,11 +87,11 @@ private: struct FetchQueueInfo { - FetchQueueInfo(const LLUUID& id, BOOL recursive, bool is_category = true) : - mUUID(id), mRecursive(recursive), mIsCategory(is_category) - {} - LLUUID mUUID; - bool mIsCategory; + FetchQueueInfo(const LLUUID& id, BOOL recursive) : + mCatUUID(id), mRecursive(recursive) + { + } + LLUUID mCatUUID; BOOL mRecursive; }; typedef std::deque fetch_queue_t; -- cgit v1.2.3 From ea6cbc7b6b1de051a9bb1c311c4399a2b4d42cb3 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 23 Jan 2012 15:55:36 -0800 Subject: Reverting background fetch on an item to the old fetFromServer call to fix regression bug in inventory late loading --- indra/newview/llinventorybridge.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9e21e2fceb..c0065a94e6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1324,7 +1324,8 @@ void LLItemBridge::selectItem() LLViewerInventoryItem* item = static_cast(getItem()); if(item && !item->isFinished()) { - LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false); + item->fetchFromServer(); + //LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false); } } -- cgit v1.2.3 From e02f007d2013e089c07f3abefe2d87d85cbcc834 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 24 Jan 2012 12:59:18 -0600 Subject: SH-1427 Fix for spot lights not working properly on alpha objects, and fix for alpha lighting of point lights not matching deferred lights. --- indra/llrender/llrender.cpp | 2 +- .../app_settings/shaders/class1/deferred/alphaSkinnedV.glsl | 8 ++++---- indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | 9 ++++----- .../app_settings/shaders/class1/deferred/avatarAlphaV.glsl | 8 ++++---- .../app_settings/shaders/class2/deferred/alphaSkinnedV.glsl | 10 +++++----- indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl | 8 ++++---- .../app_settings/shaders/class2/deferred/avatarAlphaV.glsl | 8 ++++---- indra/newview/pipeline.cpp | 6 ++++-- 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index cd827f5091..f26764cc42 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -997,7 +997,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction) const glh::matrix4f& mat = gGL.getModelviewMatrix(); mat.mult_matrix_dir(dir); - mSpotDirection.set(direction); + mSpotDirection.set(dir.v); } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 0170ad4b55..40b0cf47ac 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -61,17 +61,17 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -79,7 +79,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 93b1a114db..8c96d55342 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -70,17 +70,17 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -88,7 +88,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; @@ -123,7 +123,6 @@ void main() col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); vary_pointlight_col = col.rgb*diffuse_color.rgb; - col.rgb = vec3(0,0,0); // Add windlight lights diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index d7b90978ba..c0edddc40a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -65,17 +65,17 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -83,7 +83,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index 5a3955ef00..83815b1786 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -63,21 +63,21 @@ uniform vec3 light_diffuse[8]; float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) { - //get light vector +//get light vector vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -85,7 +85,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 9540ddd2e8..1660f9687e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -69,17 +69,17 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -87,7 +87,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 9c7a332417..84c27edb26 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -66,17 +66,17 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa vec3 lv = lp.xyz-v; //get distance - float d = length(lv); + float d = dot(lv,lv); float da = 0.0; if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector - lv *= 1.0/d; + lv = normalize(lv); //distance attenuation - float dist2 = d*d/(la*la); + float dist2 = d/la; da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); // spotlight coefficient. @@ -84,7 +84,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= spot*spot; // GL_SPOT_EXPONENT=2 //angular attenuation - da *= calcDirectionalLight(n, lv); + da *= max(dot(n, lv), 0.0); } return da; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index df8f8793d1..38f9851929 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5297,7 +5297,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light_state->setConstantAttenuation(0.f); if (sRenderDeferred) { - light_state->setLinearAttenuation(light_radius*1.5f); + F32 size = light_radius*1.5f; + light_state->setLinearAttenuation(size*size); light_state->setQuadraticAttenuation(light->getLightFalloff()*0.5f+1.f); } else @@ -5319,7 +5320,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light_state->setSpotCutoff(90.f); light_state->setSpotExponent(2.f); - light_state->setSpecular(LLColor4::black); + const LLColor4 specular(0.f, 0.f, 0.f, 0.f); + light_state->setSpecular(specular); } else // omnidirectional (point) light { -- cgit v1.2.3 From 63398cd53158e683b12546f4cb2bfb27c78b77da Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 24 Jan 2012 17:37:20 -0600 Subject: SH-2791 Use request class constructor/destructor for keeping track of concurrent requests instead of unreliable increments/decrements sprinkled around the code. --- indra/newview/llmeshrepository.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 1d0c262190..03dc7f6bba 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -208,6 +208,12 @@ public: LLMeshHeaderResponder(const LLVolumeParams& mesh_params) : mMeshParams(mesh_params) { + LLMeshRepoThread::sActiveHeaderRequests++; + } + + ~LLMeshHeaderResponder() + { + LLMeshRepoThread::sActiveHeaderRequests--; } virtual void completedRaw(U32 status, const std::string& reason, @@ -227,6 +233,12 @@ public: LLMeshLODResponder(const LLVolumeParams& mesh_params, S32 lod, U32 offset, U32 requested_bytes) : mMeshParams(mesh_params), mLOD(lod), mOffset(offset), mRequestedBytes(requested_bytes) { + LLMeshRepoThread::sActiveLODRequests++; + } + + ~LLMeshLODResponder() + { + LLMeshRepoThread::sActiveLODRequests--; } virtual void completedRaw(U32 status, const std::string& reason, @@ -710,7 +722,6 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) { - ++sActiveLODRequests; LLMeshRepository::sHTTPRequestCount++; mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size, new LLMeshSkinInfoResponder(mesh_id, offset, size)); @@ -783,7 +794,6 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) { - ++sActiveLODRequests; LLMeshRepository::sHTTPRequestCount++; mCurlRequest->getByteRange(http_url, headers, offset, size, new LLMeshDecompositionResponder(mesh_id, offset, size)); @@ -856,7 +866,6 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) { - ++sActiveLODRequests; LLMeshRepository::sHTTPRequestCount++; mCurlRequest->getByteRange(http_url, headers, offset, size, new LLMeshPhysicsShapeResponder(mesh_id, offset, size)); @@ -907,7 +916,6 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) std::string http_url = constructUrl(mesh_params.getSculptID()); if (!http_url.empty()) { - ++sActiveHeaderRequests; retval = true; //grab first 4KB if we're going to bother with a fetch. Cache will prevent future fetches if a full mesh fits //within the first 4KB @@ -974,7 +982,6 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) { - ++sActiveLODRequests; retval = true; LLMeshRepository::sHTTPRequestCount++; mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size, @@ -1718,7 +1725,6 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, const LLIOPipe::buffer_ptr_t& buffer) { - LLMeshRepoThread::sActiveLODRequests--; S32 data_size = buffer->countAfter(channels.in(), NULL); if (status < 200 || status > 400) @@ -1935,7 +1941,6 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - LLMeshRepoThread::sActiveHeaderRequests--; if (status < 200 || status > 400) { //llwarns -- cgit v1.2.3 From 1316f3313066beef74729c2be5a8d142d185161d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Jan 2012 16:01:56 -0700 Subject: fix for SH-2904: textures remain stuck in HTP state --- indra/llmessage/llcurl.cpp | 11 +++++++++++ indra/llmessage/llcurl.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 1ab82a273b..32a9cd061f 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -91,6 +91,7 @@ std::string LLCurl::sCAFile; LLCurlThread* LLCurl::sCurlThread = NULL ; LLMutex* LLCurl::sHandleMutexp = NULL ; S32 LLCurl::sTotalHandles = 0 ; +bool LLCurl::sNotQuitting = true; void check_curl_code(CURLcode code) { @@ -319,6 +320,14 @@ LLCurl::Easy::~Easy() --gCurlEasyCount; curl_slist_free_all(mHeaders); for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); + + if (mResponder && LLCurl::sNotQuitting) //aborted + { + std::string reason("Request timeout, aborted.") ; + mResponder->completedRaw(408, //HTTP_REQUEST_TIME_OUT, timeout, abort + reason, mChannels, mOutput); + } + mResponder = NULL; } void LLCurl::Easy::resetState() @@ -1462,6 +1471,8 @@ void LLCurl::initClass(bool multi_threaded) void LLCurl::cleanupClass() { + sNotQuitting = false; //set quitting + //shut down curl thread while(1) { diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 2b23ac9763..7d2340a6cb 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -197,6 +197,8 @@ private: static LLMutex* sHandleMutexp ; static S32 sTotalHandles ; +public: + static bool sNotQuitting; }; class LLCurl::Easy -- cgit v1.2.3 From 717a6f3306d9382ea252c3e0f243b785c9cae15a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Jan 2012 18:27:40 -0700 Subject: Introduce two new parameters "CurlUseMultipleThreads" and "CurlRequestTimeOut" for QA to test Curl. --- indra/llmessage/llcurl.cpp | 18 ++++++++++-------- indra/llmessage/llcurl.h | 4 +++- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llappviewer.cpp | 4 +++- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 32a9cd061f..3bcaffc275 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -75,9 +75,6 @@ static const S32 MULTI_PERFORM_CALL_REPEAT = 5; static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds per operation static const S32 MAX_ACTIVE_REQUEST_COUNT = 100; -static const F32 DEFAULT_MULTI_IDLE_TIME = 120.0f ; //seconds -static const S32 MAX_NUM_OF_HANDLES = 256 ; //max number of handles, (multi handles and easy handles combined). - // DEBUG // S32 gCurlEasyCount = 0; S32 gCurlMultiCount = 0; @@ -92,6 +89,8 @@ LLCurlThread* LLCurl::sCurlThread = NULL ; LLMutex* LLCurl::sHandleMutexp = NULL ; S32 LLCurl::sTotalHandles = 0 ; bool LLCurl::sNotQuitting = true; +F32 LLCurl::sCurlRequestTimeOut = 120.f; //seonds +S32 LLCurl::sMaxHandles = 256; //max number of handles, (multi handles and easy handles combined). void check_curl_code(CURLcode code) { @@ -573,9 +572,9 @@ LLCurl::Multi::Multi(F32 idle_time_out) LLCurl::getCurlThread()->addMulti(this) ; mIdleTimeOut = idle_time_out ; - if(mIdleTimeOut < DEFAULT_MULTI_IDLE_TIME) + if(mIdleTimeOut < LLCurl::sCurlRequestTimeOut) { - mIdleTimeOut = DEFAULT_MULTI_IDLE_TIME ; + mIdleTimeOut = LLCurl::sCurlRequestTimeOut ; } ++gCurlMultiCount; @@ -1442,8 +1441,11 @@ unsigned long LLCurl::ssl_thread_id(void) } #endif -void LLCurl::initClass(bool multi_threaded) +void LLCurl::initClass(F32 curl_reuest_timeout, S32 max_number_handles, bool multi_threaded) { + sCurlRequestTimeOut = curl_reuest_timeout ; //seconds + sMaxHandles = max_number_handles ; //max number of handles, (multi handles and easy handles combined). + // Do not change this "unless you are familiar with and mean to control // internal operations of libcurl" // - http://curl.haxx.se/libcurl/c/curl_global_init.html @@ -1512,7 +1514,7 @@ CURLM* LLCurl::newMultiHandle() { LLMutexLock lock(sHandleMutexp) ; - if(sTotalHandles + 1 > MAX_NUM_OF_HANDLES) + if(sTotalHandles + 1 > sMaxHandles) { llwarns << "no more handles available." << llendl ; return NULL ; //failed @@ -1545,7 +1547,7 @@ CURL* LLCurl::newEasyHandle() { LLMutexLock lock(sHandleMutexp) ; - if(sTotalHandles + 1 > MAX_NUM_OF_HANDLES) + if(sTotalHandles + 1 > sMaxHandles) { llwarns << "no more handles available." << llendl ; return NULL ; //failed diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 7d2340a6cb..fd664c0fa1 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -163,7 +163,7 @@ public: /** * @ brief Initialize LLCurl class */ - static void initClass(bool multi_threaded = false); + static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false); /** * @ brief Cleanup LLCurl class @@ -197,8 +197,10 @@ private: static LLMutex* sHandleMutexp ; static S32 sTotalHandles ; + static S32 sMaxHandles; public: static bool sNotQuitting; + static F32 sCurlRequestTimeOut; }; class LLCurl::Easy diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ea623791d..a29d5d2985 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1828,6 +1828,28 @@ Value 0
+ CurlMaximumNumberOfHandles + + Comment + Maximum number of handles curl can use (requires restart) + Persist + 1 + Type + S32 + Value + 256 + + CurlRequestTimeOut + + Comment + Max idle time of a curl request before killed (requires restart) + Persist + 1 + Type + F32 + Value + 120.0 + CurlUseMultipleThreads Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 40136adbc9..4fc306e61d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -720,7 +720,9 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. - LLCurl::initClass(gSavedSettings.getBOOL("CurlUseMultipleThreads")); + LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"), + gSavedSettings.getS32("CurlMaximumNumberOfHandles"), + gSavedSettings.getBOOL("CurlUseMultipleThreads")); LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ; LLMachineID::init(); -- cgit v1.2.3 From 27df0a84564d3a886661aae0faae74c2157cd31b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 27 Jan 2012 23:46:00 -0500 Subject: On Windows, only quote LLProcess arguments if they seem to need it. On Posix platforms, the OS argument mechanism makes quoting/reparsing unnecessary anyway, so this only affects Windows. Add optional 'triggers' parameter to LLStringUtils::quote() (default: space and double-quote). Only if the passed string contains a character in 'triggers' will it be double-quoted. This is observed to fix a Windows-specific problem in which plugin child process would fail to start because it wasn't expecting a quoted number. Use LLStringUtils::quote() more consistently in LLProcess implementation for logging. --- indra/llcommon/llprocess.cpp | 14 +++++++------- indra/llcommon/llstring.h | 26 +++++++++++++++++++++----- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 2c7512419d..2b7a534fb3 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -87,12 +87,12 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) std::string cwd(params.cwd); if (! cwd.empty()) { - out << "cd '" << cwd << "': "; + out << "cd " << LLStringUtil::quote(cwd) << ": "; } - out << '"' << std::string(params.executable) << '"'; + out << LLStringUtil::quote(params.executable); BOOST_FOREACH(const std::string& arg, params.args) { - out << " \"" << arg << '"'; + out << ' ' << LLStringUtil::quote(arg); } return out; } @@ -132,8 +132,8 @@ public: if (! AssignProcessToJobObject(mJob, hProcess)) { - LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject(\"" - << prog << "\")")) << LL_ENDL; + LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject(" + << prog << ")")) << LL_ENDL; } } @@ -206,7 +206,7 @@ void LLProcess::launch(const LLSDParamAdapter& params) mProcessID = pinfo.hProcess; CloseHandle(pinfo.hThread); // stops leaks - nothing else - mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << pinfo.dwProcessId << ')'); + mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << pinfo.dwProcessId << ')'); LL_INFOS("LLProcess") << "Launched " << params << " (" << pinfo.dwProcessId << ")" << LL_ENDL; // Now associate the new child process with our Job Object -- unless @@ -356,7 +356,7 @@ void LLProcess::launch(const LLSDParamAdapter& params) // parent process mProcessID = child; - mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << mProcessID << ')'); + mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')'); LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 4c3936f9ab..7b24b5e279 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -303,11 +303,17 @@ public: static void stripNonprintable(string_type& string); /** - * Double-quote an argument string, unless it's already double-quoted. If we - * quote it, escape any embedded double-quote with the escape string (default + * Double-quote an argument string if needed, unless it's already + * double-quoted. Decide whether it's needed based on the presence of any + * character in @a triggers (default space or double-quote). If we quote + * it, escape any embedded double-quote with the @a escape string (default * backslash). + * + * Passing triggers="" means always quote, unless it's already double-quoted. */ - static string_type quote(const string_type& str, const string_type& escape="\\"); + static string_type quote(const string_type& str, + const string_type& triggers=" \"", + const string_type& escape="\\"); /** * @brief Unsafe way to make ascii characters. You should probably @@ -1060,7 +1066,9 @@ void LLStringUtilBase::stripNonprintable(string_type& string) } template -std::basic_string LLStringUtilBase::quote(const string_type& str, const string_type& escape) +std::basic_string LLStringUtilBase::quote(const string_type& str, + const string_type& triggers, + const string_type& escape) { size_type len(str.length()); // If the string is already quoted, assume user knows what s/he's doing. @@ -1069,7 +1077,15 @@ std::basic_string LLStringUtilBase::quote(const string_type& str, const st return str; } - // Not already quoted: do it. + // Not already quoted: do we need to? triggers.empty() is a special case + // meaning "always quote." + if ((! triggers.empty()) && str.find_first_of(triggers) == string_type::npos) + { + // no trigger characters, don't bother quoting + return str; + } + + // For whatever reason, we must quote this string. string_type result; result.push_back('"'); for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci) -- cgit v1.2.3 From 803acbc5efde19c0acacfc7fe4990841dbf31a3e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 30 Jan 2012 10:14:10 -0500 Subject: Trim trailing "\r\n" from Windows FormatMessage() string for logging. --- indra/llcommon/llprocess.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 2b7a534fb3..8c0e8fe65e 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -261,11 +261,15 @@ static std::string WindowsErrorString(const std::string& operation) NULL) != 0) { + // convert from wide-char string to multi-byte string char message[256]; wcstombs(message, error_str, sizeof(message)); message[sizeof(message)-1] = 0; LocalFree(error_str); - return STRINGIZE(operation << " failed (" << result << "): " << message); + // convert to std::string to trim trailing whitespace + std::string mbsstr(message); + mbsstr.erase(mbsstr.find_last_not_of(" \t\r\n")); + return STRINGIZE(operation << " failed (" << result << "): " << mbsstr); } return STRINGIZE(operation << " failed (" << result << "), but FormatMessage() did not explain"); -- cgit v1.2.3 From 85581eefa63d8f8e8c5132c4cd7e137f6cb88869 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 30 Jan 2012 12:11:44 -0500 Subject: Expose 'handle' as well as 'id' on LLProcess objects. On Posix, these and the corresponding getProcessID()/getProcessHandle() accessors produce the same pid_t value; but on Windows, it's useful to distinguish an int-like 'id' useful to human log readers versus an opaque 'handle' for passing to platform-specific API functions. So make the distinction in a platform-independent way. --- indra/llcommon/llprocess.cpp | 50 ++++++++++++++++++++------------- indra/llcommon/llprocess.h | 42 +++++++++++++++++---------- indra/llcommon/tests/llprocess_test.cpp | 16 +++++------ 3 files changed, 66 insertions(+), 42 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 8c0e8fe65e..a7bafb8cb0 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -42,7 +42,7 @@ struct LLProcessError: public std::runtime_error LLProcessError(const std::string& msg): std::runtime_error(msg) {} }; -LLProcessPtr LLProcess::create(const LLSDParamAdapter& params) +LLProcessPtr LLProcess::create(const LLSDOrParams& params) { try { @@ -55,8 +55,9 @@ LLProcessPtr LLProcess::create(const LLSDParamAdapter& params) } } -LLProcess::LLProcess(const LLSDParamAdapter& params): +LLProcess::LLProcess(const LLSDOrParams& params): mProcessID(0), + mProcessHandle(0), mAutokill(params.autokill) { if (! params.validateBlock(true)) @@ -78,8 +79,18 @@ LLProcess::~LLProcess() bool LLProcess::isRunning(void) { - mProcessID = isRunning(mProcessID, mDesc); - return (mProcessID != 0); + mProcessHandle = isRunning(mProcessHandle, mDesc); + return (mProcessHandle != 0); +} + +LLProcess::id LLProcess::getProcessID() const +{ + return mProcessID; +} + +LLProcess::handle LLProcess::getProcessHandle() const +{ + return mProcessHandle; } std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) @@ -122,7 +133,7 @@ static std::string WindowsErrorString(const std::string& operation); class LLJob: public LLSingleton { public: - void assignProcess(const std::string& prog, HANDLE hProcess) + void assignProcess(const std::string& prog, handle hProcess) { // If we never managed to initialize this Job Object, can't use it -- // but don't keep spamming the log, we already emitted warnings when @@ -164,10 +175,10 @@ private: } } - HANDLE mJob; + handle mJob; }; -void LLProcess::launch(const LLSDParamAdapter& params) +void LLProcess::launch(const LLSDOrParams& params) { PROCESS_INFORMATION pinfo; STARTUPINFOA sinfo = { sizeof(sinfo) }; @@ -201,28 +212,28 @@ void LLProcess::launch(const LLSDParamAdapter& params) throw LLProcessError(WindowsErrorString("CreateProcessA")); } - // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on // CloseHandle(pinfo.hProcess); // stops leaks - nothing else - mProcessID = pinfo.hProcess; + mProcessID = pinfo.dwProcessId; + mProcessHandle = pinfo.hProcess; CloseHandle(pinfo.hThread); // stops leaks - nothing else - mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << pinfo.dwProcessId << ')'); - LL_INFOS("LLProcess") << "Launched " << params << " (" << pinfo.dwProcessId << ")" << LL_ENDL; + mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')'); + LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; // Now associate the new child process with our Job Object -- unless // autokill is false, i.e. caller asserts the child should persist. if (params.autokill) { - LLJob::instance().assignProcess(mDesc, mProcessID); + LLJob::instance().assignProcess(mDesc, mProcessHandle); } } -LLProcess::id LLProcess::isRunning(id handle, const std::string& desc) +LLProcess::handle LLProcess::isRunning(handle h, const std::string& desc) { - if (! handle) + if (! h) return 0; - DWORD waitresult = WaitForSingleObject(handle, 0); + DWORD waitresult = WaitForSingleObject(h, 0); if(waitresult == WAIT_OBJECT_0) { // the process has completed. @@ -233,16 +244,16 @@ LLProcess::id LLProcess::isRunning(id handle, const std::string& desc) return 0; } - return handle; + return h; } bool LLProcess::kill(void) { - if (! mProcessID) + if (! mProcessHandle) return false; LL_INFOS("LLProcess") << "killing " << mDesc << LL_ENDL; - TerminateProcess(mProcessID, 0); + TerminateProcess(mProcessHandle, 0); return ! isRunning(); } @@ -302,7 +313,7 @@ static bool reap_pid(pid_t pid) return false; } -void LLProcess::launch(const LLSDParamAdapter& params) +void LLProcess::launch(const LLSDOrParams& params) { // flush all buffers before the child inherits them ::fflush(NULL); @@ -359,6 +370,7 @@ void LLProcess::launch(const LLSDParamAdapter& params) // parent process mProcessID = child; + mProcessHandle = child; mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')'); LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 51c42582ea..8a842589ec 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -35,7 +35,7 @@ #if LL_WINDOWS #define WIN32_LEAN_AND_MEAN -#include +#include // HANDLE (eye roll) #endif class LLProcess; @@ -79,6 +79,7 @@ public: /// implicitly kill process on destruction of LLProcess object Optional autokill; }; + typedef LLSDParamAdapter LLSDOrParams; /** * Factory accepting either plain LLSD::Map or Params block. @@ -91,7 +92,7 @@ public: * cwd (optional, string, dft no chdir): change to this directory before executing * autokill (optional, bool, dft true): implicit kill() on ~LLProcess */ - static LLProcessPtr create(const LLSDParamAdapter& params); + static LLProcessPtr create(const LLSDOrParams& params); virtual ~LLProcess(); // isRunning isn't const because, if child isn't running, it clears stored @@ -103,35 +104,46 @@ public: bool kill(void); #if LL_WINDOWS - typedef HANDLE id; + typedef int id; ///< as returned by getProcessID() + typedef HANDLE handle; ///< as returned by getProcessHandle() #else - typedef pid_t id; + typedef pid_t id; + typedef pid_t handle; #endif - /// Get platform-specific process ID - id getProcessID() const { return mProcessID; }; + /** + * Get an int-like id value. This is primarily intended for a human reader + * to differentiate processes. + */ + id getProcessID() const; + /** + * Get a "handle" of a kind that you might pass to platform-specific API + * functions to engage features not directly supported by LLProcess. + */ + handle getProcessHandle() const; /** - * Test if a process (id obtained from getProcessID()) is still - * running. Return is same nonzero id value if still running, else + * Test if a process (@c handle obtained from getProcessHandle()) is still + * running. Return same nonzero @c handle value if still running, else * zero, so you can test it like a bool. But if you want to update a * stored variable as a side effect, you can write code like this: * @code - * childpid = LLProcess::isRunning(childpid); + * hchild = LLProcess::isRunning(hchild); * @endcode * @note This method is intended as a unit-test hook, not as the first of - * a whole set of operations supported on freestanding @c id values. New - * functionality should be added as nonstatic members operating on - * mProcessID. + * a whole set of operations supported on freestanding @c handle values. + * New functionality should be added as nonstatic members operating on + * the same data as getProcessHandle(). */ - static id isRunning(id, const std::string& desc=""); + static handle isRunning(handle, const std::string& desc=""); private: /// constructor is private: use create() instead - LLProcess(const LLSDParamAdapter& params); - void launch(const LLSDParamAdapter& params); + LLProcess(const LLSDOrParams& params); + void launch(const LLSDOrParams& params); std::string mDesc; id mProcessID; + handle mProcessHandle; bool mAutokill; }; diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 405540e436..4ad45bdf27 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -599,7 +599,7 @@ namespace tut { set_test_name("implicit kill()"); NamedTempFile out("out", "not started"); - LLProcess::id pid(0); + LLProcess::handle phandle(0); { PythonProcessLauncher py("kill()", "from __future__ import with_statement\n" @@ -614,8 +614,8 @@ namespace tut py.mParams.args.add(out.getName()); py.mPy = LLProcess::create(py.mParams); ensure("couldn't launch kill() script", py.mPy); - // Capture id for later - pid = py.mPy->getProcessID(); + // Capture handle for later + phandle = py.mPy->getProcessHandle(); // Wait for the script to wake up and do its first write int i = 0, timeout = 60; for ( ; i < timeout; ++i) @@ -630,7 +630,7 @@ namespace tut // Destroy the LLProcess, which should kill the child. } // wait for the script to terminate... one way or another. - while (LLProcess::isRunning(pid)) + while (LLProcess::isRunning(phandle)) { sleep(1); } @@ -646,7 +646,7 @@ namespace tut set_test_name("autokill"); NamedTempFile from("from", "not started"); NamedTempFile to("to", ""); - LLProcess::id pid(0); + LLProcess::handle phandle(0); { PythonProcessLauncher py("autokill", "from __future__ import with_statement\n" @@ -672,8 +672,8 @@ namespace tut py.mParams.autokill = false; py.mPy = LLProcess::create(py.mParams); ensure("couldn't launch kill() script", py.mPy); - // Capture id for later - pid = py.mPy->getProcessID(); + // Capture handle for later + phandle = py.mPy->getProcessHandle(); // Wait for the script to wake up and do its first write int i = 0, timeout = 60; for ( ; i < timeout; ++i) @@ -695,7 +695,7 @@ namespace tut outf << "go"; } // flush and close. // now wait for the script to terminate... one way or another. - while (LLProcess::isRunning(pid)) + while (LLProcess::isRunning(phandle)) { sleep(1); } -- cgit v1.2.3 From 60a777d2e3f9bec7a20e5de2df7cb3ecd2455b98 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 30 Jan 2012 12:32:05 -0500 Subject: LLProcess::handle must be qualified when used in LLJob class. --- indra/llcommon/llprocess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index a7bafb8cb0..1e27f8ce1d 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -133,7 +133,7 @@ static std::string WindowsErrorString(const std::string& operation); class LLJob: public LLSingleton { public: - void assignProcess(const std::string& prog, handle hProcess) + void assignProcess(const std::string& prog, LLProcess::handle hProcess) { // If we never managed to initialize this Job Object, can't use it -- // but don't keep spamming the log, we already emitted warnings when @@ -175,7 +175,7 @@ private: } } - handle mJob; + LLProcess::handle mJob; }; void LLProcess::launch(const LLSDOrParams& params) -- cgit v1.2.3 From bd4c629e38aa2ab7223a5ef3b8e23ad91229b512 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 30 Jan 2012 16:44:58 -0500 Subject: Added tag 3.2.8-start for changeset 89980333c99d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 974498551b..33cd4d37a5 100644 --- a/.hgtags +++ b/.hgtags @@ -258,3 +258,4 @@ c6175c955a19e9b9353d242889ec1779b5762522 DRTVWR-105_3.2.5-release c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1 3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1 +89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start -- cgit v1.2.3 From 0e609cc95b08c28bd51f5ab48160fd93df7a6b28 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 30 Jan 2012 16:45:50 -0500 Subject: increment viewer version to 3.2.9 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 99ab053b25..27cdfcaa4e 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 8; +const S32 LL_VERSION_PATCH = 9; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 491cd825561be1cf4a6f428a535811cbe0e3f179 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 30 Jan 2012 17:47:57 -0500 Subject: Set bit flag on CreateProcess() to allow AssignProcessToJobObject(). Windows 7 and friends tend to create a process already implicitly allocated to a job object, and a process can only belong to a single job object. Passing CREATE_BREAKAWAY_FROM_JOB in CreateProcessA()'s dwCreationFlags seems to bypass the access-denied error observed with AssignProcessToJobObject() otherwise. This change should (!) enable OS lifespan management for SLVoice.exe et al. --- indra/llcommon/llprocess.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 1e27f8ce1d..8611d67f25 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -207,7 +207,26 @@ void LLProcess::launch(const LLSDOrParams& params) const char * working_directory = 0; if (! cwd.empty()) working_directory = cwd.c_str(); - if( ! CreateProcessA( NULL, &args2[0], NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) ) + + // It's important to pass CREATE_BREAKAWAY_FROM_JOB because Windows 7 et + // al. tend to implicitly launch new processes already bound to a job. From + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms681949%28v=vs.85%29.aspx : + // "The process must not already be assigned to a job; if it is, the + // function fails with ERROR_ACCESS_DENIED." ... + // "If the process is being monitored by the Program Compatibility + // Assistant (PCA), it is placed into a compatibility job. Therefore, the + // process must be created using CREATE_BREAKAWAY_FROM_JOB before it can + // be placed in another job." + if( ! CreateProcessA(NULL, // lpApplicationName + &args2[0], // lpCommandLine + NULL, // lpProcessAttributes + NULL, // lpThreadAttributes + FALSE, // bInheritHandles + CREATE_BREAKAWAY_FROM_JOB, // dwCreationFlags + NULL, // lpEnvironment + working_directory, // lpCurrentDirectory + &sinfo, // lpStartupInfo + &pinfo ) ) // lpProcessInformation { throw LLProcessError(WindowsErrorString("CreateProcessA")); } @@ -225,7 +244,7 @@ void LLProcess::launch(const LLSDOrParams& params) if (params.autokill) { LLJob::instance().assignProcess(mDesc, mProcessHandle); - } +} } LLProcess::handle LLProcess::isRunning(handle h, const std::string& desc) @@ -287,7 +306,7 @@ static std::string WindowsErrorString(const std::string& operation) } /***************************************************************************** -* Non-Windows specific +* Posix specific *****************************************************************************/ #else // Mac and linux @@ -444,4 +463,4 @@ void LLProcess::reap(void) } |*==========================================================================*/ -#endif +#endif // Posix -- cgit v1.2.3 From 36aba266155bdb25b9887686016ad62b2250b509 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 3 Feb 2012 11:10:13 +0200 Subject: EXP-1843 WIP Added an option to output avatar rez timing. Use the new "Avatar Rez" debugging tag to see the output. --- indra/newview/llagent.cpp | 1 + indra/newview/llagentwearables.cpp | 11 +++++++++++ indra/newview/llagentwearablesfetch.cpp | 8 ++++++++ indra/newview/llagentwearablesfetch.h | 2 ++ indra/newview/llappearancemgr.cpp | 9 +++++++++ indra/newview/lltexlayer.h | 2 ++ indra/newview/llvoavatar.h | 2 ++ indra/newview/llvoavatarself.cpp | 21 ++++++++++++++++++++- indra/newview/llvoavatarself.h | 3 +++ 9 files changed, 58 insertions(+), 1 deletion(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 54ad3cd187..ab9b5ff436 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3314,6 +3314,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * } llinfos << "Received cached texture response for " << num_results << " textures." << llendl; + gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them"); gAgentAvatarp->updateMeshTextures(); diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 13b62cb019..09305a5b4d 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -185,6 +185,7 @@ void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) { if (avatar) { + avatar->outputRezTiming("Sending wearables request"); sendAgentWearablesRequest(); } } @@ -949,6 +950,11 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs if (mInitialWearablesUpdateReceived) return; + if (isAgentAvatarValid()) + { + gAgentAvatarp->outputRezTiming("Received initial wearables update"); + } + // notify subscribers that wearables started loading. See EXT-7777 // *TODO: find more proper place to not be called from deprecated method. // Seems such place is found: LLInitialWearablesFetch::processContents() @@ -1619,6 +1625,11 @@ void LLAgentWearables::queryWearableCache() //VWR-22113: gAgent.getRegion() can return null if invalid, seen here on logout if(gAgent.getRegion()) { + if (isAgentAvatarValid()) + { + gAgentAvatarp->outputRezTiming("Fetching textures from cache"); + } + llinfos << "Requesting texture cache entry for " << num_queries << " baked textures" << llendl; gMessageSystem->sendReliable(gAgent.getRegion()->getHost()); gAgentQueryManager.mNumPendingQueries++; diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 4097ff707c..8cba54347e 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -87,6 +87,10 @@ public: LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : LLInventoryFetchDescendentsObserver(cof_id) { + if (isAgentAvatarValid()) + { + gAgentAvatarp->outputRezTiming("Initial wearables fetch started"); + } } LLInitialWearablesFetch::~LLInitialWearablesFetch() @@ -101,6 +105,10 @@ void LLInitialWearablesFetch::done() // idle tick instead. gInventory.removeObserver(this); doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); + if (isAgentAvatarValid()) + { + gAgentAvatarp->outputRezTiming("Initial wearables fetch done"); + } } void LLInitialWearablesFetch::add(InitialWearableData &data) diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h index 7dafab4a33..bedc445c0e 100644 --- a/indra/newview/llagentwearablesfetch.h +++ b/indra/newview/llagentwearablesfetch.h @@ -40,6 +40,8 @@ //-------------------------------------------------------------------- class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver { + LOG_CLASS(LLInitialWearablesFetch); + public: LLInitialWearablesFetch(const LLUUID& cof_id); ~LLInitialWearablesFetch(); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 663257042e..33f5373d7e 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -268,6 +268,8 @@ struct LLFoundData class LLWearableHoldingPattern { + LOG_CLASS(LLWearableHoldingPattern); + public: LLWearableHoldingPattern(); ~LLWearableHoldingPattern(); @@ -436,6 +438,11 @@ void LLWearableHoldingPattern::checkMissingWearables() void LLWearableHoldingPattern::onAllComplete() { + if (isAgentAvatarValid()) + { + gAgentAvatarp->outputRezTiming("Agent wearables fetch complete"); + } + if (!isMostRecent()) { llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; @@ -2363,6 +2370,8 @@ void LLAppearanceMgr::autopopulateOutfits() // Handler for anything that's deferred until avatar de-clouds. void LLAppearanceMgr::onFirstFullyVisible() { + gAgentAvatarp->outputRezTiming("Avatar fully loaded"); + gAgentAvatarp->reportAvatarRezTime(); gAgentAvatarp->debugAvatarVisible(); // The auto-populate is failing at the point of generating outfits diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 85dadb213c..4f43547dae 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -261,6 +261,8 @@ private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLTexLayerSetBuffer : public LLViewerDynamicTexture { + LOG_CLASS(LLTexLayerSetBuffer); + public: LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height); virtual ~LLTexLayerSetBuffer(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4cd61cecf9..dd0317f555 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -78,6 +78,8 @@ class LLVOAvatar : public LLCharacter, public boost::signals2::trackable { + LOG_CLASS(LLVOAvatar); + public: friend class LLVOAvatarSelf; protected: diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 581912f844..f1df67494f 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1574,7 +1574,7 @@ void LLVOAvatarSelf::invalidateAll() { invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE); } - mDebugSelfLoadTimer.reset(); + //mDebugSelfLoadTimer.reset(); } //----------------------------------------------------------------------------- @@ -1896,11 +1896,13 @@ BOOL LLVOAvatarSelf::getIsCloud() gAgentWearables.getWearableCount(LLWearableType::WT_EYES) == 0 || gAgentWearables.getWearableCount(LLWearableType::WT_SKIN) == 0) { + lldebugs << "No body parts" << llendl; return TRUE; } if (!isTextureDefined(TEX_HAIR, 0)) { + lldebugs << "No hair texture" << llendl; return TRUE; } @@ -1909,12 +1911,14 @@ BOOL LLVOAvatarSelf::getIsCloud() if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) && (!isTextureDefined(TEX_LOWER_BAKED, 0))) { + lldebugs << "Lower textures not baked" << llendl; return TRUE; } if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) && (!isTextureDefined(TEX_UPPER_BAKED, 0))) { + lldebugs << "Upper textures not baked" << llendl; return TRUE; } @@ -1931,10 +1935,12 @@ BOOL LLVOAvatarSelf::getIsCloud() const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 ); if (!baked_img || !baked_img->hasGLTexture()) { + lldebugs << "Texture at index " << i << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl; return TRUE; } } + lldebugs << "Avatar de-clouded" << llendl; } return FALSE; } @@ -2258,6 +2264,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) } } +// FIXME: This is never called. Something may be broken. void LLVOAvatarSelf::outputRezDiagnostics() const { if(!gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) @@ -2315,6 +2322,18 @@ void LLVOAvatarSelf::outputRezDiagnostics() const } } +void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const +{ + LL_DEBUGS("Avatar Rez") + << llformat("%s. Time from avatar creation: %.2f", msg.c_str(), mDebugSelfLoadTimer.getElapsedTimeF32()) + << llendl; +} + +void LLVOAvatarSelf::reportAvatarRezTime() const +{ + // TODO: report mDebugSelfLoadTimer.getElapsedTimeF32() somehow. +} + //----------------------------------------------------------------------------- // setCachedBakedTexture() // A baked texture id was received from a cache query, make it active diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 74ff47a3e4..54dbe81993 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -41,6 +41,7 @@ struct LocalTextureData; class LLVOAvatarSelf : public LLVOAvatar { + LOG_CLASS(LLVOAvatarSelf); /******************************************************************************** ** ** @@ -358,6 +359,8 @@ public: void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } void outputRezDiagnostics() const; + void outputRezTiming(const std::string& msg) const; + void reportAvatarRezTime() const; void debugBakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished); static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); -- cgit v1.2.3 From 90ba675da4416a7f75f59340633e2c007b6cc029 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 3 Feb 2012 13:09:20 -0500 Subject: Escape all strings embedded in TeamCity service messages. TeamCity requires that certain characters (notably "'") must be escaped when embedded in service messages: http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages TUT frequently outputs messages containing "'", e.g. from ensure_equals() failure. We've seen TC output nesting get confused when it fails to process service messages properly due to parsing unescaped messages. Along with test number, report test name (from set_test_name()) when available. Eliminate horsing around to produce normal output on both std::cout and possible output file. When output file is specified, use boost::iostreams::tee_device to do fanout for us. Improve placement (and possibly reliability) of service messages. Clean up a startling amount of redundancy in service-message production. --- indra/test/test.cpp | 183 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 112 insertions(+), 71 deletions(-) diff --git a/indra/test/test.cpp b/indra/test/test.cpp index ffdb0cb976..3e7be29b39 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -37,6 +37,7 @@ #include "linden_common.h" #include "llerrorcontrol.h" #include "lltut.h" +#include "stringize.h" #include "apr_pools.h" #include "apr_getopt.h" @@ -53,6 +54,13 @@ #include #endif +#include +#include +#include +#include +#include +#include + namespace tut { std::string sSourceDir; @@ -69,8 +77,24 @@ public: mPassedTests(0), mFailedTests(0), mSkippedTests(0), - mStream(stream) + // By default, capture a shared_ptr to std::cout, with a no-op "deleter" + // so that destroying the shared_ptr makes no attempt to delete std::cout. + mStream(boost::shared_ptr(&std::cout, boost::lambda::_1)) { + if (stream) + { + // We want a boost::iostreams::tee_device that will stream to two + // std::ostreams. + typedef boost::iostreams::tee_device TeeDevice; + // More than that, though, we want an actual stream using that + // device. + typedef boost::iostreams::stream TeeStream; + // Allocate and assign in two separate steps, per Herb Sutter. + // (Until we turn on C++11 support, have to wrap *stream with + // boost::ref() due to lack of perfect forwarding.) + boost::shared_ptr pstream(new TeeStream(std::cout, boost::ref(*stream))); + mStream = pstream; + } } ~LLTestCallback() @@ -94,7 +118,10 @@ public: { ++mTotalTests; std::ostringstream out; - out << "[" << tr.group << ", " << tr.test << "] "; + out << "[" << tr.group << ", " << tr.test; + if (! tr.name.empty()) + out << ": " << tr.name; + out << "] "; switch(tr.result) { case tut::test_result::ok: @@ -123,56 +150,43 @@ public: break; default: ++mFailedTests; - out << "unknown"; + out << "unknown (tr.result == " << tr.result << ")"; } if(mVerboseMode || (tr.result != tut::test_result::ok)) { + *mStream << out.str(); if(!tr.message.empty()) { - out << ": '" << tr.message << "'"; + *mStream << ": '" << tr.message << "'"; } - if (mStream) - { - *mStream << out.str() << std::endl; - } - - std::cout << out.str() << std::endl; - } - } - - virtual void run_completed() - { - if (mStream) - { - run_completed_(*mStream); + *mStream << std::endl; } - run_completed_(std::cout); } virtual int getFailedTests() const { return mFailedTests; } - virtual void run_completed_(std::ostream &stream) + virtual void run_completed() { - stream << "\tTotal Tests:\t" << mTotalTests << std::endl; - stream << "\tPassed Tests:\t" << mPassedTests; + *mStream << "\tTotal Tests:\t" << mTotalTests << std::endl; + *mStream << "\tPassed Tests:\t" << mPassedTests; if (mPassedTests == mTotalTests) { - stream << "\tYAY!! \\o/"; + *mStream << "\tYAY!! \\o/"; } - stream << std::endl; + *mStream << std::endl; if (mSkippedTests > 0) { - stream << "\tSkipped known failures:\t" << mSkippedTests + *mStream << "\tSkipped known failures:\t" << mSkippedTests << std::endl; } if(mFailedTests > 0) { - stream << "*********************************" << std::endl; - stream << "Failed Tests:\t" << mFailedTests << std::endl; - stream << "Please report or fix the problem." << std::endl; - stream << "*********************************" << std::endl; + *mStream << "*********************************" << std::endl; + *mStream << "Failed Tests:\t" << mFailedTests << std::endl; + *mStream << "Please report or fix the problem." << std::endl; + *mStream << "*********************************" << std::endl; } } @@ -182,7 +196,7 @@ protected: int mPassedTests; int mFailedTests; int mSkippedTests; - std::ostream *mStream; + boost::shared_ptr mStream; }; // TeamCity specific class which emits service messages @@ -192,84 +206,111 @@ class LLTCTestCallback : public LLTestCallback { public: LLTCTestCallback(bool verbose_mode, std::ostream *stream) : - LLTestCallback(verbose_mode, stream), - mTCStream() + LLTestCallback(verbose_mode, stream) { } ~LLTCTestCallback() { - } + } virtual void group_started(const std::string& name) { LLTestCallback::group_started(name); - mTCStream << "\n##teamcity[testSuiteStarted name='" << name << "']" << std::endl; + std::cout << "\n##teamcity[testSuiteStarted name='" << escape(name) << "']" << std::endl; } virtual void group_completed(const std::string& name) { LLTestCallback::group_completed(name); - mTCStream << "##teamcity[testSuiteFinished name='" << name << "']" << std::endl; + std::cout << "##teamcity[testSuiteFinished name='" << escape(name) << "']" << std::endl; } virtual void test_completed(const tut::test_result& tr) { + std::string testname(STRINGIZE(tr.group << "." << tr.test)); + if (! tr.name.empty()) + { + testname.append(":"); + testname.append(tr.name); + } + testname = escape(testname); + + // Sadly, tut::callback doesn't give us control at test start; have to + // backfill start message into TC output. + std::cout << "##teamcity[testStarted name='" << testname << "']" << std::endl; + + // now forward call to base class so any output produced there is in + // the right TC context LLTestCallback::test_completed(tr); switch(tr.result) { case tut::test_result::ok: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; break; + case tut::test_result::fail: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; - break; case tut::test_result::ex: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; - break; case tut::test_result::warn: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; - break; case tut::test_result::term: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFailed name='" << tr.group << "." << tr.test << "' message='" << tr.message << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; + std::cout << "##teamcity[testFailed name='" << testname + << "' message='" << escape(tr.message) << "']" << std::endl; break; + case tut::test_result::skip: - mTCStream << "##teamcity[testStarted name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testIgnored name='" << tr.group << "." << tr.test << "']" << std::endl; - mTCStream << "##teamcity[testFinished name='" << tr.group << "." << tr.test << "']" << std::endl; + std::cout << "##teamcity[testIgnored name='" << testname << "']" << std::endl; break; + default: break; } + std::cout << "##teamcity[testFinished name='" << testname << "']" << std::endl; } - virtual void run_completed() - { - LLTestCallback::run_completed(); - - // dump the TC reporting results to cout - tc_run_completed_(std::cout); - } - - virtual void tc_run_completed_(std::ostream &stream) + static std::string escape(const std::string& str) { - - // dump the TC reporting results to cout - stream << mTCStream.str() << std::endl; + // Per http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages + std::string result; + BOOST_FOREACH(char c, str) + { + switch (c) + { + case '\'': + result.append("|'"); + break; + case '\n': + result.append("|n"); + break; + case '\r': + result.append("|r"); + break; +/*==========================================================================*| + // These are not possible 'char' values from a std::string. + case '\u0085': // next line + result.append("|x"); + break; + case '\u2028': // line separator + result.append("|l"); + break; + case '\u2029': // paragraph separator + result.append("|p"); + break; +|*==========================================================================*/ + case '|': + result.append("||"); + break; + case '[': + result.append("|["); + break; + case ']': + result.append("|]"); + break; + default: + result.push_back(c); + break; + } + } + return result; } - -protected: - std::ostringstream mTCStream; - }; -- cgit v1.2.3 From 028d9b3b3433bcb84253a23e98a2027b26b08255 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 3 Feb 2012 10:45:14 -0800 Subject: EXP-1868 FIX Remove Merchant Outbox from Me menu reviewed by Leslie --- indra/newview/skins/default/xui/en/menu_viewer.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 1f72984166..01713c539a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -152,13 +152,6 @@ - - - -- cgit v1.2.3 From a3a69b1eb1fd7c346b97b0c3feca6151684fdced Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Fri, 3 Feb 2012 14:01:03 -0500 Subject: Added tag DRTVWR-114_3.2.8-beta1, 3.2.8-beta1 for changeset 16f8e2915f3f --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 33cd4d37a5..91cb7425cf 100644 --- a/.hgtags +++ b/.hgtags @@ -259,3 +259,5 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1 3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1 89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start +16f8e2915f3f2e4d732fb3125daf229cb0fd1875 DRTVWR-114_3.2.8-beta1 +16f8e2915f3f2e4d732fb3125daf229cb0fd1875 3.2.8-beta1 -- cgit v1.2.3 From a89fbc1d3396d1fe5516571fd6d8651d60709784 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 3 Feb 2012 11:14:54 -0800 Subject: EXP-1868 FIX Remove Merchant Outbox from Me menu removed merchant outbox context menu reviewed by Leslie --- indra/newview/llinventorybridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c0065a94e6..cebe93f042 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -73,7 +73,7 @@ #include "llwearablelist.h" // Marketplace outbox current disabled -#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 +#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 0 #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 0 #define BLOCK_WORN_ITEMS_IN_OUTBOX 1 -- cgit v1.2.3 From 54bc900c952b964206d484aa0b92e42238819fc6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 6 Feb 2012 10:00:15 -0500 Subject: Added tag 3.2.9-start for changeset 37dd400ad721 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 33cd4d37a5..2701d2bab0 100644 --- a/.hgtags +++ b/.hgtags @@ -259,3 +259,4 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1 3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1 89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start +37dd400ad721e2a89ee820ffc1e7e433c68f3ca2 3.2.9-start -- cgit v1.2.3 From 289d756ea86bd3898f41592146d8f549cd056846 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 6 Feb 2012 10:01:09 -0500 Subject: increment viewer version to 3.3.0 --- indra/llcommon/llversionviewer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 27cdfcaa4e..a869c74189 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,8 +28,8 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 9; +const S32 LL_VERSION_MINOR = 3; +const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 836e5e56ee1d726f8047b1b3277281ba6ca93516 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Mon, 6 Feb 2012 14:43:32 -0500 Subject: Added tag DRTVWR-115_3.2.8-beta2, 3.2.8-beta2 for changeset 987425b1acf4 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 33cd4d37a5..8442f3ce89 100644 --- a/.hgtags +++ b/.hgtags @@ -259,3 +259,5 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 3d75c836d178c7c7e788f256afe195f6cab764a2 DRTVWR-111_3.2.7-beta1 3d75c836d178c7c7e788f256afe195f6cab764a2 3.2.7-beta1 89980333c99dbaf1787fe20784f1d8849e9b5d4f 3.2.8-start +987425b1acf4752379b2e1eb20944b4b35d67a85 DRTVWR-115_3.2.8-beta2 +987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 -- cgit v1.2.3 From d99acd56cdc41d72a073a4419e3e51c356e675bb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 6 Feb 2012 17:06:55 -0500 Subject: ManageAPR should be noncopyable. Make that explicit. Any RAII class should either be noncopyable or should deal appropriately with a copy operation. ManageAPR is intended only for extremely simple cases, and hence should be noncopyable. --- indra/test/manageapr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/test/manageapr.h b/indra/test/manageapr.h index 0c1ca7b7be..2452fb6ae4 100644 --- a/indra/test/manageapr.h +++ b/indra/test/manageapr.h @@ -13,6 +13,7 @@ #define LL_MANAGEAPR_H #include "llapr.h" +#include /** * Declare a static instance of this class for dead-simple ll_init_apr() at @@ -21,7 +22,7 @@ * instances of other classes that depend on APR already being initialized, * the indeterminate static-constructor-order problem rears its ugly head. */ -class ManageAPR +class ManageAPR: public boost::noncopyable { public: ManageAPR() -- cgit v1.2.3 From aafb03b29f5166e8978931ad8b717be32d942836 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 7 Feb 2012 10:53:23 -0500 Subject: Convert LLProcess implementation from platform-specific to using APR. Include logic to engage Linden apr_procattr_autokill_set() extension: on Windows, magic CreateProcess() flag must be pushed down into apr_proc_create() level. When using an APR package without that extension, present implementation should lock (e.g.) SLVoice.exe lifespan to viewer's on Windows XP but probably won't on Windows 7: need magic flag on CreateProcess(). Using APR child-termination callback requires us to define state (e.g. LLProcess::RUNNING). Take the opportunity to present Status, capturing state and (if terminated) rc or signal number; but since most of the time all caller really wants is to log the outcome, also present status string, encapsulating logic to examine state and describe exited-with-rc vs. killed-by-signal. New Status logic may report clearer results in the case of a Windows child process killed by exception. Clarify that static LLProcess::isRunning(handle) overload is only for use when the original LLProcess object has been destroyed: really only for unit tests. We necessarily retain our original platform-specific implementations for just that one method. (Nonstatic isRunning() no longer calls static method.) Clarify log output from llprocess_test.cpp in a couple places. --- indra/llcommon/llprocess.cpp | 552 +++++++++++++++++++++++--------- indra/llcommon/llprocess.h | 64 +++- indra/llcommon/tests/llprocess_test.cpp | 6 +- 3 files changed, 455 insertions(+), 167 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 8611d67f25..bc27002701 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -30,11 +30,15 @@ #include "llsingleton.h" #include "llstring.h" #include "stringize.h" +#include "llapr.h" #include #include #include +static std::string empty; +static LLProcess::Status interpret_status(int status); + /// Need an exception to avoid constructing an invalid LLProcess object, but /// internal use only struct LLProcessError: public std::runtime_error @@ -55,9 +59,14 @@ LLProcessPtr LLProcess::create(const LLSDOrParams& params) } } +/// Call an apr function returning apr_status_t. On failure, log warning and +/// throw LLProcessError mentioning the function call that produced that +/// result. +#define chkapr(func) \ + if (ll_apr_warn_status(func)) \ + throw LLProcessError(#func " failed") + LLProcess::LLProcess(const LLSDOrParams& params): - mProcessID(0), - mProcessHandle(0), mAutokill(params.autokill) { if (! params.validateBlock(true)) @@ -66,31 +75,298 @@ LLProcess::LLProcess(const LLSDOrParams& params): << LLSDNotationStreamer(params))); } - launch(params); + apr_procattr_t *procattr = NULL; + chkapr(apr_procattr_create(&procattr, gAPRPoolp)); + + // For which of stdin, stdout, stderr should we create a pipe to the + // child? In the viewer, there are only a couple viable + // apr_procattr_io_set() alternatives: inherit the viewer's own stdxxx + // handle (APR_NO_PIPE, e.g. for stdout, stderr), or create a pipe that's + // blocking on the child end but nonblocking at the viewer end + // (APR_CHILD_BLOCK). The viewer can't block for anything: the parent end + // MUST be nonblocking. As the APR documentation itself points out, it + // makes very little sense to set nonblocking I/O for the child end of a + // pipe: only a specially-written child could deal with that. + // Other major options could include explicitly creating a single APR pipe + // and passing it as both stdout and stderr (apr_procattr_child_out_set(), + // apr_procattr_child_err_set()), or accepting a filename, opening it and + // passing that apr_file_t (simple <, >, 2> redirect emulation). +// chkapr(apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK)); + chkapr(apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE)); + + // Thumbs down on implicitly invoking the shell to invoke the child. From + // our point of view, the other major alternative to APR_PROGRAM_PATH + // would be APR_PROGRAM_ENV: still copy environment, but require full + // executable pathname. I don't see a downside to searching the PATH, + // though: if our caller wants (e.g.) a specific Python interpreter, s/he + // can still pass the full pathname. + chkapr(apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH)); + // YES, do extra work if necessary to report child exec() failures back to + // parent process. + chkapr(apr_procattr_error_check_set(procattr, 1)); + // Do not start a non-autokill child in detached state. On Posix + // platforms, this setting attempts to daemonize the new child, closing + // std handles and the like, and that's a bit more detachment than we + // want. autokill=false just means not to implicitly kill the child when + // the parent terminates! +// chkapr(apr_procattr_detach_set(procattr, params.autokill? 0 : 1)); + + if (params.autokill) + { +#if defined(APR_HAS_PROCATTR_AUTOKILL_SET) + apr_status_t ok = apr_procattr_autokill_set(procattr, 1); +# if LL_WINDOWS + // As of 2012-02-02, we only expect this to be implemented on Windows. + // Avoid spamming the log with warnings we fully expect. + ll_apr_warn_status(ok); +# endif // LL_WINDOWS +#else + LL_WARNS("LLProcess") << "This version of APR lacks Linden apr_procattr_autokill_set() extension" << LL_ENDL; +#endif + } + + // Have to instantiate named std::strings for string params items so their + // c_str() values persist. + std::string cwd(params.cwd); + if (! cwd.empty()) + { + chkapr(apr_procattr_dir_set(procattr, cwd.c_str())); + } + + // create an argv vector for the child process + std::vector argv; + + // add the executable path + std::string executable(params.executable); + argv.push_back(executable.c_str()); + + // and any arguments + std::vector args(params.args.begin(), params.args.end()); + BOOST_FOREACH(const std::string& arg, args) + { + argv.push_back(arg.c_str()); + } + + // terminate with a null pointer + argv.push_back(NULL); + + // Launch! The NULL would be the environment block, if we were passing one. + chkapr(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, gAPRPoolp)); + + // arrange to call status_callback() + apr_proc_other_child_register(&mProcess, &LLProcess::status_callback, this, mProcess.in, + gAPRPoolp); + mStatus.mState = RUNNING; + + mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcess.pid << ')'); + LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcess.pid << ")" << LL_ENDL; + + // Unless caller explicitly turned off autokill (child should persist), + // take steps to terminate the child. This is all suspenders-and-belt: in + // theory our destructor should kill an autokill child, but in practice + // that doesn't always work (e.g. VWR-21538). + if (params.autokill) + { + // Tie the lifespan of this child process to the lifespan of our APR + // pool: on destruction of the pool, forcibly kill the process. Tell + // APR to try SIGTERM and wait 3 seconds. If that didn't work, use + // SIGKILL. + apr_pool_note_subprocess(gAPRPoolp, &mProcess, APR_KILL_AFTER_TIMEOUT); + + // On Windows, associate the new child process with our Job Object. + autokill(); + } } LLProcess::~LLProcess() { + // Only in state RUNNING are we registered for callback. In UNSTARTED we + // haven't yet registered. And since receiving the callback is the only + // way we detect child termination, we only change from state RUNNING at + // the same time we unregister. + if (mStatus.mState == RUNNING) + { + // We're still registered for a callback: unregister. Do it before + // we even issue the kill(): even if kill() somehow prompted an + // instantaneous callback (unlikely), this object is going away! Any + // information updated in this object by such a callback is no longer + // available to any consumer anyway. + apr_proc_other_child_unregister(this); + } + if (mAutokill) { - kill(); + kill("destructor"); + } +} + +bool LLProcess::kill(const std::string& who) +{ + if (isRunning()) + { + LL_INFOS("LLProcess") << who << " killing " << mDesc << LL_ENDL; + +#if LL_WINDOWS + int sig = -1; +#else // Posix + int sig = SIGTERM; +#endif + + ll_apr_warn_status(apr_proc_kill(&mProcess, sig)); } + + return ! isRunning(); } bool LLProcess::isRunning(void) { - mProcessHandle = isRunning(mProcessHandle, mDesc); - return (mProcessHandle != 0); + return getStatus().mState == RUNNING; +} + +LLProcess::Status LLProcess::getStatus() +{ + // Only when mState is RUNNING might the status change dynamically. For + // any other value, pointless to attempt to update status: it won't + // change. + if (mStatus.mState == RUNNING) + { + // Tell APR to sense whether the child is still running and call + // handle_status() appropriately. We should be able to get the same + // info from an apr_proc_wait(APR_NOWAIT) call; but at least in APR + // 1.4.2, testing suggests that even with APR_NOWAIT, apr_proc_wait() + // blocks the caller. We can't have that in the viewer. Hence the + // callback rigmarole. Once we update APR, it's probably worth testing + // again. Also -- although there's an apr_proc_other_child_refresh() + // call, i.e. get that information for one specific child, it accepts + // an 'apr_other_child_rec_t*' that's mentioned NOWHERE else in the + // documentation or header files! I would use the specific call if I + // knew how. As it is, each call to this method will call callbacks + // for ALL still-running child processes. Sigh... + apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); + } + + return mStatus; +} + +std::string LLProcess::getStatusString() +{ + return getStatusString(getStatus()); +} + +std::string LLProcess::getStatusString(const Status& status) +{ + return getStatusString(mDesc, status); +} + +//static +std::string LLProcess::getStatusString(const std::string& desc, const Status& status) +{ + if (status.mState == UNSTARTED) + return desc + " was never launched"; + + if (status.mState == RUNNING) + return desc + " running"; + + if (status.mState == EXITED) + return STRINGIZE(desc << " exited with code " << status.mData); + + if (status.mState == KILLED) +#if LL_WINDOWS + return STRINGIZE(desc << " killed with exception " << std::hex << status.mData); +#else + return STRINGIZE(desc << " killed by signal " << status.mData); +#endif + + + return STRINGIZE(desc << " in unknown state " << status.mState << " (" << status.mData << ")"); +} + +// Classic-C-style APR callback +void LLProcess::status_callback(int reason, void* data, int status) +{ + // Our only role is to bounce this static method call back into object + // space. + static_cast(data)->handle_status(reason, status); +} + +#define tabent(symbol) { symbol, #symbol } +static struct ReasonCode +{ + int code; + const char* name; +} reasons[] = +{ + tabent(APR_OC_REASON_DEATH), + tabent(APR_OC_REASON_UNWRITABLE), + tabent(APR_OC_REASON_RESTART), + tabent(APR_OC_REASON_UNREGISTER), + tabent(APR_OC_REASON_LOST), + tabent(APR_OC_REASON_RUNNING) +}; +#undef tabent + +// Object-oriented callback +void LLProcess::handle_status(int reason, int status) +{ + { + // This odd appearance of LL_DEBUGS is just to bracket a lookup that will + // only be performed if in fact we're going to produce the log message. + LL_DEBUGS("LLProcess") << empty; + std::string reason_str; + BOOST_FOREACH(const ReasonCode& rcp, reasons) + { + if (reason == rcp.code) + { + reason_str = rcp.name; + break; + } + } + if (reason_str.empty()) + { + reason_str = STRINGIZE("unknown reason " << reason); + } + LL_CONT << mDesc << ": handle_status(" << reason_str << ", " << status << ")" << LL_ENDL; + } + + if (! (reason == APR_OC_REASON_DEATH || reason == APR_OC_REASON_LOST)) + { + // We're only interested in the call when the child terminates. + return; + } + + // Somewhat oddly, APR requires that you explicitly unregister even when + // it already knows the child has terminated. We must pass the same 'data' + // pointer as for the register() call, which was our 'this'. + apr_proc_other_child_unregister(this); + // We overload mStatus.mState to indicate whether the child is registered + // for APR callback: only RUNNING means registered. Track that we've + // unregistered. We know the child has terminated; might be EXITED or + // KILLED; refine below. + mStatus.mState = EXITED; + +// wi->rv = apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT); + // It's just wrong to call apr_proc_wait() here. The only way APR knows to + // call us with APR_OC_REASON_DEATH is that it's already reaped this child + // process, so calling wait() will only produce "huh?" from the OS. We + // must rely on the status param passed in, which unfortunately comes + // straight from the OS wait() call, which means we have to decode it by + // hand. + mStatus = interpret_status(status); + LL_INFOS("LLProcess") << getStatusString() << LL_ENDL; } LLProcess::id LLProcess::getProcessID() const { - return mProcessID; + return mProcess.pid; } LLProcess::handle LLProcess::getProcessHandle() const { - return mProcessHandle; +#if LL_WINDOWS + return mProcess.hproc; +#else + return mProcess.pid; +#endif } std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) @@ -178,77 +454,15 @@ private: LLProcess::handle mJob; }; -void LLProcess::launch(const LLSDOrParams& params) +void LLProcess::autokill() { - PROCESS_INFORMATION pinfo; - STARTUPINFOA sinfo = { sizeof(sinfo) }; - - // LLProcess::create()'s caller passes a Unix-style array of strings for - // command-line arguments. Our caller can and should expect that these will be - // passed to the child process as individual arguments, regardless of content - // (e.g. embedded spaces). But because Windows invokes any child process with - // a single command-line string, this means we must quote each argument behind - // the scenes. - std::string args = LLStringUtil::quote(params.executable); - BOOST_FOREACH(const std::string& arg, params.args) - { - args += " "; - args += LLStringUtil::quote(arg); - } - - // So retarded. Windows requires that the second parameter to - // CreateProcessA be a writable (non-const) string... - std::vector args2(args.begin(), args.end()); - args2.push_back('\0'); - - // Convert wrapper to a real std::string so we can use c_str(); but use a - // named variable instead of a temporary so c_str() pointer remains valid. - std::string cwd(params.cwd); - const char * working_directory = 0; - if (! cwd.empty()) - working_directory = cwd.c_str(); - - // It's important to pass CREATE_BREAKAWAY_FROM_JOB because Windows 7 et - // al. tend to implicitly launch new processes already bound to a job. From - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms681949%28v=vs.85%29.aspx : - // "The process must not already be assigned to a job; if it is, the - // function fails with ERROR_ACCESS_DENIED." ... - // "If the process is being monitored by the Program Compatibility - // Assistant (PCA), it is placed into a compatibility job. Therefore, the - // process must be created using CREATE_BREAKAWAY_FROM_JOB before it can - // be placed in another job." - if( ! CreateProcessA(NULL, // lpApplicationName - &args2[0], // lpCommandLine - NULL, // lpProcessAttributes - NULL, // lpThreadAttributes - FALSE, // bInheritHandles - CREATE_BREAKAWAY_FROM_JOB, // dwCreationFlags - NULL, // lpEnvironment - working_directory, // lpCurrentDirectory - &sinfo, // lpStartupInfo - &pinfo ) ) // lpProcessInformation - { - throw LLProcessError(WindowsErrorString("CreateProcessA")); - } - - // CloseHandle(pinfo.hProcess); // stops leaks - nothing else - mProcessID = pinfo.dwProcessId; - mProcessHandle = pinfo.hProcess; - CloseHandle(pinfo.hThread); // stops leaks - nothing else - - mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')'); - LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; - - // Now associate the new child process with our Job Object -- unless - // autokill is false, i.e. caller asserts the child should persist. - if (params.autokill) - { - LLJob::instance().assignProcess(mDesc, mProcessHandle); -} + LLJob::instance().assignProcess(mDesc, mProcess.hproc); } LLProcess::handle LLProcess::isRunning(handle h, const std::string& desc) { + // This direct Windows implementation is because we have no access to the + // apr_proc_t struct: we expect it's been destroyed. if (! h) return 0; @@ -258,22 +472,44 @@ LLProcess::handle LLProcess::isRunning(handle h, const std::string& desc) // the process has completed. if (! desc.empty()) { - LL_INFOS("LLProcess") << desc << " terminated" << LL_ENDL; + DWORD status = 0; + if (! GetExitCodeProcess(h, &status)) + { + LL_WARNS("LLProcess") << desc << " terminated, but " + << WindowsErrorString("GetExitCodeProcess()") << LL_ENDL; + } + { + LL_INFOS("LLProcess") << getStatusString(desc, interpret_status(status)) + << LL_ENDL; + } } + CloseHandle(h); return 0; } return h; } -bool LLProcess::kill(void) +static LLProcess::Status interpret_status(int status) { - if (! mProcessHandle) - return false; + LLProcess::Status result; + + // This bit of code is cribbed from apr/threadproc/win32/proc.c, a + // function (unfortunately static) called why_from_exit_code(): + /* See WinNT.h STATUS_ACCESS_VIOLATION and family for how + * this class of failures was determined + */ + if ((status & 0xFFFF0000) == 0xC0000000) + { + result.mState = KILLED; + } + else + { + result.mState = EXITED; + } + result.mData = status; - LL_INFOS("LLProcess") << "killing " << mDesc << LL_ENDL; - TerminateProcess(mProcessHandle, 0); - return ! isRunning(); + return result; } /// GetLastError()/FormatMessage() boilerplate @@ -315,98 +551,91 @@ static std::string WindowsErrorString(const std::string& operation) #include #include +void LLProcess::autokill() +{ + // What we ought to do here is to: + // 1. create a unique process group and run all autokill children in that + // group (see https://jira.secondlife.com/browse/SWAT-563); + // 2. figure out a way to intercept control when the viewer exits -- + // gracefully or not; + // 3. when the viewer exits, kill off the aforementioned process group. + + // It's point 2 that's troublesome. Although I've seen some signal- + // handling logic in the Posix viewer code, I haven't yet found any bit of + // code that's run no matter how the viewer exits (a try/finally for the + // whole process, as it were). +} + // Attempt to reap a process ID -- returns true if the process has exited and been reaped, false otherwise. -static bool reap_pid(pid_t pid) +static bool reap_pid(pid_t pid, LLProcess::Status* pstatus=NULL) { - pid_t wait_result = ::waitpid(pid, NULL, WNOHANG); + LLProcess::Status dummy; + if (! pstatus) + { + // If caller doesn't want to see Status, give us a target anyway so we + // don't have to have a bunch of conditionals. + pstatus = &dummy; + } + + int status = 0; + pid_t wait_result = ::waitpid(pid, &status, WNOHANG); if (wait_result == pid) { + *pstatus = interpret_status(status); return true; } - if (wait_result == -1 && errno == ECHILD) + if (wait_result == 0) { - // No such process -- this may mean we're ignoring SIGCHILD. - return true; + pstatus->mState = LLProcess::RUNNING; + pstatus->mData = 0; + return false; } - - return false; -} -void LLProcess::launch(const LLSDOrParams& params) -{ - // flush all buffers before the child inherits them - ::fflush(NULL); + // Clear caller's Status block; caller must interpret UNSTARTED to mean + // "if this PID was ever valid, it no longer is." + *pstatus = LLProcess::Status(); - pid_t child = vfork(); - if (child == 0) + // We've dealt with the success cases: we were able to reap the child + // (wait_result == pid) or it's still running (wait_result == 0). It may + // be that the child terminated but didn't hang around long enough for us + // to reap. In that case we still have no Status to report, but we can at + // least state that it's not running. + if (wait_result == -1 && errno == ECHILD) { - // child process - - std::string cwd(params.cwd); - if (! cwd.empty()) - { - // change to the desired child working directory - if (::chdir(cwd.c_str())) - { - // chdir failed - LL_WARNS("LLProcess") << "could not chdir(\"" << cwd << "\")" << LL_ENDL; - // pointless to throw; this is child process... - _exit(248); - } - } - - // create an argv vector for the child process - std::vector fake_argv; - - // add the executable path - std::string executable(params.executable); - fake_argv.push_back(executable.c_str()); - - // and any arguments - std::vector args(params.args.begin(), params.args.end()); - BOOST_FOREACH(const std::string& arg, args) - { - fake_argv.push_back(arg.c_str()); - } - - // terminate with a null pointer - fake_argv.push_back(NULL); - - ::execv(executable.c_str(), const_cast(&fake_argv[0])); - - // If we reach this point, the exec failed. - LL_WARNS("LLProcess") << "failed to launch: "; - BOOST_FOREACH(const char* arg, fake_argv) - { - LL_CONT << arg << ' '; - } - LL_CONT << LL_ENDL; - // Use _exit() instead of exit() per the vfork man page. Exit with a - // distinctive rc: someday soon we'll be able to retrieve it, and it - // would be nice to be able to tell that the child process failed! - _exit(249); + // No such process -- this may mean we're ignoring SIGCHILD. + return true; } - // parent process - mProcessID = child; - mProcessHandle = child; - - mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')'); - LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL; + // Uh, should never happen?! + LL_WARNS("LLProcess") << "LLProcess::reap_pid(): waitpid(" << pid << ") returned " + << wait_result << "; not meaningful?" << LL_ENDL; + // If caller is looping until this pid terminates, and if we can't find + // out, better to break the loop than to claim it's still running. + return true; } LLProcess::id LLProcess::isRunning(id pid, const std::string& desc) { + // This direct Posix implementation is because we have no access to the + // apr_proc_t struct: we expect it's been destroyed. if (! pid) return 0; // Check whether the process has exited, and reap it if it has. - if(reap_pid(pid)) + LLProcess::Status status; + if(reap_pid(pid, &status)) { // the process has exited. if (! desc.empty()) { - LL_INFOS("LLProcess") << desc << " terminated" << LL_ENDL; + std::string statstr(desc + " apparently terminated: no status available"); + // We don't just pass UNSTARTED to getStatusString() because, in + // the context of reap_pid(), that state has special meaning. + if (status.mState != UNSTARTED) + { + statstr = getStatusString(desc, status); + } + LL_INFOS("LLProcess") << statstr << LL_ENDL; } return 0; } @@ -414,18 +643,27 @@ LLProcess::id LLProcess::isRunning(id pid, const std::string& desc) return pid; } -bool LLProcess::kill(void) +static LLProcess::Status interpret_status(int status) { - if (! mProcessID) - return false; + LLProcess::Status result; - // Try to kill the process. We'll do approximately the same thing whether - // the kill returns an error or not, so we ignore the result. - LL_INFOS("LLProcess") << "killing " << mDesc << LL_ENDL; - (void)::kill(mProcessID, SIGTERM); + if (WIFEXITED(status)) + { + result.mState = LLProcess::EXITED; + result.mData = WEXITSTATUS(status); + } + else if (WIFSIGNALED(status)) + { + result.mState = LLProcess::KILLED; + result.mData = WTERMSIG(status); + } + else // uh, shouldn't happen? + { + result.mState = LLProcess::EXITED; + result.mData = status; // someone else will have to decode + } - // This will have the side-effect of reaping the zombie if the process has exited. - return ! isRunning(); + return result; } /*==========================================================================*| diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 8a842589ec..689f8aedab 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -29,6 +29,7 @@ #include "llinitparam.h" #include "llsdparam.h" +#include "apr_thread_proc.h" #include #include #include // std::ostream @@ -95,13 +96,52 @@ public: static LLProcessPtr create(const LLSDOrParams& params); virtual ~LLProcess(); - // isRunning isn't const because, if child isn't running, it clears stored - // process ID + // isRunning() isn't const because, when child terminates, it sets stored + // Status bool isRunning(void); - + + /** + * State of child process + */ + enum state + { + UNSTARTED, ///< initial value, invisible to consumer + RUNNING, ///< child process launched + EXITED, ///< child process terminated voluntarily + KILLED ///< child process terminated involuntarily + }; + + /** + * Status info + */ + struct Status + { + Status(): + mState(UNSTARTED), + mData(0) + {} + + state mState; ///< @see state + /** + * - for mState == EXITED: mData is exit() code + * - for mState == KILLED: mData is signal number (Posix) + * - otherwise: mData is undefined + */ + int mData; + }; + + /// Status query + Status getStatus(); + /// English Status string query, for logging etc. + std::string getStatusString(); + /// English Status string query for previously-captured Status + std::string getStatusString(const Status& status); + /// static English Status string query + static std::string getStatusString(const std::string& desc, const Status& status); + // Attempt to kill the process -- returns true if the process is no longer running when it returns. // Note that even if this returns false, the process may exit some time after it's called. - bool kill(void); + bool kill(const std::string& who=""); #if LL_WINDOWS typedef int id; ///< as returned by getProcessID() @@ -133,18 +173,28 @@ public: * a whole set of operations supported on freestanding @c handle values. * New functionality should be added as nonstatic members operating on * the same data as getProcessHandle(). + * + * In particular, if child termination is detected by static isRunning() + * rather than by nonstatic isRunning(), the LLProcess object won't be + * aware of the child's changed status and may encounter OS errors trying + * to obtain it. static isRunning() is only intended for after the + * launching LLProcess object has been destroyed. */ static handle isRunning(handle, const std::string& desc=""); private: /// constructor is private: use create() instead LLProcess(const LLSDOrParams& params); - void launch(const LLSDOrParams& params); + void autokill(); + // Classic-C-style APR callback + static void status_callback(int reason, void* data, int status); + // Object-oriented callback + void handle_status(int reason, int status); std::string mDesc; - id mProcessID; - handle mProcessHandle; + apr_proc_t mProcess; bool mAutokill; + Status mStatus; }; /// for logging diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 4ad45bdf27..60ed12ad6a 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -630,7 +630,7 @@ namespace tut // Destroy the LLProcess, which should kill the child. } // wait for the script to terminate... one way or another. - while (LLProcess::isRunning(phandle)) + while (LLProcess::isRunning(phandle, "kill() script")) { sleep(1); } @@ -643,7 +643,7 @@ namespace tut template<> template<> void object::test<6>() { - set_test_name("autokill"); + set_test_name("autokill=false"); NamedTempFile from("from", "not started"); NamedTempFile to("to", ""); LLProcess::handle phandle(0); @@ -695,7 +695,7 @@ namespace tut outf << "go"; } // flush and close. // now wait for the script to terminate... one way or another. - while (LLProcess::isRunning(phandle)) + while (LLProcess::isRunning(phandle, "autokill script")) { sleep(1); } -- cgit v1.2.3 From 219a010aaf4891fc2ab8480a2121b1244191c24d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 7 Feb 2012 11:17:04 -0500 Subject: LLProcess::Status enum values need qualification in helper function. --- indra/llcommon/llprocess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index bc27002701..1305c1d764 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -501,11 +501,11 @@ static LLProcess::Status interpret_status(int status) */ if ((status & 0xFFFF0000) == 0xC0000000) { - result.mState = KILLED; + result.mState = LLProcess::KILLED; } else { - result.mState = EXITED; + result.mState = LLProcess::EXITED; } result.mData = status; -- cgit v1.2.3 From 5d2bb536324a906078b224bdc9697b368e96a6b6 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 7 Feb 2012 12:06:03 -0500 Subject: On Linux, #undef Status: we use that name for nested LLProcess struct. Apparently something in the Linux system header chain #defines a macro Status as 'int'. That's just Bad in C++ land. It should at the very least be a typedef! #undefining it in llprocess.h permits the viewer to build. --- indra/llcommon/llprocess.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 689f8aedab..0de033c15b 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -37,6 +37,10 @@ #if LL_WINDOWS #define WIN32_LEAN_AND_MEAN #include // HANDLE (eye roll) +#elif LL_LINUX +#if defined(Status) +#undef Status +#endif #endif class LLProcess; -- cgit v1.2.3 From 32e11494ffde368b2ac166e16dc294d66a18492f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 7 Feb 2012 12:28:57 -0500 Subject: Use os.path.normcase(os.path.normpath()) when comparing directories. Once again we've been bitten by comparison failure between "c:\somepath" and "C:\somepath". Normalize paths in both Python helper scripts to make that comparison more robust. --- indra/llcommon/tests/llprocess_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 60ed12ad6a..6d2292fb88 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -186,7 +186,7 @@ public: "from __future__ import with_statement\n" "import os.path, sys, tempfile\n" "with open(sys.argv[1], 'w') as f:\n" - " f.write(os.path.realpath(tempfile.mkdtemp()))\n")) + " f.write(os.path.normcase(os.path.normpath(os.path.realpath(tempfile.mkdtemp()))))\n")) {} ~NamedTempDir() @@ -513,7 +513,7 @@ namespace tut "from __future__ import with_statement\n" "import os, sys\n" "with open(sys.argv[1], 'w') as f:\n" - " f.write(os.getcwd())\n"); + " f.write(os.path.normcase(os.path.normpath(os.getcwd())))\n"); // Before running, call setWorkingDirectory() py.mParams.cwd = tempdir.getName(); ensure_equals("os.getcwd()", py.run_read(), tempdir.getName()); -- cgit v1.2.3 From 33a42b32ca72031a79edca821966f6ebbdcddc93 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 7 Feb 2012 13:06:38 -0500 Subject: Disable MSVC warning C4702 (unreachable code) in Boost headers. --- indra/test/test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 3e7be29b39..1adcfb6f45 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -54,8 +54,16 @@ #include #endif +#if LL_MSVC +#pragma warning (push) +#pragma warning (disable : 4702) // warning C4702: unreachable code +#endif #include #include +#if LL_MSVC +#pragma warning (pop) +#endif + #include #include #include -- cgit v1.2.3 From 2d360cb08d2bee098168e3c3f5041ec37206f383 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 9 Feb 2012 07:44:23 -0500 Subject: Use new 3p-apr package builds for Windows, Mac. On Linux, new (Feb 2012) APR package produces link errors. Until those are resolved, leave Linux viewer build with older (Feb 2011) APR package. --- autobuild.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 9914be6867..9cecdd7f09 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -90,9 +90,9 @@ archive hash - 9868bfa0b6954e4884c49c6f30068c80 + 6e5172597f00380b5004b8a7911098b7 url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/apr_suite-1.4.2-darwin-20110217.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249125/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120208.tar.bz2 name darwin @@ -114,9 +114,9 @@ archive hash - 73785c200a5b4ef74a1230b028bb680d + a596a9974ae6bfe48dc61a2cd13bc321 url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/apr_suite-1.4.2-windows-20110217.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249125/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120208.tar.bz2 name windows -- cgit v1.2.3 From 94b8cd3fa602025e59f4395dc971c8ffa1ac86c5 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 9 Feb 2012 09:27:18 -0800 Subject: Enabled the 'Merchant Outbox' menu item and context menu --- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cebe93f042..c0065a94e6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -73,7 +73,7 @@ #include "llwearablelist.h" // Marketplace outbox current disabled -#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 0 +#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 0 #define BLOCK_WORN_ITEMS_IN_OUTBOX 1 diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index cd8550b00d..1d11abcf73 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -152,6 +152,13 @@ + + + -- cgit v1.2.3 From 58348bd862163261fb650d8afd50fd1dc5e2695a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 9 Feb 2012 15:07:02 -0500 Subject: Use newer (Linden extension) TC APR builds for Windows, Mac. --- autobuild.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 9cecdd7f09..80b1a8a709 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -90,9 +90,9 @@ archive hash - 6e5172597f00380b5004b8a7911098b7 + 71d4d242c41ec9ac4807989371279708 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249125/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120208.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249241/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120209.tar.bz2 name darwin @@ -114,9 +114,9 @@ archive hash - a596a9974ae6bfe48dc61a2cd13bc321 + 983378883a6eec65665875a3d1ba495f url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249125/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120208.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249241/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120209.tar.bz2 name windows -- cgit v1.2.3 From e5f81fdcc98ded831c48c4e31a4a215877e0a1e4 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Thu, 9 Feb 2012 15:17:34 -0500 Subject: Added tag DRTVWR-117_3.2.9-beta1, 3.2.9-beta1 for changeset e9c82fca5ae6 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 57b89e78b3..d4bf3a81f8 100644 --- a/.hgtags +++ b/.hgtags @@ -264,3 +264,5 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 987425b1acf4752379b2e1eb20944b4b35d67a85 DRTVWR-115_3.2.8-beta2 987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 37dd400ad721e2a89ee820ffc1e7e433c68f3ca2 3.2.9-start +e9c82fca5ae6fb8a8af29012d78fb194a29323f3 DRTVWR-117_3.2.9-beta1 +e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1 -- cgit v1.2.3 From 90a1b67cc43792e1ca0047eaca51530aa14e134c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 9 Feb 2012 15:22:24 -0500 Subject: Remove LLJob class: apr_procattr_autokill_set() should now handle. LLJob was vestigial code from before migrating Job Object support into APR. Also add APR signal-name string to getStatusString() output. --- indra/llcommon/llprocess.cpp | 70 +++----------------------------------------- 1 file changed, 4 insertions(+), 66 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 1305c1d764..7ccbdeed01 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -31,6 +31,7 @@ #include "llstring.h" #include "stringize.h" #include "llapr.h" +#include "apr_signal.h" #include #include @@ -274,10 +275,10 @@ std::string LLProcess::getStatusString(const std::string& desc, const Status& st #if LL_WINDOWS return STRINGIZE(desc << " killed with exception " << std::hex << status.mData); #else - return STRINGIZE(desc << " killed by signal " << status.mData); + return STRINGIZE(desc << " killed by signal " << status.mData + << " (" << apr_signal_description_get(status.mData) << ")"); #endif - return STRINGIZE(desc << " in unknown state " << status.mState << " (" << status.mData << ")"); } @@ -391,72 +392,9 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) static std::string WindowsErrorString(const std::string& operation); -/** - * Wrap a Windows Job Object for use in managing child-process lifespan. - * - * On Windows, we use a Job Object to constrain the lifespan of any - * autokill=true child process to the viewer's own lifespan: - * http://stackoverflow.com/questions/53208/how-do-i-automatically-destroy-child-processes-in-windows - * (thanks Richard!). - * - * We manage it using an LLSingleton for a couple of reasons: - * - * # Lazy initialization: if some viewer session never launches a child - * process, we should never have to create a Job Object. - * # Cross-DLL support: be wary of C++ statics when multiple DLLs are - * involved. - */ -class LLJob: public LLSingleton -{ -public: - void assignProcess(const std::string& prog, LLProcess::handle hProcess) - { - // If we never managed to initialize this Job Object, can't use it -- - // but don't keep spamming the log, we already emitted warnings when - // we first tried to create. - if (! mJob) - return; - - if (! AssignProcessToJobObject(mJob, hProcess)) - { - LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject(" - << prog << ")")) << LL_ENDL; - } - } - -private: - friend class LLSingleton; - LLJob(): - mJob(0) - { - mJob = CreateJobObject(NULL, NULL); - if (! mJob) - { - LL_WARNS("LLProcess") << WindowsErrorString("CreateJobObject()") << LL_ENDL; - return; - } - - JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; - - // Configure all child processes associated with this new job object - // to terminate when the calling process (us!) terminates. - jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; - if (! SetInformationJobObject(mJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) - { - LL_WARNS("LLProcess") << WindowsErrorString("SetInformationJobObject()") << LL_ENDL; - // This Job Object is useless to us - CloseHandle(mJob); - // prevent assignProcess() from trying to use it - mJob = 0; - } - } - - LLProcess::handle mJob; -}; - void LLProcess::autokill() { - LLJob::instance().assignProcess(mDesc, mProcess.hproc); + // hopefully now handled by apr_procattr_autokill_set() } LLProcess::handle LLProcess::isRunning(handle h, const std::string& desc) -- cgit v1.2.3 From 9011b04496796d7e51c20af0241ec05796e1ccac Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 Feb 2012 12:11:18 -0500 Subject: Try using Log's new APR packages for Windows, Mac, Linux. This APR merges work from Huseby, Log, Leslie, Nat. --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 80b1a8a709..a3a5dd0057 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -90,9 +90,9 @@ archive hash - 71d4d242c41ec9ac4807989371279708 + a2c41379bc0abc83b45246eebdafc4ab url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249241/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120209.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr/rev/249247/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120209.tar.bz2 name darwin @@ -102,9 +102,9 @@ archive hash - ff62946c518a247c86e1066c1e9a5855 + 1ad6e6bff18306cb5079128d5aadeb6e url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/apr_suite-1.4.2-linux-20110309.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr-lenny/rev/249247/arch/Linux/installer/apr_suite-1.4.5-linux-20120209.tar.bz2 name linux @@ -114,9 +114,9 @@ archive hash - 983378883a6eec65665875a3d1ba495f + 31cd12ea119753e389dc9be5ea82cbb3 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249241/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120209.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr/rev/249247/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120209.tar.bz2 name windows -- cgit v1.2.3 From 788343db01ed4f6c0e786745d4f01bf6f5d2dba5 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 10 Feb 2012 10:56:55 -0800 Subject: * Added timers to track the http transactions, visible through the same "InventoryOutboxLogging" debug flag. --- indra/newview/llmarketplacefunctions.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index a3f0a6062c..93dd82957f 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -30,6 +30,7 @@ #include "llagent.h" #include "llhttpclient.h" +#include "lltimer.h" #include "lltrans.h" #include "llviewercontrol.h" #include "llviewermedia.h" @@ -115,6 +116,9 @@ namespace LLMarketplaceImport static U32 sImportResultStatus = 0; static LLSD sImportResults = LLSD::emptyMap(); + static LLTimer slmGetTimer; + static LLTimer slmPostTimer; + // Responders class LLImportPostResponder : public LLHTTPClient::Responder @@ -124,11 +128,15 @@ namespace LLMarketplaceImport void completed(U32 status, const std::string& reason, const LLSD& content) { + slmPostTimer.stop(); + if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { llinfos << " SLM POST status: " << status << llendl; llinfos << " SLM POST reason: " << reason << llendl; llinfos << " SLM POST content: " << content.asString() << llendl; + + llinfos << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << llendl; } if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) || @@ -167,11 +175,15 @@ namespace LLMarketplaceImport void completed(U32 status, const std::string& reason, const LLSD& content) { + slmGetTimer.stop(); + if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { llinfos << " SLM GET status: " << status << llendl; llinfos << " SLM GET reason: " << reason << llendl; llinfos << " SLM GET content: " << content.asString() << llendl; + + llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl; } if ((status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) || @@ -247,6 +259,7 @@ namespace LLMarketplaceImport llinfos << " SLM GET: " << url << llendl; } + slmGetTimer.start(); LLHTTPClient::get(url, new LLImportGetResponder(), LLViewerMedia::getHeaders()); return true; @@ -277,6 +290,7 @@ namespace LLMarketplaceImport llinfos << " SLM GET: " << url << llendl; } + slmGetTimer.start(); LLHTTPClient::get(url, new LLImportGetResponder(), headers); return true; @@ -310,6 +324,7 @@ namespace LLMarketplaceImport llinfos << " SLM POST: " << url << llendl; } + slmPostTimer.start(); LLHTTPClient::post(url, LLSD(), new LLImportPostResponder(), headers); return true; -- cgit v1.2.3 From 077130eaee30883cb9e666584b3362e2481bd6dd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Feb 2012 14:28:16 -0600 Subject: SH-2963 Fix for highlight transparent not highlighting 100% transparent objects. --- indra/newview/lldrawpool.h | 1 + indra/newview/lldrawpoolalpha.cpp | 1 + indra/newview/llvovolume.cpp | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 5a2981e749..64774d06df 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -133,6 +133,7 @@ public: PASS_ALPHA, PASS_ALPHA_MASK, PASS_FULLBRIGHT_ALPHA_MASK, + PASS_ALPHA_INVISIBLE, NUM_RENDER_TYPES, }; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index ddb7d3ceeb..5b62dbc560 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -337,6 +337,7 @@ void LLDrawPoolAlpha::render(S32 pass) pushBatches(LLRenderPass::PASS_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE); pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE); + pushBatches(LLRenderPass::PASS_ALPHA_INVISIBLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE); if(shaders) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7492a06784..03d4c51aff 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4433,10 +4433,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) else { if (te->getColor().mV[3] > 0.f) - { + { //only treat as alpha in the pipeline if < 100% transparent drawablep->setState(LLDrawable::HAS_ALPHA); - alpha_faces.push_back(facep); } + alpha_faces.push_back(facep); } } else @@ -4947,7 +4947,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (is_alpha) { // can we safely treat this as an alpha mask? - if (facep->canRenderAsMask()) + if (facep->getFaceColor().mV[3] <= 0.f) + { //100% transparent, don't render unless we're highlighting transparent + registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE); + } + else if (facep->canRenderAsMask()) { if (te->getFullbright() || LLPipeline::sNoAlpha) { -- cgit v1.2.3 From bb5797efd955cd6bd496a13104f6b84715afef06 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 10 Feb 2012 12:41:20 -0800 Subject: Resized the Merchant Outbox spinner to its native size --- indra/newview/skins/default/xui/en/floater_merchant_outbox.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml index 498a9b6ce0..6f387f4800 100644 --- a/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml +++ b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml @@ -132,16 +132,16 @@ - - + + - + + width="24" /> -- cgit v1.2.3 From acd46062fd2edf4b45ab646cbacaf865b169ec30 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 Feb 2012 16:45:18 -0500 Subject: Eliminate ManifestError for wildcards matching 0 files. Turns out that some (many?) wildcard LLManifest.path(wildcard) calls are "just in case": sweep up any (e.g.) "*.tga" files there may be, but no problem if there are none. Change path() logic so it tries the next tree (source, artwork, build) if either a specific (non-wildcard) filename doesn't exist, as now, OR if a wildcard matches 0 files in the current tree. This continues to support "just in case" wildcards, while permitting wildcards to work in the artwork and build trees as well as the source tree. Use a more specific exception than ManifestError for missing file. Only in that case should we try the next tree. Any other ManifestError should propagate. --- indra/lib/python/indra/util/llmanifest.py | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 237153b756..a4fb77357c 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -42,6 +42,11 @@ import errno import subprocess class ManifestError(RuntimeError): + """Use an exception more specific than generic Python RuntimeError""" + pass + +class MissingError(ManifestError): + """You specified a file that doesn't exist""" pass def path_ancestors(path): @@ -604,16 +609,12 @@ class LLManifest(object): def check_file_exists(self, path): if not os.path.exists(path) and not os.path.islink(path): - raise ManifestError("Path %s doesn't exist" % (os.path.abspath(path),)) + raise MissingError("Path %s doesn't exist" % (os.path.abspath(path),)) wildcard_pattern = re.compile(r'\*') def expand_globs(self, src, dst): src_list = glob.glob(src) - # Assume that if caller specifies a wildcard, s/he wants it to match - # at least one file... - if not src_list: - raise ManifestError("Path %s doesn't exist" % (os.path.abspath(src),)) src_re, d_template = self.wildcard_regex(src.replace('\\', '/'), dst.replace('\\', '/')) for s in src_list: @@ -646,13 +647,23 @@ class LLManifest(object): else: count += self.process_file(src, dst) return count - try: - count = try_path(os.path.join(self.get_src_prefix(), src)) - except ManifestError: + + for pfx in self.get_src_prefix(), self.get_artwork_prefix(), self.get_build_prefix(): try: - count = try_path(os.path.join(self.get_artwork_prefix(), src)) - except ManifestError: - count = try_path(os.path.join(self.get_build_prefix(), src)) + count = try_path(os.path.join(pfx, src)) + except MissingError: + # If src isn't a wildcard, and if that file doesn't exist in + # this pfx, try next pfx. + count = 0 + continue + + # Here try_path() didn't raise MissingError. Did it process any files? + if count: + break + # Even though try_path() didn't raise MissingError, it returned 0 + # files. src is probably a wildcard meant for some other pfx. Loop + # back to try the next. + print "%d files" % count def do(self, *actions): -- cgit v1.2.3 From 8804fa524c084edb9f49f4122e2c7330a80c79b5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 11 Feb 2012 06:16:39 -0500 Subject: Update viewer to official builds of http://hg.secondlife.com/3p-apr. --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index a3a5dd0057..99fa201ee3 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -90,9 +90,9 @@ archive hash - a2c41379bc0abc83b45246eebdafc4ab + 15333927db9f249daefcaed70fc6683c url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr/rev/249247/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120209.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120210.tar.bz2 name darwin @@ -102,9 +102,9 @@ archive hash - 1ad6e6bff18306cb5079128d5aadeb6e + 297508ece8b0f334bae842fd147f2962 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr-lenny/rev/249247/arch/Linux/installer/apr_suite-1.4.5-linux-20120209.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/Linux/installer/apr_suite-1.4.5-linux-20120211.tar.bz2 name linux @@ -114,9 +114,9 @@ archive hash - 31cd12ea119753e389dc9be5ea82cbb3 + 7ad1e767f4419a6d35a70abba1edbcdc url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/log_3p-apr/rev/249247/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120209.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120210.tar.bz2 name windows -- cgit v1.2.3 From 0f2882ec95fc6cd2649fbe4e952ce1bc586bb853 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 13 Feb 2012 09:41:50 -0500 Subject: Suppress a specific unused-var warning on Posix platforms. --- indra/llcommon/llprocess.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 7ccbdeed01..de71595f16 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -120,7 +120,9 @@ LLProcess::LLProcess(const LLSDOrParams& params): // As of 2012-02-02, we only expect this to be implemented on Windows. // Avoid spamming the log with warnings we fully expect. ll_apr_warn_status(ok); -# endif // LL_WINDOWS +#else // ! LL_WINDOWS + (void)ok; // suppress 'unused' warning +# endif // ! LL_WINDOWS #else LL_WARNS("LLProcess") << "This version of APR lacks Linden apr_procattr_autokill_set() extension" << LL_ENDL; #endif -- cgit v1.2.3 From d4f887e43ccf0a8b7a84ebbfe6889462a1d9c25f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 13 Feb 2012 16:18:46 -0500 Subject: Add unit tests for LLProcess::Status functionality. --- indra/llcommon/tests/llprocess_test.cpp | 46 +++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 6d2292fb88..711715e373 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -555,6 +555,41 @@ namespace tut template<> template<> void object::test<4>() + { + set_test_name("exit(0)"); + PythonProcessLauncher py("exit(0)", + "import sys\n" + "sys.exit(0)\n"); + py.run(); + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, 0); + } + + template<> template<> + void object::test<5>() + { + set_test_name("exit(2)"); + PythonProcessLauncher py("exit(2)", + "import sys\n" + "sys.exit(2)\n"); + py.run(); + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, 2); + } + + template<> template<> + void object::test<6>() + { + set_test_name("syntax_error:"); + PythonProcessLauncher py("syntax_error:", + "syntax_error:\n"); + py.run(); + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, 1); + } + + template<> template<> + void object::test<7>() { set_test_name("explicit kill()"); PythonProcessLauncher py("kill()", @@ -588,6 +623,13 @@ namespace tut { sleep(1); } +#if LL_WINDOWS + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, -1); +#else + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::KILLED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, SIGTERM); +#endif // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. @@ -595,7 +637,7 @@ namespace tut } template<> template<> - void object::test<5>() + void object::test<8>() { set_test_name("implicit kill()"); NamedTempFile out("out", "not started"); @@ -641,7 +683,7 @@ namespace tut } template<> template<> - void object::test<6>() + void object::test<9>() { set_test_name("autokill=false"); NamedTempFile from("from", "not started"); -- cgit v1.2.3 From aae61392be822218cabcab91d95eb1e75d471764 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 13 Feb 2012 17:38:25 -0500 Subject: Use per-frame ticks on "mainloop" LLEventPump to update LLProcess. When we reimplemented LLProcess on APR, necessitating APR's funny callback mechanism to sense child-process status, every isRunning() or getStatus() call called the APR poll function that calls ALL registered LLProcess callbacks. In other words, every time any consumer called any LLProcess::isRunning() method, all LLProcess callbacks were redundantly fired. Change that so that the single APR poll function is called once per frame, courtesy of the "mainloop" LLEventPump. Once per viewer frame should be well within the realtime duration in which it's reasonable to expect child-process status to change. In effect, this changes LLProcess's public API to introduce a dependency on "mainloop" ticks. Add such ticks to llprocess_test.cpp as well. --- indra/llcommon/llprocess.cpp | 96 ++++++++++++++++++++++++++------- indra/llcommon/llprocess.h | 20 ++++--- indra/llcommon/tests/llprocess_test.cpp | 42 +++++++++------ 3 files changed, 114 insertions(+), 44 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index de71595f16..b13e8eb8e0 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -32,8 +32,10 @@ #include "stringize.h" #include "llapr.h" #include "apr_signal.h" +#include "llevents.h" #include +#include #include #include @@ -47,6 +49,74 @@ struct LLProcessError: public std::runtime_error LLProcessError(const std::string& msg): std::runtime_error(msg) {} }; +/** + * Ref-counted "mainloop" listener. As long as there are still outstanding + * LLProcess objects, keep listening on "mainloop" so we can keep polling APR + * for process status. + */ +class LLProcessListener +{ + LOG_CLASS(LLProcessListener); +public: + LLProcessListener(): + mCount(0) + {} + + void addPoll(const LLProcess&) + { + // Unconditionally increment mCount. If it was zero before + // incrementing, listen on "mainloop". + if (mCount++ == 0) + { + LL_DEBUGS("LLProcess") << "listening on \"mainloop\"" << LL_ENDL; + mConnection = LLEventPumps::instance().obtain("mainloop") + .listen("LLProcessListener", boost::bind(&LLProcessListener::tick, this, _1)); + } + } + + void dropPoll(const LLProcess&) + { + // Unconditionally decrement mCount. If it's zero after decrementing, + // stop listening on "mainloop". + if (--mCount == 0) + { + LL_DEBUGS("LLProcess") << "disconnecting from \"mainloop\"" << LL_ENDL; + mConnection.disconnect(); + } + } + +private: + /// called once per frame by the "mainloop" LLEventPump + bool tick(const LLSD&) + { + // Tell APR to sense whether each registered LLProcess is still + // running and call handle_status() appropriately. We should be able + // to get the same info from an apr_proc_wait(APR_NOWAIT) call; but at + // least in APR 1.4.2, testing suggests that even with APR_NOWAIT, + // apr_proc_wait() blocks the caller. We can't have that in the + // viewer. Hence the callback rigmarole. (Once we update APR, it's + // probably worth testing again.) Also -- although there's an + // apr_proc_other_child_refresh() call, i.e. get that information for + // one specific child, it accepts an 'apr_other_child_rec_t*' that's + // mentioned NOWHERE else in the documentation or header files! I + // would use the specific call in LLProcess::getStatus() if I knew + // how. As it is, each call to apr_proc_other_child_refresh_all() will + // call callbacks for ALL still-running child processes. That's why we + // centralize such calls, using "mainloop" to ensure it happens once + // per frame, and refcounting running LLProcess objects to remain + // registered only while needed. + LL_DEBUGS("LLProcess") << "calling apr_proc_other_child_refresh_all()" << LL_ENDL; + apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); + return false; + } + + /// If this object is destroyed before mCount goes to zero, stop + /// listening on "mainloop" anyway. + LLTempBoundListener mConnection; + unsigned mCount; +}; +static LLProcessListener sProcessListener; + LLProcessPtr LLProcess::create(const LLSDOrParams& params) { try @@ -159,6 +229,8 @@ LLProcess::LLProcess(const LLSDOrParams& params): // arrange to call status_callback() apr_proc_other_child_register(&mProcess, &LLProcess::status_callback, this, mProcess.in, gAPRPoolp); + // and make sure we poll it once per "mainloop" tick + sProcessListener.addPoll(*this); mStatus.mState = RUNNING; mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcess.pid << ')'); @@ -195,6 +267,8 @@ LLProcess::~LLProcess() // information updated in this object by such a callback is no longer // available to any consumer anyway. apr_proc_other_child_unregister(this); + // One less LLProcess to poll for + sProcessListener.dropPoll(*this); } if (mAutokill) @@ -228,26 +302,6 @@ bool LLProcess::isRunning(void) LLProcess::Status LLProcess::getStatus() { - // Only when mState is RUNNING might the status change dynamically. For - // any other value, pointless to attempt to update status: it won't - // change. - if (mStatus.mState == RUNNING) - { - // Tell APR to sense whether the child is still running and call - // handle_status() appropriately. We should be able to get the same - // info from an apr_proc_wait(APR_NOWAIT) call; but at least in APR - // 1.4.2, testing suggests that even with APR_NOWAIT, apr_proc_wait() - // blocks the caller. We can't have that in the viewer. Hence the - // callback rigmarole. Once we update APR, it's probably worth testing - // again. Also -- although there's an apr_proc_other_child_refresh() - // call, i.e. get that information for one specific child, it accepts - // an 'apr_other_child_rec_t*' that's mentioned NOWHERE else in the - // documentation or header files! I would use the specific call if I - // knew how. As it is, each call to this method will call callbacks - // for ALL still-running child processes. Sigh... - apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); - } - return mStatus; } @@ -341,6 +395,8 @@ void LLProcess::handle_status(int reason, int status) // it already knows the child has terminated. We must pass the same 'data' // pointer as for the register() call, which was our 'this'. apr_proc_other_child_unregister(this); + // don't keep polling for a terminated process + sProcessListener.dropPoll(*this); // We overload mStatus.mState to indicate whether the child is registered // for APR callback: only RUNNING means registered. Track that we've // unregistered. We know the child has terminated; might be EXITED or diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 0de033c15b..b95ae55701 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -49,9 +49,17 @@ class LLProcess; typedef boost::shared_ptr LLProcessPtr; /** - * LLProcess handles launching external processes with specified command line arguments. - * It also keeps track of whether the process is still running, and can kill it if required. -*/ + * LLProcess handles launching an external process with specified command line + * arguments. It also keeps track of whether the process is still running, and + * can kill it if required. + * + * LLProcess relies on periodic post() calls on the "mainloop" LLEventPump: an + * LLProcess object's Status won't update until the next "mainloop" tick. The + * viewer's main loop already posts to that LLEventPump once per iteration + * (hence the name). See indra/llcommon/tests/llprocess_test.cpp for an + * example of waiting for child-process termination in a standalone test + * context. + */ class LL_COMMON_API LLProcess: public boost::noncopyable { LOG_CLASS(LLProcess); @@ -72,11 +80,7 @@ public: * zero or more additional command-line arguments. Arguments are * passed through as exactly as we can manage, whitespace and all. * @note On Windows we manage this by implicitly double-quoting each - * argument while assembling the command line. BUT if a given argument - * is already double-quoted, we don't double-quote it again. Try to - * avoid making use of this, though, as on Mac and Linux explicitly - * double-quoted args will be passed to the child process including - * the double quotes. + * argument while assembling the command line. */ Multiple args; /// current working directory, if need it changed diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 711715e373..8c21be196b 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -33,6 +33,7 @@ #include "../test/namedtempfile.h" #include "stringize.h" #include "llsdutil.h" +#include "llevents.h" #if defined(LL_WINDOWS) #define sleep(secs) _sleep((secs) * 1000) @@ -88,6 +89,27 @@ static std::string readfile(const std::string& pathname, const std::string& desc return output; } +/// Looping on LLProcess::isRunning() must now be accompanied by pumping +/// "mainloop" -- otherwise the status won't update and you get an infinite +/// loop. +void waitfor(LLProcess& proc) +{ + while (proc.isRunning()) + { + sleep(1); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); + } +} + +void waitfor(LLProcess::handle h, const std::string& desc) +{ + while (LLProcess::isRunning(h, desc)) + { + sleep(1); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); + } +} + /** * Construct an LLProcess to run a Python script. */ @@ -120,10 +142,7 @@ struct PythonProcessLauncher // there's no API to wait for the child to terminate -- but given // its use in our graphics-intensive interactive viewer, it's // understandable. - while (mPy->isRunning()) - { - sleep(1); - } + waitfor(*mPy); } /** @@ -619,10 +638,7 @@ namespace tut // script has performed its first write and should now be sleeping. py.mPy->kill(); // wait for the script to terminate... one way or another. - while (py.mPy->isRunning()) - { - sleep(1); - } + waitfor(*py.mPy); #if LL_WINDOWS ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("Status.mData", py.mPy->getStatus().mData, -1); @@ -672,10 +688,7 @@ namespace tut // Destroy the LLProcess, which should kill the child. } // wait for the script to terminate... one way or another. - while (LLProcess::isRunning(phandle, "kill() script")) - { - sleep(1); - } + waitfor(phandle, "kill() script"); // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. @@ -737,10 +750,7 @@ namespace tut outf << "go"; } // flush and close. // now wait for the script to terminate... one way or another. - while (LLProcess::isRunning(phandle, "autokill script")) - { - sleep(1); - } + waitfor(phandle, "autokill script"); // If the LLProcess destructor implicitly called kill(), the // script could not have written 'ack' as we expect. ensure_equals("autokill script output", readfile(from.getName()), "ack"); -- cgit v1.2.3 From 03c002641ed1720f07a8c704219abd704a369043 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 13 Feb 2012 15:43:47 -0800 Subject: EXP-1888 FIX -- Update text for emtpy Received Items folder in the Viewer --- indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 2 +- indra/newview/skins/default/xui/en/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index fcba937bdb..29aa6d1039 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -112,7 +112,7 @@ bg_opaque_color="InventoryBackgroundColor" background_visible="true" background_opaque="true" - tool_tip="Drag and drop items to your inventory to manage and use them" + tool_tip="Drag and drop items to your inventory to use them" > Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search]. Drag a landmark here to add it to your favorites. You do not have a copy of this texture in your inventory - Certain items you receive, such as premium gifts, will appear here. You may then drag them into your inventory. + Certain items you receive, such as Marketplace purchases and objects shared with you in world, will appear here. You may then drag them into your inventory to use them. https://marketplace.[MARKETPLACE_DOMAIN_NAME]/ http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4 https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard -- cgit v1.2.3 From ca179444a1fb56bb42896c735b23906460c40d88 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 13 Feb 2012 19:13:22 -0600 Subject: SH-2973 Potential fix for crash in ~LLVOAvatarSelf --- indra/newview/llappviewer.cpp | 2 ++ indra/newview/lldriverparam.cpp | 2 +- indra/newview/llvoavatarself.cpp | 5 +++-- indra/newview/llvoavatarself.h | 2 +- indra/newview/llwearable.cpp | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 49fbdbf1df..3a257e1f1c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1769,6 +1769,8 @@ bool LLAppViewer::cleanup() LLAvatarIconIDCache::getInstance()->save(); + gAgentAvatarp = NULL; + LLViewerMedia::saveCookieFile(); // Stop the plugin read thread if it's running. diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 8f47d3c5e5..64eb11fc9b 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -139,7 +139,7 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl; + llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl; } out << std::endl; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index f1df67494f..e525d6bad0 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -66,10 +66,11 @@ #include -LLVOAvatarSelf *gAgentAvatarp = NULL; +LLPointer gAgentAvatarp = NULL; + BOOL isAgentAvatarValid() { - return (gAgentAvatarp && + return (gAgentAvatarp.notNull() && (gAgentAvatarp->getRegion() != NULL) && (!gAgentAvatarp->isDead())); } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 54dbe81993..655fb3a012 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -383,7 +383,7 @@ private: }; -extern LLVOAvatarSelf *gAgentAvatarp; +extern LLPointer gAgentAvatarp; BOOL isAgentAvatarValid(); diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index d8aa0b7d5c..0f7f63061b 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -221,7 +221,7 @@ void LLWearable::createVisualParams() param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { - if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true)) + if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true)) { llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; -- cgit v1.2.3 From 52782548c83dc0ca0fc8352e1a3ad68784116a91 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 14 Feb 2012 17:09:42 -0600 Subject: SH-2973 Rearrange shutdown operations to prevent crash on exit on OSX --- indra/newview/llappviewer.cpp | 5 +++-- indra/newview/llviewerwindow.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a257e1f1c..1174d108d2 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1487,6 +1487,9 @@ void LLAppViewer::flushVFSIO() bool LLAppViewer::cleanup() { + //ditch LLVOAvatarSelf instance + gAgentAvatarp = NULL; + // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); @@ -1769,8 +1772,6 @@ bool LLAppViewer::cleanup() LLAvatarIconIDCache::getInstance()->save(); - gAgentAvatarp = NULL; - LLViewerMedia::saveCookieFile(); // Stop the plugin read thread if it's running. diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8a713ae22c..e0653fec30 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2021,6 +2021,12 @@ void LLViewerWindow::shutdownGL() gSky.cleanup(); stop_glerror(); + llinfos << "Cleaning up pipeline" << llendl; + gPipeline.cleanup(); + stop_glerror(); + + //MUST clean up pipeline before cleaning up wearables + llinfos << "Cleaning up wearables" << llendl; LLWearableList::instance().cleanup() ; gTextureList.shutdown(); @@ -2031,10 +2037,6 @@ void LLViewerWindow::shutdownGL() LLWorldMapView::cleanupTextures(); - llinfos << "Cleaning up pipeline" << llendl; - gPipeline.cleanup(); - stop_glerror(); - LLViewerTextureManager::cleanup() ; LLImageGL::cleanupClass() ; -- cgit v1.2.3 From e239cad1f509e3d96011acb61614f2481c46af38 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 10:07:09 -0500 Subject: Preliminary pipe support for LLProcess. Add LLProcess::FileParam to specify how to construct each child's standard file slot, with lots of comments about features designed but not yet implemented. The point is to design it with enough flexibility to be able to extend to foreseeable use cases. Add LLProcess::Params::files to collect up to 3 FileParam items. Naturally this extends the accepted LLSD syntax as well. Implement type="" (child inherits parent file descriptor) and "pipe" (parent constructs anonymous pipe to pass to child). Add LLProcess::FILESLOT enum, plus methods: getReadPipe(FILESLOT), getOptReadPipe(FILESLOT) getWritePipe(), getOptWritePipe() getPipeName(FILESLOT): placeholder implementation for now Add LLProcess::ReadPipe and WritePipe classes, as returned by get*Pipe(). WritePipe supports get_ostream() method for streaming to child stdin. ReadPipe supports get_istream() method for reading from child stdout/stderr. It also provides getPump() returning LLEventPump& so interested parties can listen for arrival of new data on the aforementioned std::istream. For "pipe" slots, instantiate appropriate *Pipe class. ReadPipe and WritePipe classes are pure virtual bases for ReadPipeImpl and WritePipeImpl, respectively: all implementation data are hidden in the latter classes, visible only in llprocess.cpp. In fact each *PipeImpl class registers itself for "mainloop" ticks, attempting nonblocking I/O to the underlying apr_file_t on each tick. Data are buffered in a boost::asio::streambuf, which bridges between std::[io]stream and the APR I/O calls. Sanity-test ReadPipeImpl by using a pipe to absorb the Python "SyntaxError" output from the successful syntax_error test, rather than alarming the user. Add first few unit tests for validating FileParam. More tests coming! --- indra/llcommon/llprocess.cpp | 321 ++++++++++++++++++++++++++++++-- indra/llcommon/llprocess.h | 235 ++++++++++++++++++++++- indra/llcommon/tests/llprocess_test.cpp | 171 ++++++++++++++++- 3 files changed, 695 insertions(+), 32 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index b13e8eb8e0..55eb7e69d3 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -26,6 +26,7 @@ #include "linden_common.h" #include "llprocess.h" +#include "llsdutil.h" #include "llsdserialize.h" #include "llsingleton.h" #include "llstring.h" @@ -36,19 +37,20 @@ #include #include +#include +#include #include #include +#include +#include +#include +#include +#include +static const char* whichfile[] = { "stdin", "stdout", "stderr" }; static std::string empty; static LLProcess::Status interpret_status(int status); -/// Need an exception to avoid constructing an invalid LLProcess object, but -/// internal use only -struct LLProcessError: public std::runtime_error -{ - LLProcessError(const std::string& msg): std::runtime_error(msg) {} -}; - /** * Ref-counted "mainloop" listener. As long as there are still outstanding * LLProcess objects, keep listening on "mainloop" so we can keep polling APR @@ -117,6 +119,154 @@ private: }; static LLProcessListener sProcessListener; +LLProcess::BasePipe::~BasePipe() {} + +class WritePipeImpl: public LLProcess::WritePipe +{ +public: + WritePipeImpl(const std::string& desc, apr_file_t* pipe): + mDesc(desc), + mPipe(pipe), + // Essential to initialize our std::ostream with our special streambuf! + mStream(&mStreambuf) + { + mConnection = LLEventPumps::instance().obtain("mainloop") + .listen(LLEventPump::inventName("WritePipe"), + boost::bind(&WritePipeImpl::tick, this, _1)); + } + + virtual std::ostream& get_ostream() { return mStream; } + + bool tick(const LLSD&) + { + // If there's anything to send, try to send it. + if (mStreambuf.size()) + { + // Copy data out from mStreambuf to a flat, contiguous buffer to + // write -- but only up to a certain size. + std::streamsize total(mStreambuf.size()); + std::streamsize bufsize((std::min)(4096, total)); + boost::asio::streambuf::const_buffers_type bufs = mStreambuf.data(); + std::vector buffer( + boost::asio::buffers_begin(bufs), + boost::asio::buffers_begin(bufs) + bufsize); + apr_size_t written(bufsize); + ll_apr_warn_status(apr_file_write(mPipe, &buffer[0], &written)); + // 'written' is modified to reflect the number of bytes actually + // written. Since they've been sent, remove them from the + // streambuf so we don't keep trying to send them. This could be + // anywhere from 0 up to mStreambuf.size(); anything we haven't + // yet sent, we'll try again next tick() call. + mStreambuf.consume(written); + LL_DEBUGS("LLProcess") << "wrote " << written << " of " << bufsize + << " bytes to " << mDesc + << " (original " << total << "), " + << mStreambuf.size() << " remaining" << LL_ENDL; + } + return false; + } + +private: + std::string mDesc; + apr_file_t* mPipe; + LLTempBoundListener mConnection; + boost::asio::streambuf mStreambuf; + std::ostream mStream; +}; + +class ReadPipeImpl: public LLProcess::ReadPipe +{ +public: + ReadPipeImpl(const std::string& desc, apr_file_t* pipe): + mDesc(desc), + mPipe(pipe), + // Essential to initialize our std::istream with our special streambuf! + mStream(&mStreambuf), + mPump("ReadPipe"), + // use funky syntax to call max() to avoid blighted max() macros + mLimit((std::numeric_limits::max)()) + { + mConnection = LLEventPumps::instance().obtain("mainloop") + .listen(LLEventPump::inventName("ReadPipe"), + boost::bind(&ReadPipeImpl::tick, this, _1)); + } + + // Much of the implementation is simply connecting the abstract virtual + // methods with implementation data concealed from the base class. + virtual std::istream& get_istream() { return mStream; } + virtual LLEventPump& getPump() { return mPump; } + virtual void setLimit(size_t limit) { mLimit = limit; } + virtual size_t getLimit() const { return mLimit; } + +private: + bool tick(const LLSD&) + { + // Allocate a buffer and try, every time, to read into it. + std::vector buffer(4096); + apr_size_t gotten(buffer.size()); + apr_status_t err = apr_file_read(mPipe, &buffer[0], &gotten); + if (err == APR_EOF) + { + // Handle EOF specially: it's part of normal-case processing. + LL_DEBUGS("LLProcess") << "EOF on " << mDesc << LL_ENDL; + // We won't need any more tick() calls. + mConnection.disconnect(); + } + else if (! ll_apr_warn_status(err)) // validate anything but EOF + { + // 'gotten' was modified to reflect the number of bytes actually + // received. If nonzero, add them to the streambuf and notify + // interested parties. + if (gotten) + { + boost::asio::streambuf::mutable_buffers_type mbufs = mStreambuf.prepare(gotten); + std::copy(buffer.begin(), buffer.begin() + gotten, + boost::asio::buffers_begin(mbufs)); + // Don't forget to "commit" the data! The sequence (prepare(), + // commit()) is obviously intended to allow us to allocate + // buffer space, then read directly into some portion of it, + // then commit only as much as we managed to obtain. But the + // only official (documented) way I can find to populate a + // mutable_buffers_type is to use buffers_begin(). It Would Be + // Nice if we were permitted to directly read into + // mutable_buffers_type (not to mention writing directly from + // const_buffers_type in WritePipeImpl; APR even supports an + // apr_file_writev() function for writing from discontiguous + // buffers) -- but as of 2012-02-14, this copying appears to + // be the safest tactic. + mStreambuf.commit(gotten); + LL_DEBUGS("LLProcess") << "read " << gotten << " of " << buffer.size() + << " bytes from " << mDesc << ", new total " + << mStreambuf.size() << LL_ENDL; + + // Now that we've received new data, publish it on our + // LLEventPump as advertised. Constrain it by mLimit. + std::streamsize datasize((std::min)(mLimit, mStreambuf.size())); + boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); + mPump.post(LLSDMap("data", LLSD::String( + boost::asio::buffers_begin(cbufs), + boost::asio::buffers_begin(cbufs) + datasize))); + } + } + return false; + } + + std::string mDesc; + apr_file_t* mPipe; + LLTempBoundListener mConnection; + boost::asio::streambuf mStreambuf; + std::istream mStream; + LLEventStream mPump; + size_t mLimit; +}; + +/// Need an exception to avoid constructing an invalid LLProcess object, but +/// internal use only +struct LLProcessError: public std::runtime_error +{ + LLProcessError(const std::string& msg): std::runtime_error(msg) {} +}; + LLProcessPtr LLProcess::create(const LLSDOrParams& params) { try @@ -134,12 +284,23 @@ LLProcessPtr LLProcess::create(const LLSDOrParams& params) /// throw LLProcessError mentioning the function call that produced that /// result. #define chkapr(func) \ - if (ll_apr_warn_status(func)) \ - throw LLProcessError(#func " failed") + if (ll_apr_warn_status(func)) \ + throw LLProcessError(#func " failed") LLProcess::LLProcess(const LLSDOrParams& params): - mAutokill(params.autokill) + mAutokill(params.autokill), + mPipes(NSLOTS) { + // Hmm, when you construct a ptr_vector with a size, it merely reserves + // space, it doesn't actually make it that big. Explicitly make it bigger. + // Because of ptr_vector's odd semantics, have to push_back(0) the right + // number of times! resize() wants to default-construct new BasePipe + // instances, which fails because it's pure virtual. But because of the + // constructor call, these push_back() calls should require no new + // allocation. + for (size_t i = 0; i < mPipes.capacity(); ++i) + mPipes.push_back(0); + if (! params.validateBlock(true)) { throw LLProcessError(STRINGIZE("not launched: failed parameter validation\n" @@ -154,16 +315,46 @@ LLProcess::LLProcess(const LLSDOrParams& params): // apr_procattr_io_set() alternatives: inherit the viewer's own stdxxx // handle (APR_NO_PIPE, e.g. for stdout, stderr), or create a pipe that's // blocking on the child end but nonblocking at the viewer end - // (APR_CHILD_BLOCK). The viewer can't block for anything: the parent end - // MUST be nonblocking. As the APR documentation itself points out, it - // makes very little sense to set nonblocking I/O for the child end of a - // pipe: only a specially-written child could deal with that. + // (APR_CHILD_BLOCK). // Other major options could include explicitly creating a single APR pipe // and passing it as both stdout and stderr (apr_procattr_child_out_set(), // apr_procattr_child_err_set()), or accepting a filename, opening it and // passing that apr_file_t (simple <, >, 2> redirect emulation). -// chkapr(apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK)); - chkapr(apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE)); + std::vector fparams(params.files.begin(), params.files.end()); + // By default, pass APR_NO_PIPE for each slot. + std::vector select(LL_ARRAY_SIZE(whichfile), APR_NO_PIPE); + for (size_t i = 0; i < (std::min)(LL_ARRAY_SIZE(whichfile), fparams.size()); ++i) + { + if (std::string(fparams[i].type).empty()) // inherit our file descriptor + { + select[i] = APR_NO_PIPE; + } + else if (std::string(fparams[i].type) == "pipe") // anonymous pipe + { + if (! std::string(fparams[i].name).empty()) + { + LL_WARNS("LLProcess") << "For " << std::string(params.executable) + << ": internal names for reusing pipes ('" + << std::string(fparams[i].name) << "' for " << whichfile[i] + << ") are not yet supported -- creating distinct pipe" + << LL_ENDL; + } + // The viewer can't block for anything: the parent end MUST be + // nonblocking. As the APR documentation itself points out, it + // makes very little sense to set nonblocking I/O for the child + // end of a pipe: only a specially-written child could deal with + // that. + select[i] = APR_CHILD_BLOCK; + } + else + { + throw LLProcessError(STRINGIZE("For " << std::string(params.executable) + << ": unsupported FileParam for " << whichfile[i] + << ": type='" << std::string(fparams[i].type) + << "', name='" << std::string(fparams[i].name) << "'")); + } + } + chkapr(apr_procattr_io_set(procattr, select[STDIN], select[STDOUT], select[STDERR])); // Thumbs down on implicitly invoking the shell to invoke the child. From // our point of view, the other major alternative to APR_PROGRAM_PATH @@ -251,6 +442,27 @@ LLProcess::LLProcess(const LLSDOrParams& params): // On Windows, associate the new child process with our Job Object. autokill(); } + + // Instantiate the proper pipe I/O machinery + // want to be able to point to apr_proc_t::in, out, err by index + typedef apr_file_t* apr_proc_t::*apr_proc_file_ptr; + static apr_proc_file_ptr members[] = + { &apr_proc_t::in, &apr_proc_t::out, &apr_proc_t::err }; + for (size_t i = 0; i < NSLOTS; ++i) + { + if (select[i] != APR_CHILD_BLOCK) + continue; + if (i == STDIN) + { + mPipes.replace(i, new WritePipeImpl(whichfile[i], mProcess.*(members[i]))); + } + else + { + mPipes.replace(i, new ReadPipeImpl(whichfile[i], mProcess.*(members[i]))); + } + LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() + << "('" << whichfile[i] << "')" << LL_ENDL; + } } LLProcess::~LLProcess() @@ -428,6 +640,83 @@ LLProcess::handle LLProcess::getProcessHandle() const #endif } +std::string LLProcess::getPipeName(FILESLOT) +{ + // LLProcess::FileParam::type "npipe" is not yet implemented + return ""; +} + +template +PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) +{ + if (slot >= NSLOTS) + { + error = STRINGIZE(mDesc << " has no slot " << slot); + return NULL; + } + if (mPipes.is_null(slot)) + { + error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a monitored pipe"); + return NULL; + } + // Make sure we dynamic_cast in pointer domain so we can test, rather than + // accepting runtime's exception. + PIPETYPE* ppipe = dynamic_cast(&mPipes[slot]); + if (! ppipe) + { + error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a " << typeid(PIPETYPE).name()); + return NULL; + } + + error.clear(); + return ppipe; +} + +template +PIPETYPE& LLProcess::getPipe(FILESLOT slot) +{ + std::string error; + PIPETYPE* wp = getPipePtr(error, slot); + if (! wp) + { + throw NoPipe(error); + } + return *wp; +} + +template +boost::optional LLProcess::getOptPipe(FILESLOT slot) +{ + std::string error; + PIPETYPE* wp = getPipePtr(error, slot); + if (! wp) + { + LL_DEBUGS("LLProcess") << error << LL_ENDL; + return boost::optional(); + } + return *wp; +} + +LLProcess::WritePipe& LLProcess::getWritePipe(FILESLOT slot) +{ + return getPipe(slot); +} + +boost::optional LLProcess::getOptWritePipe(FILESLOT slot) +{ + return getOptPipe(slot); +} + +LLProcess::ReadPipe& LLProcess::getReadPipe(FILESLOT slot) +{ + return getPipe(slot); +} + +boost::optional LLProcess::getOptReadPipe(FILESLOT slot) +{ + return getOptPipe(slot); +} + std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) { std::string cwd(params.cwd); diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index b95ae55701..448a88f4c0 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -31,8 +31,11 @@ #include "llsdparam.h" #include "apr_thread_proc.h" #include +#include +#include #include #include // std::ostream +#include #if LL_WINDOWS #define WIN32_LEAN_AND_MEAN @@ -43,6 +46,8 @@ #endif #endif +class LLEventPump; + class LLProcess; /// LLProcess instances are created on the heap by static factory methods and /// managed by ref-counted pointers. @@ -64,6 +69,87 @@ class LL_COMMON_API LLProcess: public boost::noncopyable { LOG_CLASS(LLProcess); public: + /** + * Specify what to pass for each of child stdin, stdout, stderr. + * @see LLProcess::Params::files. + */ + struct FileParam: public LLInitParam::Block + { + /** + * type of file handle to pass to child process + * + * - "" (default): let the child inherit the same file handle used by + * this process. For instance, if passed as stdout, child stdout + * will be interleaved with stdout from this process. In this case, + * @a name is moot and should be left "". + * + * - "file": open an OS filesystem file with the specified @a name. + * Not yet implemented. + * + * - "pipe" or "tpipe" or "npipe": depends on @a name + * + * - @a name.empty(): construct an OS pipe used only for this slot + * of the forthcoming child process. + * + * - ! @a name.empty(): in a global registry, find or create (using + * the specified @a name) an OS pipe. The point of the (purely + * internal) @a name is that passing the same @a name in more than + * one slot for a given LLProcess -- or for slots in different + * LLProcess instances -- means the same pipe. For example, you + * might pass the same @a name value as both stdout and stderr to + * make the child process produce both on the same actual pipe. Or + * you might pass the same @a name as the stdout for one LLProcess + * and the stdin for another to connect the two child processes. + * Use LLProcess::getPipeName() to generate a unique name + * guaranteed not to already exist in the registry. Not yet + * implemented. + * + * The difference between "pipe", "tpipe" and "npipe" is as follows. + * + * - "pipe": direct LLProcess to monitor the parent end of the pipe, + * pumping nonblocking I/O every frame. The expectation (at least + * for stdout or stderr) is that the caller will listen for + * incoming data and consume it as it arrives. It's important not + * to neglect such a pipe, because it's buffered in viewer memory. + * If you suspect the child may produce a great volume of output + * between viewer frames, consider directing the child to write to + * a filesystem file instead, then read the file later. + * + * - "tpipe": do not engage LLProcess machinery to monitor the + * parent end of the pipe. A "tpipe" is used only to connect + * different child processes. As such, it makes little sense to + * pass an empty @a name. Not yet implemented. + * + * - "npipe": like "tpipe", but use an OS named pipe with a + * generated name. Note that @a name is the @em internal name of + * the pipe in our global registry -- it doesn't necessarily have + * anything to do with the pipe's name in the OS filesystem. Use + * LLProcess::getPipeName() to obtain the named pipe's OS + * filesystem name, e.g. to pass it as the @a name to another + * LLProcess instance using @a type "file". This supports usage + * like bash's <(subcommand...) or >(subcommand...) + * constructs. Not yet implemented. + * + * In all cases the open mode (read, write) is determined by the child + * slot you're filling. Child stdin means select the "read" end of a + * pipe, or open a filesystem file for reading; child stdout or stderr + * means select the "write" end of a pipe, or open a filesystem file + * for writing. + * + * Confusion such as passing the same pipe as the stdin of two + * processes (rather than stdout for one and stdin for the other) is + * explicitly permitted: it's up to the caller to construct meaningful + * LLProcess pipe graphs. + */ + Optional type; + Optional name; + + FileParam(const std::string& tp="", const std::string& nm=""): + type("type", tp), + name("name", nm) + {} + }; + /// Param block definition struct Params: public LLInitParam::Block { @@ -71,7 +157,8 @@ public: executable("executable"), args("args"), cwd("cwd"), - autokill("autokill", true) + autokill("autokill", true), + files("files") {} /// pathname of executable @@ -87,19 +174,22 @@ public: Optional cwd; /// implicitly kill process on destruction of LLProcess object Optional autokill; + /** + * Up to three FileParam items: for child stdin, stdout, stderr. + * Passing two FileParam entries means default treatment for stderr, + * and so forth. + * + * @note While it's theoretically plausible to pass additional open + * file handles to a child specifically written to expect them, our + * underlying implementation library doesn't support that. + */ + Multiple files; }; typedef LLSDParamAdapter LLSDOrParams; /** * Factory accepting either plain LLSD::Map or Params block. * MAY RETURN DEFAULT-CONSTRUCTED LLProcessPtr if params invalid! - * - * Redundant with Params definition above? - * - * executable (required, string): executable pathname - * args (optional, string array): extra command-line arguments - * cwd (optional, string, dft no chdir): change to this directory before executing - * autokill (optional, bool, dft true): implicit kill() on ~LLProcess */ static LLProcessPtr create(const LLSDOrParams& params); virtual ~LLProcess(); @@ -190,6 +280,125 @@ public: */ static handle isRunning(handle, const std::string& desc=""); + /// Provide symbolic access to child's file slots + enum FILESLOT { STDIN=0, STDOUT=1, STDERR=2, NSLOTS=3 }; + + /** + * For a pipe constructed with @a type "npipe", obtain the generated OS + * filesystem name for the specified pipe. Otherwise returns the empty + * string. @see LLProcess::FileParam::type + */ + std::string getPipeName(FILESLOT); + + /// base of ReadPipe, WritePipe + class BasePipe + { + public: + virtual ~BasePipe() = 0; + }; + + /// As returned by getWritePipe() or getOptWritePipe() + class WritePipe: public BasePipe + { + public: + /** + * Get ostream& on which to write to child's stdin. + * + * @usage + * @code + * myProcess->getWritePipe().get_ostream() << "Hello, child!" << std::endl; + * @endcode + */ + virtual std::ostream& get_ostream() = 0; + }; + + /// As returned by getReadPipe() or getOptReadPipe() + class ReadPipe: public BasePipe + { + public: + /** + * Get istream& on which to read from child's stdout or stderr. + * + * @usage + * @code + * std::string stuff; + * myProcess->getReadPipe().get_istream() >> stuff; + * @endcode + * + * You should be sure in advance that the ReadPipe in question can + * fill the request. @see getPump() + */ + virtual std::istream& get_istream() = 0; + + /** + * Get LLEventPump& on which to listen for incoming data. The posted + * LLSD::Map event will contain a key "data" whose value is an + * LLSD::String containing (part of) the data accumulated in the + * buffer. + * + * If the child sends "abc", and this ReadPipe posts "data"="abc", but + * you don't consume it by reading the std::istream returned by + * get_istream(), and the child next sends "def", ReadPipe will post + * "data"="abcdef". + */ + virtual LLEventPump& getPump() = 0; + + /** + * Set maximum length of buffer data that will be posted in the LLSD + * announcing arrival of new data from the child. If you call + * setLimit(5), and the child sends "abcdef", the LLSD event will + * contain "data"="abcde". However, you may still read the entire + * "abcdef" from get_istream(): this limit affects only the size of + * the data posted with the LLSD event. If you don't call this method, + * all pending data will be posted. + */ + virtual void setLimit(size_t limit) = 0; + + /** + * Query the current setLimit() limit. + */ + virtual size_t getLimit() const = 0; + }; + + /// Exception thrown by getWritePipe(), getReadPipe() if you didn't ask to + /// create a pipe at the corresponding FILESLOT. + struct NoPipe: public std::runtime_error + { + NoPipe(const std::string& what): std::runtime_error(what) {} + }; + + /** + * Get a reference to the (only) WritePipe for this LLProcess. @a slot, if + * specified, must be STDIN. Throws NoPipe if you did not request a "pipe" + * for child stdin. Use this method when you know how you created the + * LLProcess in hand. + */ + WritePipe& getWritePipe(FILESLOT slot=STDIN); + + /** + * Get a boost::optional to the (only) WritePipe for this + * LLProcess. @a slot, if specified, must be STDIN. The return value is + * empty if you did not request a "pipe" for child stdin. Use this method + * for inspecting an LLProcess you did not create. + */ + boost::optional getOptWritePipe(FILESLOT slot=STDIN); + + /** + * Get a reference to one of the ReadPipes for this LLProcess. @a slot, if + * specified, must be STDOUT or STDERR. Throws NoPipe if you did not + * request a "pipe" for child stdout or stderr. Use this method when you + * know how you created the LLProcess in hand. + */ + ReadPipe& getReadPipe(FILESLOT slot); + + /** + * Get a boost::optional to one of the ReadPipes for this + * LLProcess. @a slot, if specified, must be STDOUT or STDERR. The return + * value is empty if you did not request a "pipe" for child stdout or + * stderr. Use this method for inspecting an LLProcess you did not create. + */ + boost::optional getOptReadPipe(FILESLOT slot); + private: /// constructor is private: use create() instead LLProcess(const LLSDOrParams& params); @@ -198,11 +407,21 @@ private: static void status_callback(int reason, void* data, int status); // Object-oriented callback void handle_status(int reason, int status); + // implementation for get[Opt][Read|Write]Pipe() + template + PIPETYPE& getPipe(FILESLOT slot); + template + boost::optional getOptPipe(FILESLOT slot); + template + PIPETYPE* getPipePtr(std::string& error, FILESLOT slot); std::string mDesc; apr_proc_t mProcess; bool mAutokill; Status mStatus; + // explicitly want this ptr_vector to be able to store NULLs + typedef boost::ptr_vector< boost::nullable > PipeVector; + PipeVector mPipes; }; /// for logging diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 8c21be196b..d4e9977e63 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -34,6 +34,7 @@ #include "stringize.h" #include "llsdutil.h" #include "llevents.h" +#include "llerrorcontrol.h" #if defined(LL_WINDOWS) #define sleep(secs) _sleep((secs) * 1000) @@ -92,12 +93,18 @@ static std::string readfile(const std::string& pathname, const std::string& desc /// Looping on LLProcess::isRunning() must now be accompanied by pumping /// "mainloop" -- otherwise the status won't update and you get an infinite /// loop. +void yield(int seconds=1) +{ + // This function simulates waiting for another viewer frame + sleep(seconds); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); +} + void waitfor(LLProcess& proc) { while (proc.isRunning()) { - sleep(1); - LLEventPumps::instance().obtain("mainloop").post(LLSD()); + yield(); } } @@ -105,8 +112,7 @@ void waitfor(LLProcess::handle h, const std::string& desc) { while (LLProcess::isRunning(h, desc)) { - sleep(1); - LLEventPumps::instance().obtain("mainloop").post(LLSD()); + yield(); } } @@ -219,6 +225,68 @@ private: std::string mPath; }; +// statically reference the function in test.cpp... it's short, we could +// replicate, but better to reuse +extern void wouldHaveCrashed(const std::string& message); + +/** + * Capture log messages. This is adapted (simplified) from the one in + * llerror_test.cpp. Sigh, should've broken that out into a separate header + * file, but time for this project is short... + */ +class TestRecorder : public LLError::Recorder +{ +public: + TestRecorder(): + // Mostly what we're trying to accomplish by saving and resetting + // LLError::Settings is to bypass the default RecordToStderr and + // RecordToWinDebug Recorders. As these are visible only inside + // llerror.cpp, we can't just call LLError::removeRecorder() with + // each. For certain tests we need to produce, capture and examine + // DEBUG log messages -- but we don't want to spam the user's console + // with that output. If it turns out that saveAndResetSettings() has + // some bad effect, give up and just let the DEBUG level log messages + // display. + mOldSettings(LLError::saveAndResetSettings()) + { + LLError::setFatalFunction(wouldHaveCrashed); + LLError::setDefaultLevel(LLError::LEVEL_DEBUG); + LLError::addRecorder(this); + } + + ~TestRecorder() + { + LLError::removeRecorder(this); + LLError::restoreSettings(mOldSettings); + } + + void recordMessage(LLError::ELevel level, + const std::string& message) + { + mMessages.push_back(message); + } + + /// Don't assume the message we want is necessarily the LAST log message + /// emitted by the underlying code; search backwards through all messages + /// for the sought string. + std::string messageWith(const std::string& search) + { + for (std::list::const_reverse_iterator rmi(mMessages.rbegin()), + rmend(mMessages.rend()); + rmi != rmend; ++rmi) + { + if (rmi->find(search) != std::string::npos) + return *rmi; + } + // failed to find any such message + return std::string(); + } + + typedef std::list MessageList; + MessageList mMessages; + LLError::Settings* mOldSettings; +}; + /***************************************************************************** * TUT *****************************************************************************/ @@ -602,9 +670,19 @@ namespace tut set_test_name("syntax_error:"); PythonProcessLauncher py("syntax_error:", "syntax_error:\n"); + py.mParams.files.add(LLProcess::FileParam()); // inherit stdin + py.mParams.files.add(LLProcess::FileParam()); // inherit stdout + py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr py.run(); ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("Status.mData", py.mPy->getStatus().mData, 1); + std::istream& rpipe(py.mPy->getReadPipe(LLProcess::STDERR).get_istream()); + std::vector buffer(4096); + rpipe.read(&buffer[0], buffer.size()); + std::streamsize got(rpipe.gcount()); + ensure("Nothing read from stderr pipe", got); + std::string data(&buffer[0], got); + ensure("Didn't find 'SyntaxError:'", data.find("\nSyntaxError:") != std::string::npos); } template<> template<> @@ -629,7 +707,7 @@ namespace tut int i = 0, timeout = 60; for ( ; i < timeout; ++i) { - sleep(1); + yield(); if (readfile(out.getName(), "from kill() script") == "ok") break; } @@ -678,7 +756,7 @@ namespace tut int i = 0, timeout = 60; for ( ; i < timeout; ++i) { - sleep(1); + yield(); if (readfile(out.getName(), "from kill() script") == "ok") break; } @@ -733,7 +811,7 @@ namespace tut int i = 0, timeout = 60; for ( ; i < timeout; ++i) { - sleep(1); + yield(); if (readfile(from.getName(), "from autokill script") == "ok") break; } @@ -742,7 +820,7 @@ namespace tut // Now destroy the LLProcess, which should NOT kill the child! } // If the destructor killed the child anyway, give it time to die - sleep(2); + yield(2); // How do we know it's not terminated? By making it respond to // a specific stimulus in a specific way. { @@ -755,4 +833,81 @@ namespace tut // script could not have written 'ack' as we expect. ensure_equals("autokill script output", readfile(from.getName()), "ack"); } + + template<> template<> + void object::test<10>() + { + set_test_name("'bogus' test"); + TestRecorder recorder; + PythonProcessLauncher py("'bogus' test", + "print 'Hello world'\n"); + py.mParams.files.add(LLProcess::FileParam("bogus")); + py.mPy = LLProcess::create(py.mParams); + ensure("should have rejected 'bogus'", ! py.mPy); + std::string message(recorder.messageWith("bogus")); + ensure("did not log 'bogus' type", ! message.empty()); + ensure_contains("did not name 'stdin'", message, "stdin"); + } + + template<> template<> + void object::test<11>() + { + set_test_name("'file' test"); + // Replace this test with one or more real 'file' tests when we + // implement 'file' support + PythonProcessLauncher py("'file' test", + "print 'Hello world'\n"); + py.mParams.files.add(LLProcess::FileParam()); + py.mParams.files.add(LLProcess::FileParam("file")); + py.mPy = LLProcess::create(py.mParams); + ensure("should have rejected 'file'", ! py.mPy); + } + + template<> template<> + void object::test<12>() + { + set_test_name("'tpipe' test"); + // Replace this test with one or more real 'tpipe' tests when we + // implement 'tpipe' support + TestRecorder recorder; + PythonProcessLauncher py("'tpipe' test", + "print 'Hello world'\n"); + py.mParams.files.add(LLProcess::FileParam()); + py.mParams.files.add(LLProcess::FileParam("tpipe")); + py.mPy = LLProcess::create(py.mParams); + ensure("should have rejected 'tpipe'", ! py.mPy); + std::string message(recorder.messageWith("tpipe")); + ensure("did not log 'tpipe' type", ! message.empty()); + ensure_contains("did not name 'stdout'", message, "stdout"); + } + + template<> template<> + void object::test<13>() + { + set_test_name("'npipe' test"); + // Replace this test with one or more real 'npipe' tests when we + // implement 'npipe' support + TestRecorder recorder; + PythonProcessLauncher py("'npipe' test", + "print 'Hello world'\n"); + py.mParams.files.add(LLProcess::FileParam()); + py.mParams.files.add(LLProcess::FileParam()); + py.mParams.files.add(LLProcess::FileParam("npipe")); + py.mPy = LLProcess::create(py.mParams); + ensure("should have rejected 'npipe'", ! py.mPy); + std::string message(recorder.messageWith("npipe")); + ensure("did not log 'npipe' type", ! message.empty()); + ensure_contains("did not name 'stderr'", message, "stderr"); + } + + // TODO: + // test "pipe" with nonempty name (should log & continue) + // test pipe for just stderr (tests for get[Opt]ReadPipe(), get[Opt]WritePipe()) + // test pipe for stdin, stdout (etc.) + // test getWritePipe().get_ostream(), getReadPipe().get_istream() + // test listening on getReadPipe().getPump(), disconnecting + // test setLimit(), getLimit() + // test EOF -- check logging + // test get(Read|Write)Pipe(3), unmonitored slot, getReadPipe(1), getWritePipe(0) + } // namespace tut -- cgit v1.2.3 From c6ccdb5b5088f3ab24bb89d8c56049c7a17a663e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 12:11:38 -0500 Subject: Add tests for LLProcess::get[Opt][Read|Write]Pipe() validations. --- indra/llcommon/tests/llprocess_test.cpp | 90 +++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index d4e9977e63..06f9f3827f 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -900,14 +900,98 @@ namespace tut ensure_contains("did not name 'stderr'", message, "stderr"); } + template<> template<> + void object::test<14>() + { + set_test_name("internal pipe name warning"); + TestRecorder recorder; + PythonProcessLauncher py("pipe warning", + "import sys\n" + "sys.exit(7)\n"); + py.mParams.files.add(LLProcess::FileParam("pipe", "somename")); + py.run(); // verify that it did launch anyway + ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("Status.mData", py.mPy->getStatus().mData, 7); + std::string message(recorder.messageWith("not yet supported")); + ensure("did not log pipe name warning", ! message.empty()); + ensure_contains("log message did not mention internal pipe name", + message, "somename"); + } + +#define TEST_getPipe(PROCESS, GETPIPE, GETOPTPIPE, VALID, NOPIPE, BADPIPE) \ + do \ + { \ + std::string threw; \ + /* Both the following calls should work. */ \ + (PROCESS).GETPIPE(VALID); \ + ensure(#GETOPTPIPE "(" #VALID ") failed", (PROCESS).GETOPTPIPE(VALID)); \ + /* pass obviously bogus PIPESLOT */ \ + CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(LLProcess::FILESLOT(4))); \ + ensure_contains("didn't reject bad slot", threw, "no slot"); \ + ensure_contains("didn't mention bad slot num", threw, "4"); \ + EXPECT_FAIL_WITH_LOG(threw, (PROCESS).GETOPTPIPE(LLProcess::FILESLOT(4))); \ + /* pass NOPIPE */ \ + CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(NOPIPE)); \ + ensure_contains("didn't reject non-pipe", threw, "not a monitored"); \ + EXPECT_FAIL_WITH_LOG(threw, (PROCESS).GETOPTPIPE(NOPIPE)); \ + /* pass BADPIPE: FILESLOT isn't empty but wrong direction */ \ + CATCH_IN(threw, LLProcess::NoPipe, (PROCESS).GETPIPE(BADPIPE)); \ + /* sneaky: GETPIPE is getReadPipe or getWritePipe */ \ + /* so skip "get" to obtain ReadPipe or WritePipe :-P */ \ + ensure_contains("didn't reject wrong pipe", threw, (#GETPIPE)+3); \ + EXPECT_FAIL_WITH_LOG(threw, (PROCESS).GETOPTPIPE(BADPIPE)); \ + } while (0) + +/// For expecting exceptions. Execute CODE, catch EXCEPTION, store its what() +/// in std::string THREW, ensure it's not empty (i.e. EXCEPTION did happen). +#define CATCH_IN(THREW, EXCEPTION, CODE) \ + do \ + { \ + (THREW).clear(); \ + try \ + { \ + CODE; \ + } \ + catch (const EXCEPTION& e) \ + { \ + (THREW) = e.what(); \ + } \ + ensure("failed to throw " #EXCEPTION ": " #CODE, ! (THREW).empty()); \ + } while (0) + +#define EXPECT_FAIL_WITH_LOG(EXPECT, CODE) \ + do \ + { \ + TestRecorder recorder; \ + ensure(#CODE " succeeded", ! (CODE)); \ + ensure("wrong log message", ! recorder.messageWith(EXPECT).empty()); \ + } while (0) + + template<> template<> + void object::test<15>() + { + set_test_name("get*Pipe() validation"); + PythonProcessLauncher py("just stderr", + "print 'this output is expected'\n"); + py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stdin + py.mParams.files.add(LLProcess::FileParam()); // inherit stdout + py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr + py.run(); + TEST_getPipe(*py.mPy, getWritePipe, getOptWritePipe, + LLProcess::STDIN, // VALID + LLProcess::STDOUT, // NOPIPE + LLProcess::STDERR); // BADPIPE + TEST_getPipe(*py.mPy, getReadPipe, getOptReadPipe, + LLProcess::STDERR, // VALID + LLProcess::STDOUT, // NOPIPE + LLProcess::STDIN); // BADPIPE + } + // TODO: - // test "pipe" with nonempty name (should log & continue) - // test pipe for just stderr (tests for get[Opt]ReadPipe(), get[Opt]WritePipe()) // test pipe for stdin, stdout (etc.) // test getWritePipe().get_ostream(), getReadPipe().get_istream() // test listening on getReadPipe().getPump(), disconnecting // test setLimit(), getLimit() // test EOF -- check logging - // test get(Read|Write)Pipe(3), unmonitored slot, getReadPipe(1), getWritePipe(0) } // namespace tut -- cgit v1.2.3 From 10ab4adc86207f86df30ab23d8858c23e7f550ea Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 13:44:43 -0500 Subject: Fix llprocess_test.cpp's exception catching for Linux. In the course of re-enabling the indra/test tests last year, Log generalized a workaround I'd introduced in llsdmessage_test.cpp. In Linux viewer land, a test program trying to catch an expected exception can't seem to catch it by its specific class (across the libllcommon.so boundary), but must instead catch std::runtime_error and validate the typeid().name() string. Log added a macro for this idiom in llevents_tut.cpp. Generalize that macro further for normal-case processing as well, move it to a header file of its own and use it in all known places -- plus the new exception-catching tests in llprocess_test.cpp. --- indra/llcommon/tests/llprocess_test.cpp | 6 +-- indra/llmessage/tests/llsdmessage_test.cpp | 36 ++----------- indra/test/catch_and_store_what_in.h | 86 ++++++++++++++++++++++++++++++ indra/test/llevents_tut.cpp | 69 +++--------------------- 4 files changed, 98 insertions(+), 99 deletions(-) create mode 100644 indra/test/catch_and_store_what_in.h diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 06f9f3827f..a901c577d6 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -31,6 +31,7 @@ #include "../test/lltut.h" #include "../test/manageapr.h" #include "../test/namedtempfile.h" +#include "../test/catch_and_store_what_in.h" #include "stringize.h" #include "llsdutil.h" #include "llevents.h" @@ -952,10 +953,7 @@ namespace tut { \ CODE; \ } \ - catch (const EXCEPTION& e) \ - { \ - (THREW) = e.what(); \ - } \ + CATCH_AND_STORE_WHAT_IN(THREW, EXCEPTION) \ ensure("failed to throw " #EXCEPTION ": " #CODE, ! (THREW).empty()); \ } while (0) diff --git a/indra/llmessage/tests/llsdmessage_test.cpp b/indra/llmessage/tests/llsdmessage_test.cpp index 0f2c069303..6871ac0d52 100644 --- a/indra/llmessage/tests/llsdmessage_test.cpp +++ b/indra/llmessage/tests/llsdmessage_test.cpp @@ -42,6 +42,7 @@ // external library headers // other Linden headers #include "../test/lltut.h" +#include "../test/catch_and_store_what_in.h" #include "llsdserialize.h" #include "llevents.h" #include "stringize.h" @@ -72,43 +73,14 @@ namespace tut template<> template<> void llsdmessage_object::test<1>() { - bool threw = false; + std::string threw; // This should fail... try { LLSDMessage localListener; } - catch (const LLEventPump::DupPumpName&) - { - threw = true; - } - catch (const std::runtime_error& ex) - { - // This clause is because on Linux, on the viewer side, for this - // one test program (though not others!), the - // LLEventPump::DupPumpName exception isn't caught by the clause - // above. Warn the user... - std::cerr << "Failed to catch " << typeid(ex).name() << std::endl; - // But if the expected exception was thrown, allow the test to - // succeed anyway. Not sure how else to handle this odd case. - if (std::string(typeid(ex).name()) == typeid(LLEventPump::DupPumpName).name()) - { - threw = true; - } - else - { - // We don't even recognize this exception. Let it propagate - // out to TUT to fail the test. - throw; - } - } - catch (...) - { - std::cerr << "Utterly failed to catch expected exception!" << std::endl; - // This case is full of fail. We HAVE to address it. - throw; - } - ensure("second LLSDMessage should throw", threw); + CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::DupPumpName) + ensure("second LLSDMessage should throw", ! threw.empty()); } template<> template<> diff --git a/indra/test/catch_and_store_what_in.h b/indra/test/catch_and_store_what_in.h new file mode 100644 index 0000000000..59f8cc0085 --- /dev/null +++ b/indra/test/catch_and_store_what_in.h @@ -0,0 +1,86 @@ +/** + * @file catch_and_store_what_in.h + * @author Nat Goodspeed + * @date 2012-02-15 + * @brief CATCH_AND_STORE_WHAT_IN() macro + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_CATCH_AND_STORE_WHAT_IN_H) +#define LL_CATCH_AND_STORE_WHAT_IN_H + +/** + * Idiom useful for test programs: catch an expected exception, store its + * what() string in a specified std::string variable. From there the caller + * can do things like: + * @code + * ensure("expected exception not thrown", ! string.empty()); + * @endcode + * or + * @code + * ensure_contains("exception doesn't mention blah", string, "blah"); + * @endcode + * etc. + * + * The trouble is that when linking to a dynamic libllcommon.so on Linux, we + * generally fail to catch the specific exception. Oddly, we can catch it as + * std::runtime_error and validate its typeid().name(), so we do -- but that's + * a lot of boilerplate per test. Encapsulate with this macro. Usage: + * + * @code + * std::string threw; + * try + * { + * some_call_that_should_throw_Foo(); + * } + * CATCH_AND_STORE_WHAT_IN(threw, Foo) + * ensure("some_call_that_should_throw_Foo() didn't throw", ! threw.empty()); + * @endcode + */ +#define CATCH_AND_STORE_WHAT_IN(THREW, EXCEPTION) \ +catch (const EXCEPTION& ex) \ +{ \ + (THREW) = ex.what(); \ +} \ +CATCH_MISSED_LINUX_EXCEPTION(THREW, EXCEPTION) + +#ifndef LL_LINUX +#define CATCH_MISSED_LINUX_EXCEPTION(THREW, EXCEPTION) \ + /* only needed on Linux */ +#else // LL_LINUX + +#define CATCH_MISSED_LINUX_EXCEPTION(THREW, EXCEPTION) \ +catch (const std::runtime_error& ex) \ +{ \ + /* This clause is needed on Linux, on the viewer side, because */ \ + /* the exception isn't caught by catch (const EXCEPTION&). */ \ + /* But if the expected exception was thrown, allow the test to */ \ + /* succeed anyway. Not sure how else to handle this odd case. */ \ + if (std::string(typeid(ex).name()) == typeid(EXCEPTION).name()) \ + { \ + /* std::cerr << "Caught " << typeid(ex).name() */ \ + /* << " with Linux workaround" << std::endl; */ \ + (THREW) = ex.what(); \ + /*std::cout << ex.what() << std::endl;*/ \ + } \ + else \ + { \ + /* We don't even recognize this exception. Let it propagate */ \ + /* out to TUT to fail the test. */ \ + throw; \ + } \ +} \ +catch (...) \ +{ \ + std::cerr << "Failed to catch expected exception " \ + << #EXCEPTION << "!" << std::endl; \ + /* This indicates a problem in the test that should be addressed. */ \ + throw; \ +} + +#endif // LL_LINUX + +#endif /* ! defined(LL_CATCH_AND_STORE_WHAT_IN_H) */ diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp index 4699bb1827..ca4c74099f 100644 --- a/indra/test/llevents_tut.cpp +++ b/indra/test/llevents_tut.cpp @@ -49,46 +49,12 @@ #include // other Linden headers #include "lltut.h" +#include "catch_and_store_what_in.h" #include "stringize.h" #include "tests/listener.h" using boost::assign::list_of; -#ifdef LL_LINUX -#define CATCH_MISSED_LINUX_EXCEPTION(exception, threw) \ -catch (const std::runtime_error& ex) \ -{ \ - /* This clause is needed on Linux, on the viewer side, because the */ \ - /* exception isn't caught by the clause above. Warn the user... */ \ - std::cerr << "Failed to catch " << typeid(ex).name() << std::endl; \ - /* But if the expected exception was thrown, allow the test to */ \ - /* succeed anyway. Not sure how else to handle this odd case. */ \ - /* This approach is also used in llsdmessage_test.cpp. */ \ - if (std::string(typeid(ex).name()) == typeid(exception).name()) \ - { \ - threw = ex.what(); \ - /*std::cout << ex.what() << std::endl;*/ \ - } \ - else \ - { \ - /* We don't even recognize this exception. Let it propagate */ \ - /* out to TUT to fail the test. */ \ - throw; \ - } \ -} \ -catch (...) \ -{ \ - std::cerr << "Utterly failed to catch expected exception " << #exception << "!" << \ - std::endl; \ - /* This indicates a problem in the test that should be addressed. */ \ - throw; \ -} - -#else // LL_LINUX -#define CATCH_MISSED_LINUX_EXCEPTION(exception, threw) \ - /* Not needed on other platforms */ -#endif // LL_LINUX - template T make(const T& value) { @@ -178,11 +144,7 @@ void events_object::test<1>() per_frame.listen(listener0.getName(), // note bug, dup name boost::bind(&Listener::call, boost::ref(listener1), _1)); } - catch (const LLEventPump::DupListenerName& e) - { - threw = e.what(); - } - CATCH_MISSED_LINUX_EXCEPTION(LLEventPump::DupListenerName, threw) + CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::DupListenerName) ensure_equals(threw, std::string("DupListenerName: " "Attempt to register duplicate listener name '") + @@ -388,12 +350,7 @@ void events_object::test<7>() // after "Mary" and "checked" -- whoops! make(list_of("Mary")("checked"))); } - catch (const LLEventPump::Cycle& e) - { - threw = e.what(); - // std::cout << "Caught: " << e.what() << '\n'; - } - CATCH_MISSED_LINUX_EXCEPTION(LLEventPump::Cycle, threw) + CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::Cycle) // Obviously the specific wording of the exception text can // change; go ahead and change the test to match. // Establish that it contains: @@ -426,12 +383,7 @@ void events_object::test<7>() make(list_of("shoelaces")), make(list_of("yellow"))); } - catch (const LLEventPump::OrderChange& e) - { - threw = e.what(); - // std::cout << "Caught: " << e.what() << '\n'; - } - CATCH_MISSED_LINUX_EXCEPTION(LLEventPump::OrderChange, threw) + CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::OrderChange) // Same remarks about the specific wording of the exception. Just // ensure that it contains enough information to clarify the // problem and what must be done to resolve it. @@ -459,12 +411,7 @@ void events_object::test<8>() // then another with a duplicate name. LLEventStream bob2("bob"); } - catch (const LLEventPump::DupPumpName& e) - { - threw = e.what(); - // std::cout << "Caught: " << e.what() << '\n'; - } - CATCH_MISSED_LINUX_EXCEPTION(LLEventPump::DupPumpName, threw) + CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::DupPumpName) ensure("Caught DupPumpName", !threw.empty()); } // delete first 'bob' LLEventStream bob("bob"); // should work, previous one unregistered @@ -505,11 +452,7 @@ void events_object::test<9>() LLListenerOrPumpName empty; empty(17); } - catch (const LLListenerOrPumpName::Empty& e) - { - threw = e.what(); - } - CATCH_MISSED_LINUX_EXCEPTION(LLListenerOrPumpName::Empty, threw) + CATCH_AND_STORE_WHAT_IN(threw, LLListenerOrPumpName::Empty) ensure("threw Empty", !threw.empty()); } -- cgit v1.2.3 From 9b02f483ffe6f313ec86af3f29fa858fa0cb22e4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 14:04:46 -0500 Subject: VS2010 doesn't know how to compute min(4096, size_t) :-P --- indra/llcommon/llprocess.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 55eb7e69d3..d7c297b952 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -144,8 +144,8 @@ public: { // Copy data out from mStreambuf to a flat, contiguous buffer to // write -- but only up to a certain size. - std::streamsize total(mStreambuf.size()); - std::streamsize bufsize((std::min)(4096, total)); + std::size_t total(mStreambuf.size()); + std::size_t bufsize((std::min)(std::size_t(4096), total)); boost::asio::streambuf::const_buffers_type bufs = mStreambuf.data(); std::vector buffer( boost::asio::buffers_begin(bufs), @@ -241,7 +241,7 @@ private: // Now that we've received new data, publish it on our // LLEventPump as advertised. Constrain it by mLimit. - std::streamsize datasize((std::min)(mLimit, mStreambuf.size())); + std::size_t datasize((std::min)(mLimit, mStreambuf.size())); boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); mPump.post(LLSDMap("data", LLSD::String( boost::asio::buffers_begin(cbufs), -- cgit v1.2.3 From 56d931216e67a3e59199669bba022c65a9617bb5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 15:47:03 -0500 Subject: Add LLProcess::ReadPipe::size(), peek(), contains(). Also add "len" key to event data on LLProcess::getPump(). If you've used setLimit(), event["data"].length() may not reflect the length of the accumulated data in the ReadPipe. Add unit test with stdin/stdout handshake with child process. --- indra/llcommon/llprocess.cpp | 31 +++++++++++++++++++----- indra/llcommon/llprocess.h | 25 +++++++++++++++++++ indra/llcommon/tests/llprocess_test.cpp | 43 +++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 8 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index d7c297b952..1481bf571f 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -197,6 +197,25 @@ public: virtual LLEventPump& getPump() { return mPump; } virtual void setLimit(size_t limit) { mLimit = limit; } virtual size_t getLimit() const { return mLimit; } + virtual std::size_t size() { return mStreambuf.size(); } + + virtual std::string peek(std::size_t offset=0, + std::size_t len=(std::numeric_limits::max)()) + { + // Constrain caller's offset and len to overlap actual buffer content. + std::size_t real_offset = (std::min)(mStreambuf.size(), offset); + std::size_t real_end = (std::min)(mStreambuf.size(), real_offset + len); + boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); + return std::string(boost::asio::buffers_begin(cbufs) + real_offset, + boost::asio::buffers_begin(cbufs) + real_end); + } + + virtual bool contains(const std::string& seek, std::size_t offset=0) + { + // There may be a more efficient way to search mStreambuf contents, + // but this is far the easiest... + return peek(offset).find(seek) != std::string::npos; + } private: bool tick(const LLSD&) @@ -240,12 +259,13 @@ private: << mStreambuf.size() << LL_ENDL; // Now that we've received new data, publish it on our - // LLEventPump as advertised. Constrain it by mLimit. + // LLEventPump as advertised. Constrain it by mLimit. But show + // listener the actual accumulated buffer size, regardless of + // mLimit. std::size_t datasize((std::min)(mLimit, mStreambuf.size())); - boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); - mPump.post(LLSDMap("data", LLSD::String( - boost::asio::buffers_begin(cbufs), - boost::asio::buffers_begin(cbufs) + datasize))); + mPump.post(LLSDMap + ("data", peek(0, datasize)) + ("len", LLSD::Integer(mStreambuf.size()))); } } return false; @@ -985,5 +1005,4 @@ void LLProcess::reap(void) } } |*==========================================================================*/ - #endif // Posix diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 448a88f4c0..bf0517600d 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -330,6 +330,31 @@ public: */ virtual std::istream& get_istream() = 0; + /** + * Get accumulated buffer length. + * Often we need to refrain from actually reading the std::istream + * returned by get_istream() until we've accumulated enough data to + * make it worthwhile. For instance, if we're expecting a number from + * the child, but the child happens to flush "12" before emitting + * "3\n", get_istream() >> myint could return 12 rather than 123! + */ + virtual std::size_t size() = 0; + + /** + * Peek at accumulated buffer data without consuming it. Optional + * parameters give you substr() functionality. + * + * @note You can discard buffer data using get_istream().ignore(n). + */ + virtual std::string peek(std::size_t offset=0, + std::size_t len=(std::numeric_limits::max)()) = 0; + + /** + * Search accumulated buffer data without retrieving it. Optional + * offset allows you to start at specified position. + */ + virtual bool contains(const std::string& seek, std::size_t offset=0) = 0; + /** * Get LLEventPump& on which to listen for incoming data. The posted * LLSD::Map event will contain a key "data" whose value is an diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index a901c577d6..2db17cae97 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -919,6 +919,7 @@ namespace tut message, "somename"); } + /*-------------- support for "get*Pipe() validation" test --------------*/ #define TEST_getPipe(PROCESS, GETPIPE, GETOPTPIPE, VALID, NOPIPE, BADPIPE) \ do \ { \ @@ -985,11 +986,49 @@ namespace tut LLProcess::STDIN); // BADPIPE } + template<> template<> + void object::test<16>() + { + set_test_name("talk to stdin/stdout"); + PythonProcessLauncher py("stdin/stdout", + "import sys, time\n" + "print 'ok'\n" + "sys.stdout.flush()\n" + "# wait for 'go' from test program\n" + "go = sys.stdin.readline()\n" + "if go != 'go\\n':\n" + " sys.exit('expected \"go\", saw %r' % go)\n" + "print 'ack'\n"); + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.mPy = LLProcess::create(py.mParams); + ensure("couldn't launch stdin/stdout script", py.mPy); + LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + int i, timeout = 60; + for (i = 0; i < timeout && py.mPy->isRunning() && childout.size() < 3; ++i) + { + yield(); + } + ensure("script never started", i < timeout); + std::string line; + std::getline(childout.get_istream(), line); + ensure_equals("bad wakeup from stdin/stdout script", line, "ok"); + py.mPy->getWritePipe().get_ostream() << "go" << std::endl; + for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) + { + yield(); + } + ensure("script never replied", childout.contains("\n")); + std::getline(childout.get_istream(), line); + ensure_equals("child didn't ack", line, "ack"); + ensure_equals("bad child termination", py.mPy->getStatus().mState, LLProcess::EXITED); + ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); + } + // TODO: - // test pipe for stdin, stdout (etc.) - // test getWritePipe().get_ostream(), getReadPipe().get_istream() // test listening on getReadPipe().getPump(), disconnecting // test setLimit(), getLimit() // test EOF -- check logging + // test peek() with substr } // namespace tut -- cgit v1.2.3 From fc6d70db8771320f3b1136e76383fc85ddf1b6b2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 20:57:25 -0500 Subject: Don't be confused by "\r\n" line endings on pipe on Windows. These are all very well when we just want to dump the output to a log, or whatever, but in a unit-test context it matters for comparison. --- indra/llcommon/tests/llprocess_test.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 2db17cae97..6d6b888471 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -288,6 +288,22 @@ public: LLError::Settings* mOldSettings; }; +std::string getline(std::istream& in) +{ + std::string line; + std::getline(in, line); + // Blur the distinction between "\r\n" and plain "\n". std::getline() will + // have eaten the "\n", but we could still end up with a trailing "\r". + std::string::size_type lastpos = line.find_last_not_of("\r"); + if (lastpos != std::string::npos) + { + // Found at least one character that's not a trailing '\r'. SKIP OVER + // IT and then erase the rest of the line. + line.erase(lastpos+1); + } + return line; +} + /***************************************************************************** * TUT *****************************************************************************/ @@ -1010,17 +1026,15 @@ namespace tut yield(); } ensure("script never started", i < timeout); - std::string line; - std::getline(childout.get_istream(), line); - ensure_equals("bad wakeup from stdin/stdout script", line, "ok"); + ensure_equals("bad wakeup from stdin/stdout script", + getline(childout.get_istream()), "ok"); py.mPy->getWritePipe().get_ostream() << "go" << std::endl; for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) { yield(); } ensure("script never replied", childout.contains("\n")); - std::getline(childout.get_istream(), line); - ensure_equals("child didn't ack", line, "ack"); + ensure_equals("child didn't ack", getline(childout.get_istream()), "ack"); ensure_equals("bad child termination", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); } -- cgit v1.2.3 From 85057908c3f7e48f1dc086ea1c82e672674b2596 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Feb 2012 21:55:53 -0500 Subject: Add unit test for listening on LLProcess::ReadPipe::getPump(). --- indra/llcommon/tests/llprocess_test.cpp | 89 ++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 6d6b888471..31bc833a1d 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -1028,6 +1028,7 @@ namespace tut ensure("script never started", i < timeout); ensure_equals("bad wakeup from stdin/stdout script", getline(childout.get_istream()), "ok"); + // important to get the implicit flush from std::endl py.mPy->getWritePipe().get_ostream() << "go" << std::endl; for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) { @@ -1039,8 +1040,94 @@ namespace tut ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); } + struct EventListener: public boost::noncopyable + { + EventListener(LLEventPump& pump) + { + mConnection = + pump.listen("EventListener", boost::bind(&EventListener::tick, this, _1)); + } + + bool tick(const LLSD& data) + { + mHistory.push_back(data); + return false; + } + + std::list mHistory; + LLTempBoundListener mConnection; + }; + + static bool ack(std::ostream& out, const LLSD& data) + { + out << "continue" << std::endl; + return false; + } + + template<> template<> + void object::test<17>() + { + set_test_name("listen for ReadPipe events"); + PythonProcessLauncher py("ReadPipe listener", + "import sys\n" + "sys.stdout.write('abc')\n" + "sys.stdout.flush()\n" + "sys.stdin.readline()\n" + "sys.stdout.write('def')\n" + "sys.stdout.flush()\n" + "sys.stdin.readline()\n" + "sys.stdout.write('ghi\\n')\n" + "sys.stdout.flush()\n" + "sys.stdin.readline()\n" + "sys.stdout.write('second line\\n')\n"); + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.mPy = LLProcess::create(py.mParams); + ensure("couldn't launch ReadPipe listener script", py.mPy); + std::ostream& childin(py.mPy->getWritePipe(LLProcess::STDIN).get_ostream()); + LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + // listen for incoming data on childout + EventListener listener(childout.getPump()); + // also listen with a function that prompts the child to continue + // every time we see output + LLTempBoundListener connection( + childout.getPump().listen("ack", boost::bind(ack, boost::ref(childin), _1))); + int i, timeout = 60; + // wait through stuttering first line + for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) + { + yield(); + } + ensure("couldn't get first line", i < timeout); + // disconnect from listener + listener.mConnection.disconnect(); + // finish out the run + for (i = 0; i < timeout && py.mPy->isRunning(); ++i) + { + yield(); + } + ensure("child took too long to terminate", i < timeout); + // now verify history + std::list::const_iterator li(listener.mHistory.begin()), + lend(listener.mHistory.end()); + ensure("no events", li != lend); + ensure_equals("history[0]", (*li)["data"].asString(), "abc"); + ensure_equals("history[0] len", (*li)["len"].asInteger(), 3); + ++li; + ensure("only 1 event", li != lend); + ensure_equals("history[1]", (*li)["data"].asString(), "abcdef"); + ensure_equals("history[0] len", (*li)["len"].asInteger(), 6); + ++li; + ensure("only 2 events", li != lend); + ensure_equals("history[2]", (*li)["data"].asString(), "abcdefghi" EOL); + ensure_equals("history[0] len", (*li)["len"].asInteger(), 9 + sizeof(EOL) - 1); + ++li; + // We DO NOT expect a whole new event for the second line because we + // disconnected. + ensure("more than 3 events", li == lend); + } + // TODO: - // test listening on getReadPipe().getPump(), disconnecting // test setLimit(), getLimit() // test EOF -- check logging // test peek() with substr -- cgit v1.2.3 From e92c3113545dd60fb76e115da201163e340c730c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 16 Feb 2012 16:05:04 -0500 Subject: Add LLProcess::ReadPipe::find() methods, with corresponding npos. If it's useful to have contains() to tell you whether incoming data contains a particular substring, and if it's useful for contains() and peek() to accept an offset within that data, then it's useful to allow you to get the offset of a desired substring within that data. But of course a find() returning offset needs something like std::string::npos for "not found"; borrow that convention. Support both find(const std::string&) and find(char); the latter permits a more efficient implementation. In fact, make find(string) recognize a string of length 1 and leverage the find(char) implementation. Given that, reimplement contains(mumble) as shorthand for find(mumble) != npos. Implement find() overloads using std::search() and std::find() on boost::asio::streambuf character iterators, rather than copying to std::string and then using string search like previous contains() implementation. Reimplement WritePipeImpl::tick() and ReadPipeImpl::tick() to write/read directly from/to boost::asio::streambuf data, instead of copying to/from a temporary flat buffer. As long as ReadPipeImpl::tick() keeps successfully filling buffers, keep reading. Previous implementation would only handle a long child write over successive tick() calls. Stop on read error or when we come up short. --- indra/llcommon/llprocess.cpp | 259 ++++++++++++++++++++++---------- indra/llcommon/llprocess.h | 37 ++++- indra/llcommon/tests/llprocess_test.cpp | 2 + 3 files changed, 210 insertions(+), 88 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 1481bf571f..aa22b3f805 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -120,9 +120,12 @@ private: static LLProcessListener sProcessListener; LLProcess::BasePipe::~BasePipe() {} +const LLProcess::BasePipe::size_type + LLProcess::BasePipe::npos((std::numeric_limits::max)()); class WritePipeImpl: public LLProcess::WritePipe { + LOG_CLASS(WritePipeImpl); public: WritePipeImpl(const std::string& desc, apr_file_t* pipe): mDesc(desc), @@ -139,30 +142,53 @@ public: bool tick(const LLSD&) { + typedef boost::asio::streambuf::const_buffers_type const_buffer_sequence; // If there's anything to send, try to send it. - if (mStreambuf.size()) + std::size_t total(mStreambuf.size()), consumed(0); + if (total) { - // Copy data out from mStreambuf to a flat, contiguous buffer to - // write -- but only up to a certain size. - std::size_t total(mStreambuf.size()); - std::size_t bufsize((std::min)(std::size_t(4096), total)); - boost::asio::streambuf::const_buffers_type bufs = mStreambuf.data(); - std::vector buffer( - boost::asio::buffers_begin(bufs), - boost::asio::buffers_begin(bufs) + bufsize); - apr_size_t written(bufsize); - ll_apr_warn_status(apr_file_write(mPipe, &buffer[0], &written)); - // 'written' is modified to reflect the number of bytes actually - // written. Since they've been sent, remove them from the + const_buffer_sequence bufs = mStreambuf.data(); + // In general, our streambuf might contain a number of different + // physical buffers; iterate over those. + for (const_buffer_sequence::const_iterator bufi(bufs.begin()), bufend(bufs.end()); + bufi != bufend; ++bufi) + { + // http://www.boost.org/doc/libs/1_49_0_beta1/doc/html/boost_asio/reference/buffer.html#boost_asio.reference.buffer.accessing_buffer_contents + std::size_t towrite(boost::asio::buffer_size(*bufi)); + apr_size_t written(towrite); + apr_status_t err = apr_file_write(mPipe, + boost::asio::buffer_cast(*bufi), + &written); + // EAGAIN is exactly what we want from a nonblocking pipe. + // Rather than waiting for data, it should return immediately. + if (! (err == APR_SUCCESS || APR_STATUS_IS_EAGAIN(err))) + { + LL_WARNS("LLProcess") << "apr_file_write(" << towrite << ") on " << mDesc + << " got " << err << ":" << LL_ENDL; + ll_apr_warn_status(err); + } + + // 'written' is modified to reflect the number of bytes actually + // written. Make sure we consume those later. (Don't consume them + // now, that would invalidate the buffer iterator sequence!) + consumed += written; + LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite + << " bytes to " << mDesc + << " (original " << total << ")" << LL_ENDL; + + // The parent end of this pipe is nonblocking. If we weren't able + // to write everything we wanted, don't keep banging on it -- that + // won't change until the child reads some. Wait for next tick(). + if (written < towrite) + break; + } + // In all, we managed to write 'consumed' bytes. Remove them from the // streambuf so we don't keep trying to send them. This could be - // anywhere from 0 up to mStreambuf.size(); anything we haven't - // yet sent, we'll try again next tick() call. - mStreambuf.consume(written); - LL_DEBUGS("LLProcess") << "wrote " << written << " of " << bufsize - << " bytes to " << mDesc - << " (original " << total << "), " - << mStreambuf.size() << " remaining" << LL_ENDL; + // anywhere from 0 up to mStreambuf.size(); anything we haven't yet + // sent, we'll try again later. + mStreambuf.consume(consumed); } + return false; } @@ -176,6 +202,7 @@ private: class ReadPipeImpl: public LLProcess::ReadPipe { + LOG_CLASS(ReadPipeImpl); public: ReadPipeImpl(const std::string& desc, apr_file_t* pipe): mDesc(desc), @@ -184,7 +211,7 @@ public: mStream(&mStreambuf), mPump("ReadPipe"), // use funky syntax to call max() to avoid blighted max() macros - mLimit((std::numeric_limits::max)()) + mLimit(npos) { mConnection = LLEventPumps::instance().obtain("mainloop") .listen(LLEventPump::inventName("ReadPipe"), @@ -195,79 +222,149 @@ public: // methods with implementation data concealed from the base class. virtual std::istream& get_istream() { return mStream; } virtual LLEventPump& getPump() { return mPump; } - virtual void setLimit(size_t limit) { mLimit = limit; } - virtual size_t getLimit() const { return mLimit; } - virtual std::size_t size() { return mStreambuf.size(); } + virtual void setLimit(size_type limit) { mLimit = limit; } + virtual size_type getLimit() const { return mLimit; } + virtual size_type size() const { return mStreambuf.size(); } - virtual std::string peek(std::size_t offset=0, - std::size_t len=(std::numeric_limits::max)()) + virtual std::string peek(size_type offset=0, size_type len=npos) const { // Constrain caller's offset and len to overlap actual buffer content. - std::size_t real_offset = (std::min)(mStreambuf.size(), offset); - std::size_t real_end = (std::min)(mStreambuf.size(), real_offset + len); + std::size_t real_offset = (std::min)(mStreambuf.size(), std::size_t(offset)); + std::size_t real_end = (std::min)(mStreambuf.size(), std::size_t(real_offset + len)); boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); return std::string(boost::asio::buffers_begin(cbufs) + real_offset, boost::asio::buffers_begin(cbufs) + real_end); } - virtual bool contains(const std::string& seek, std::size_t offset=0) + virtual size_type find(const std::string& seek, size_type offset=0) const { - // There may be a more efficient way to search mStreambuf contents, - // but this is far the easiest... - return peek(offset).find(seek) != std::string::npos; + // If we're passing a string of length 1, use find(char), which can + // use an O(n) std::find() rather than the O(n^2) std::search(). + if (seek.length() == 1) + { + return find(seek[0], offset); + } + + // If offset is beyond the whole buffer, can't even construct a valid + // iterator range; can't possibly find the string we seek. + if (offset > mStreambuf.size()) + { + return npos; + } + + boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); + boost::asio::buffers_iterator + begin(boost::asio::buffers_begin(cbufs)), + end (boost::asio::buffers_end(cbufs)), + found(std::search(begin + offset, end, seek.begin(), seek.end())); + return (found == end)? npos : (found - begin); } -private: - bool tick(const LLSD&) + virtual size_type find(char seek, size_type offset=0) const { - // Allocate a buffer and try, every time, to read into it. - std::vector buffer(4096); - apr_size_t gotten(buffer.size()); - apr_status_t err = apr_file_read(mPipe, &buffer[0], &gotten); - if (err == APR_EOF) + // If offset is beyond the whole buffer, can't even construct a valid + // iterator range; can't possibly find the char we seek. + if (offset > mStreambuf.size()) { - // Handle EOF specially: it's part of normal-case processing. - LL_DEBUGS("LLProcess") << "EOF on " << mDesc << LL_ENDL; - // We won't need any more tick() calls. - mConnection.disconnect(); + return npos; } - else if (! ll_apr_warn_status(err)) // validate anything but EOF + + boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); + boost::asio::buffers_iterator + begin(boost::asio::buffers_begin(cbufs)), + end (boost::asio::buffers_end(cbufs)), + found(std::find(begin + offset, end, seek)); + return (found == end)? npos : (found - begin); + } + +private: + bool tick(const LLSD&) + { + typedef boost::asio::streambuf::mutable_buffers_type mutable_buffer_sequence; + // Try, every time, to read into our streambuf. In fact, we have no + // idea how much data the child might be trying to send: keep trying + // until we're convinced we've temporarily exhausted the pipe. + bool exhausted = false; + std::size_t committed(0); + do { - // 'gotten' was modified to reflect the number of bytes actually - // received. If nonzero, add them to the streambuf and notify - // interested parties. - if (gotten) + // attempt to read an arbitrary size + mutable_buffer_sequence bufs = mStreambuf.prepare(4096); + // In general, the mutable_buffer_sequence returned by prepare() might + // contain a number of different physical buffers; iterate over those. + std::size_t tocommit(0); + for (mutable_buffer_sequence::const_iterator bufi(bufs.begin()), bufend(bufs.end()); + bufi != bufend; ++bufi) { - boost::asio::streambuf::mutable_buffers_type mbufs = mStreambuf.prepare(gotten); - std::copy(buffer.begin(), buffer.begin() + gotten, - boost::asio::buffers_begin(mbufs)); - // Don't forget to "commit" the data! The sequence (prepare(), - // commit()) is obviously intended to allow us to allocate - // buffer space, then read directly into some portion of it, - // then commit only as much as we managed to obtain. But the - // only official (documented) way I can find to populate a - // mutable_buffers_type is to use buffers_begin(). It Would Be - // Nice if we were permitted to directly read into - // mutable_buffers_type (not to mention writing directly from - // const_buffers_type in WritePipeImpl; APR even supports an - // apr_file_writev() function for writing from discontiguous - // buffers) -- but as of 2012-02-14, this copying appears to - // be the safest tactic. - mStreambuf.commit(gotten); - LL_DEBUGS("LLProcess") << "read " << gotten << " of " << buffer.size() - << " bytes from " << mDesc << ", new total " - << mStreambuf.size() << LL_ENDL; - - // Now that we've received new data, publish it on our - // LLEventPump as advertised. Constrain it by mLimit. But show - // listener the actual accumulated buffer size, regardless of - // mLimit. - std::size_t datasize((std::min)(mLimit, mStreambuf.size())); - mPump.post(LLSDMap - ("data", peek(0, datasize)) - ("len", LLSD::Integer(mStreambuf.size()))); + // http://www.boost.org/doc/libs/1_49_0_beta1/doc/html/boost_asio/reference/buffer.html#boost_asio.reference.buffer.accessing_buffer_contents + std::size_t toread(boost::asio::buffer_size(*bufi)); + apr_size_t gotten(toread); + apr_status_t err = apr_file_read(mPipe, + boost::asio::buffer_cast(*bufi), + &gotten); + // EAGAIN is exactly what we want from a nonblocking pipe. + // Rather than waiting for data, it should return immediately. + if (! (err == APR_SUCCESS || APR_STATUS_IS_EAGAIN(err))) + { + // Handle EOF specially: it's part of normal-case processing. + if (err == APR_EOF) + { + LL_DEBUGS("LLProcess") << "EOF on " << mDesc << LL_ENDL; + } + else + { + LL_WARNS("LLProcess") << "apr_file_read(" << toread << ") on " << mDesc + << " got " << err << ":" << LL_ENDL; + ll_apr_warn_status(err); + } + // Either way, though, we won't need any more tick() calls. + mConnection.disconnect(); + exhausted = true; // also break outer retry loop + break; + } + + // 'gotten' was modified to reflect the number of bytes actually + // received. Make sure we commit those later. (Don't commit them + // now, that would invalidate the buffer iterator sequence!) + tocommit += gotten; + LL_DEBUGS("LLProcess") << "read " << gotten << " of " << toread + << " bytes from " << mDesc << LL_ENDL; + + // The parent end of this pipe is nonblocking. If we weren't even + // able to fill this buffer, don't loop to try to fill the next -- + // that won't change until the child writes more. Wait for next + // tick(). + if (gotten < toread) + { + // break outer retry loop too + exhausted = true; + break; + } } + + // Don't forget to "commit" the data! + mStreambuf.commit(tocommit); + committed += tocommit; + + // 'exhausted' is set when we can't fill any one buffer of the + // mutable_buffer_sequence established by the current prepare() + // call -- whether due to error or not enough bytes. That is, + // 'exhausted' is still false when we've filled every physical + // buffer in the mutable_buffer_sequence. In that case, for all we + // know, the child might have still more data pending -- go for it! + } while (! exhausted); + + if (committed) + { + // If we actually received new data, publish it on our LLEventPump + // as advertised. Constrain it by mLimit. But show listener the + // actual accumulated buffer size, regardless of mLimit. + size_type datasize((std::min)(mLimit, size_type(mStreambuf.size()))); + mPump.post(LLSDMap + ("data", peek(0, datasize)) + ("len", LLSD::Integer(mStreambuf.size()))); } + return false; } @@ -277,7 +374,7 @@ private: boost::asio::streambuf mStreambuf; std::istream mStream; LLEventStream mPump; - size_t mLimit; + size_type mLimit; }; /// Need an exception to avoid constructing an invalid LLProcess object, but @@ -472,16 +569,18 @@ LLProcess::LLProcess(const LLSDOrParams& params): { if (select[i] != APR_CHILD_BLOCK) continue; + std::string desc(STRINGIZE(mDesc << ' ' << whichfile[i])); + apr_file_t* pipe(mProcess.*(members[i])); if (i == STDIN) { - mPipes.replace(i, new WritePipeImpl(whichfile[i], mProcess.*(members[i]))); + mPipes.replace(i, new WritePipeImpl(desc, pipe)); } else { - mPipes.replace(i, new ReadPipeImpl(whichfile[i], mProcess.*(members[i]))); + mPipes.replace(i, new ReadPipeImpl(desc, pipe)); } LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() - << "('" << whichfile[i] << "')" << LL_ENDL; + << "('" << desc << "')" << LL_ENDL; } } diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index bf0517600d..2c6951b562 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -295,6 +295,9 @@ public: { public: virtual ~BasePipe() = 0; + + typedef std::size_t size_type; + static const size_type npos; }; /// As returned by getWritePipe() or getOptWritePipe() @@ -338,7 +341,7 @@ public: * the child, but the child happens to flush "12" before emitting * "3\n", get_istream() >> myint could return 12 rather than 123! */ - virtual std::size_t size() = 0; + virtual size_type size() const = 0; /** * Peek at accumulated buffer data without consuming it. Optional @@ -346,14 +349,32 @@ public: * * @note You can discard buffer data using get_istream().ignore(n). */ - virtual std::string peek(std::size_t offset=0, - std::size_t len=(std::numeric_limits::max)()) = 0; + virtual std::string peek(size_type offset=0, size_type len=npos) const = 0; + + /** + * Detect presence of a substring (or char) in accumulated buffer data + * without retrieving it. Optional offset allows you to search from + * specified position. + */ + template + bool contains(SEEK seek, size_type offset=0) const + { return find(seek, offset) != npos; } + + /** + * Search for a substring in accumulated buffer data without + * retrieving it. Returns size_type position at which found, or npos + * meaning not found. Optional offset allows you to search from + * specified position. + */ + virtual size_type find(const std::string& seek, size_type offset=0) const = 0; /** - * Search accumulated buffer data without retrieving it. Optional - * offset allows you to start at specified position. + * Search for a char in accumulated buffer data without retrieving it. + * Returns size_type position at which found, or npos meaning not + * found. Optional offset allows you to search from specified + * position. */ - virtual bool contains(const std::string& seek, std::size_t offset=0) = 0; + virtual size_type find(char seek, size_type offset=0) const = 0; /** * Get LLEventPump& on which to listen for incoming data. The posted @@ -377,12 +398,12 @@ public: * the data posted with the LLSD event. If you don't call this method, * all pending data will be posted. */ - virtual void setLimit(size_t limit) = 0; + virtual void setLimit(size_type limit) = 0; /** * Query the current setLimit() limit. */ - virtual size_t getLimit() const = 0; + virtual size_type getLimit() const = 0; }; /// Exception thrown by getWritePipe(), getReadPipe() if you didn't ask to diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 31bc833a1d..d7bda34923 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -1131,5 +1131,7 @@ namespace tut // test setLimit(), getLimit() // test EOF -- check logging // test peek() with substr + // test contains(char) + // test find(string, offset), find(char, offset), offset <, =, > size() } // namespace tut -- cgit v1.2.3 From 4ecf9d6a2d981ef27c7b5bddc4807c67d12d5984 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 16 Feb 2012 16:40:14 -0500 Subject: Add unit test for LLProcess::ReadPipe::setLimit(). --- indra/llcommon/tests/llprocess_test.cpp | 62 +++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index d7bda34923..29233d4415 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -140,11 +140,17 @@ struct PythonProcessLauncher mParams.args.add(mScript.getName()); } - /// Run Python script and wait for it to complete. - void run() + /// Launch Python script; verify that it launched + void launch() { mPy = LLProcess::create(mParams); tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), mPy); + } + + /// Run Python script and wait for it to complete. + void run() + { + launch(); // One of the irritating things about LLProcess is that // there's no API to wait for the child to terminate -- but given // its use in our graphics-intensive interactive viewer, it's @@ -718,8 +724,7 @@ namespace tut " f.write('bad')\n"); NamedTempFile out("out", "not started"); py.mParams.args.add(out.getName()); - py.mPy = LLProcess::create(py.mParams); - ensure("couldn't launch kill() script", py.mPy); + py.launch(); // Wait for the script to wake up and do its first write int i = 0, timeout = 60; for ( ; i < timeout; ++i) @@ -765,8 +770,7 @@ namespace tut "with open(sys.argv[1], 'w') as f:\n" " f.write('bad')\n"); py.mParams.args.add(out.getName()); - py.mPy = LLProcess::create(py.mParams); - ensure("couldn't launch kill() script", py.mPy); + py.launch(); // Capture handle for later phandle = py.mPy->getProcessHandle(); // Wait for the script to wake up and do its first write @@ -820,8 +824,7 @@ namespace tut py.mParams.args.add(from.getName()); py.mParams.args.add(to.getName()); py.mParams.autokill = false; - py.mPy = LLProcess::create(py.mParams); - ensure("couldn't launch kill() script", py.mPy); + py.launch(); // Capture handle for later phandle = py.mPy->getProcessHandle(); // Wait for the script to wake up and do its first write @@ -1017,8 +1020,7 @@ namespace tut "print 'ack'\n"); py.mParams.files.add(LLProcess::FileParam("pipe")); // stdin py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout - py.mPy = LLProcess::create(py.mParams); - ensure("couldn't launch stdin/stdout script", py.mPy); + py.launch(); LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); int i, timeout = 60; for (i = 0; i < timeout && py.mPy->isRunning() && childout.size() < 3; ++i) @@ -1082,8 +1084,7 @@ namespace tut "sys.stdout.write('second line\\n')\n"); py.mParams.files.add(LLProcess::FileParam("pipe")); // stdin py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout - py.mPy = LLProcess::create(py.mParams); - ensure("couldn't launch ReadPipe listener script", py.mPy); + py.launch(); std::ostream& childin(py.mPy->getWritePipe(LLProcess::STDIN).get_ostream()); LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); // listen for incoming data on childout @@ -1102,11 +1103,7 @@ namespace tut // disconnect from listener listener.mConnection.disconnect(); // finish out the run - for (i = 0; i < timeout && py.mPy->isRunning(); ++i) - { - yield(); - } - ensure("child took too long to terminate", i < timeout); + waitfor(*py.mPy); // now verify history std::list::const_iterator li(listener.mHistory.begin()), lend(listener.mHistory.end()); @@ -1127,8 +1124,37 @@ namespace tut ensure("more than 3 events", li == lend); } + template<> template<> + void object::test<18>() + { + set_test_name("setLimit()"); + PythonProcessLauncher py("setLimit()", + "import sys\n" + "print sys.argv[1]\n"); + std::string abc("abcdefghijklmnopqrstuvwxyz"); + py.mParams.args.add(abc); + py.mParams.files.add(LLProcess::FileParam()); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.launch(); + LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + // listen for incoming data on childout + EventListener listener(childout.getPump()); + // but set limit + childout.setLimit(10); + ensure_equals("getLimit() after setlimit(10)", childout.getLimit(), 10); + // okay, pump I/O to pick up output from child + waitfor(*py.mPy); + ensure("no events", ! listener.mHistory.empty()); + // For all we know, that data could have arrived in several different + // bursts... probably not, but anyway, only check the last one. + ensure_equals("event[\"len\"]", + listener.mHistory.back()["len"].asInteger(), + abc.length() + sizeof(EOL) - 1); + ensure_equals("length of setLimit(10) data", + listener.mHistory.back()["data"].asString().length(), 10); + } + // TODO: - // test setLimit(), getLimit() // test EOF -- check logging // test peek() with substr // test contains(char) -- cgit v1.2.3 From a06ba836c76ea8b35aeca9d09bd7d3b043a4c962 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 16 Feb 2012 17:35:34 -0500 Subject: Fix bug in LLProcess::ReadPipe::peek() substring computation. Add unit tests for peek() with substring args, reimplemented contains(), various forms of find(). (yay unit tests) --- indra/llcommon/llprocess.cpp | 3 +- indra/llcommon/tests/llprocess_test.cpp | 61 +++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index aa22b3f805..add1649ba5 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -230,7 +230,8 @@ public: { // Constrain caller's offset and len to overlap actual buffer content. std::size_t real_offset = (std::min)(mStreambuf.size(), std::size_t(offset)); - std::size_t real_end = (std::min)(mStreambuf.size(), std::size_t(real_offset + len)); + size_type want_end = (len == npos)? npos : (real_offset + len); + std::size_t real_end = (std::min)(mStreambuf.size(), std::size_t(want_end)); boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data(); return std::string(boost::asio::buffers_begin(cbufs) + real_offset, boost::asio::buffers_begin(cbufs) + real_end); diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 29233d4415..e5d873c8ee 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -1130,7 +1130,7 @@ namespace tut set_test_name("setLimit()"); PythonProcessLauncher py("setLimit()", "import sys\n" - "print sys.argv[1]\n"); + "sys.stdout.write(sys.argv[1])\n"); std::string abc("abcdefghijklmnopqrstuvwxyz"); py.mParams.args.add(abc); py.mParams.files.add(LLProcess::FileParam()); // stdin @@ -1148,16 +1148,65 @@ namespace tut // For all we know, that data could have arrived in several different // bursts... probably not, but anyway, only check the last one. ensure_equals("event[\"len\"]", - listener.mHistory.back()["len"].asInteger(), - abc.length() + sizeof(EOL) - 1); + listener.mHistory.back()["len"].asInteger(), abc.length()); ensure_equals("length of setLimit(10) data", listener.mHistory.back()["data"].asString().length(), 10); } + template<> template<> + void object::test<19>() + { + set_test_name("peek() ReadPipe data"); + PythonProcessLauncher py("peek() ReadPipe", + "import sys\n" + "sys.stdout.write(sys.argv[1])\n"); + std::string abc("abcdefghijklmnopqrstuvwxyz"); + py.mParams.args.add(abc); + py.mParams.files.add(LLProcess::FileParam()); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.launch(); + LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + // okay, pump I/O to pick up output from child + waitfor(*py.mPy); + // peek() with substr args + ensure_equals("peek()", childout.peek(), abc); + ensure_equals("peek(23)", childout.peek(23), abc.substr(23)); + ensure_equals("peek(5, 3)", childout.peek(5, 3), abc.substr(5, 3)); + ensure_equals("peek(27, 2)", childout.peek(27, 2), ""); + ensure_equals("peek(23, 5)", childout.peek(23, 5), "xyz"); + // contains() -- we don't exercise as thoroughly as find() because the + // contains() implementation is trivially (and visibly) based on find() + ensure("contains(\":\")", ! childout.contains(":")); + ensure("contains(':')", ! childout.contains(':')); + ensure("contains(\"d\")", childout.contains("d")); + ensure("contains('d')", childout.contains("d")); + ensure("contains(\"klm\")", childout.contains("klm")); + ensure("contains(\"klx\")", ! childout.contains("klx")); + // find() + ensure("find(\":\")", childout.find(":") == LLProcess::ReadPipe::npos); + ensure("find(':')", childout.find(':') == LLProcess::ReadPipe::npos); + ensure_equals("find(\"d\")", childout.find("d"), 3); + ensure_equals("find('d')", childout.find("d"), 3); + ensure_equals("find(\"d\", 3)", childout.find("d", 3), 3); + ensure_equals("find('d', 3)", childout.find("d", 3), 3); + ensure("find(\"d\", 4)", childout.find("d", 4) == LLProcess::ReadPipe::npos); + ensure("find('d', 4)", childout.find('d', 4) == LLProcess::ReadPipe::npos); + // The case of offset == end and offset > end are different. In the + // first case, we can form a valid (albeit empty) iterator range and + // search that. In the second, guard logic in the implementation must + // realize we can't form a valid iterator range. + ensure("find(\"d\", 26)", childout.find("d", 26) == LLProcess::ReadPipe::npos); + ensure("find('d', 26)", childout.find('d', 26) == LLProcess::ReadPipe::npos); + ensure("find(\"d\", 27)", childout.find("d", 27) == LLProcess::ReadPipe::npos); + ensure("find('d', 27)", childout.find('d', 27) == LLProcess::ReadPipe::npos); + ensure_equals("find(\"ghi\")", childout.find("ghi"), 6); + ensure_equals("find(\"ghi\", 6)", childout.find("ghi"), 6); + ensure("find(\"ghi\", 7)", childout.find("ghi", 7) == LLProcess::ReadPipe::npos); + ensure("find(\"ghi\", 26)", childout.find("ghi", 26) == LLProcess::ReadPipe::npos); + ensure("find(\"ghi\", 27)", childout.find("ghi", 27) == LLProcess::ReadPipe::npos); + } + // TODO: // test EOF -- check logging - // test peek() with substr - // test contains(char) - // test find(string, offset), find(char, offset), offset <, =, > size() } // namespace tut -- cgit v1.2.3 From d6ed77a598a0009d386ce3cd6c49d0f1c4b422e8 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 16 Feb 2012 17:39:56 -0500 Subject: Attempt to fix Windows link error for LLProcess::BasePipe::npos. --- indra/llcommon/llprocess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 2c6951b562..06be0954c0 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -291,7 +291,7 @@ public: std::string getPipeName(FILESLOT); /// base of ReadPipe, WritePipe - class BasePipe + class LL_COMMON_API BasePipe { public: virtual ~BasePipe() = 0; -- cgit v1.2.3 From f52cf4be7003f18813da31b25d204f10eb36db17 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 16 Feb 2012 21:10:06 -0500 Subject: Fix typos in a few LLProcess::ReadPipe::find() unit tests. The typos didn't make for invalid tests, but they made a few tests redundant while leaving other (subtly different) cases untested. --- indra/llcommon/tests/llprocess_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index e5d873c8ee..c67605cc0b 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -1179,16 +1179,16 @@ namespace tut ensure("contains(\":\")", ! childout.contains(":")); ensure("contains(':')", ! childout.contains(':')); ensure("contains(\"d\")", childout.contains("d")); - ensure("contains('d')", childout.contains("d")); + ensure("contains('d')", childout.contains('d')); ensure("contains(\"klm\")", childout.contains("klm")); ensure("contains(\"klx\")", ! childout.contains("klx")); // find() ensure("find(\":\")", childout.find(":") == LLProcess::ReadPipe::npos); ensure("find(':')", childout.find(':') == LLProcess::ReadPipe::npos); ensure_equals("find(\"d\")", childout.find("d"), 3); - ensure_equals("find('d')", childout.find("d"), 3); + ensure_equals("find('d')", childout.find('d'), 3); ensure_equals("find(\"d\", 3)", childout.find("d", 3), 3); - ensure_equals("find('d', 3)", childout.find("d", 3), 3); + ensure_equals("find('d', 3)", childout.find('d', 3), 3); ensure("find(\"d\", 4)", childout.find("d", 4) == LLProcess::ReadPipe::npos); ensure("find('d', 4)", childout.find('d', 4) == LLProcess::ReadPipe::npos); // The case of offset == end and offset > end are different. In the -- cgit v1.2.3 From e98438bda70f92c1caa0621b7e467b72c7e484ad Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 18 Feb 2012 12:00:13 -0500 Subject: Fix subtle bug in ReadPipeImpl: wouldn't tolerate multiple instances. That is, trying to instantiate a ReadPipeImpl while another already existed would throw an LLEventPump::DupPumpName exception. Fortunately this behavior is easily bypassed. --- indra/llcommon/llprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index add1649ba5..d6a5a18565 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -209,7 +209,7 @@ public: mPipe(pipe), // Essential to initialize our std::istream with our special streambuf! mStream(&mStreambuf), - mPump("ReadPipe"), + mPump("ReadPipe", true), // tweak name as needed to avoid collisions // use funky syntax to call max() to avoid blighted max() macros mLimit(npos) { -- cgit v1.2.3 From 8b5d5f9652499103b966524e1c0ceef869e29eeb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 20 Feb 2012 12:40:38 -0500 Subject: Make LLProcess post termination event to specified pump if desired. This way a caller need not spin on isRunning(); we can just listen for the requested termination event. Post a similar event containing error message if for any reason LLProcess::create() failed to launch the child. Add unit tests for both cases. --- indra/llcommon/llprocess.cpp | 118 ++++++++++++++++++++------------ indra/llcommon/llprocess.h | 18 ++++- indra/llcommon/tests/llprocess_test.cpp | 59 ++++++++++++++++ 3 files changed, 151 insertions(+), 44 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index d6a5a18565..9799ed1938 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -125,7 +125,7 @@ const LLProcess::BasePipe::size_type class WritePipeImpl: public LLProcess::WritePipe { - LOG_CLASS(WritePipeImpl); + LOG_CLASS(WritePipeImpl); public: WritePipeImpl(const std::string& desc, apr_file_t* pipe): mDesc(desc), @@ -202,7 +202,7 @@ private: class ReadPipeImpl: public LLProcess::ReadPipe { - LOG_CLASS(ReadPipeImpl); + LOG_CLASS(ReadPipeImpl); public: ReadPipeImpl(const std::string& desc, apr_file_t* pipe): mDesc(desc), @@ -394,6 +394,23 @@ LLProcessPtr LLProcess::create(const LLSDOrParams& params) catch (const LLProcessError& e) { LL_WARNS("LLProcess") << e.what() << LL_ENDL; + + // If caller is requesting an event on process termination, send one + // indicating bad launch. This may prevent someone waiting forever for + // a termination post that can't arrive because the child never + // started. + if (! std::string(params.postend).empty()) + { + LLEventPumps::instance().obtain(params.postend) + .post(LLSDMap + // no "id" + ("desc", std::string(params.executable)) + ("state", LLProcess::UNSTARTED) + // no "data" + ("string", e.what()) + ); + } + return LLProcessPtr(); } } @@ -425,6 +442,8 @@ LLProcess::LLProcess(const LLSDOrParams& params): << LLSDNotationStreamer(params))); } + mPostend = params.postend; + apr_procattr_t *procattr = NULL; chkapr(apr_procattr_create(&procattr, gAPRPoolp)); @@ -744,6 +763,19 @@ void LLProcess::handle_status(int reason, int status) // hand. mStatus = interpret_status(status); LL_INFOS("LLProcess") << getStatusString() << LL_ENDL; + + // If caller requested notification on child termination, send it. + if (! mPostend.empty()) + { + LLEventPumps::instance().obtain(mPostend) + .post(LLSDMap + ("id", getProcessID()) + ("desc", mDesc) + ("state", mStatus.mState) + ("data", mStatus.mData) + ("string", getStatusString()) + ); + } } LLProcess::id LLProcess::getProcessID() const @@ -769,72 +801,72 @@ std::string LLProcess::getPipeName(FILESLOT) template PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) { - if (slot >= NSLOTS) - { - error = STRINGIZE(mDesc << " has no slot " << slot); - return NULL; - } - if (mPipes.is_null(slot)) - { - error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a monitored pipe"); - return NULL; - } - // Make sure we dynamic_cast in pointer domain so we can test, rather than - // accepting runtime's exception. - PIPETYPE* ppipe = dynamic_cast(&mPipes[slot]); - if (! ppipe) - { - error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a " << typeid(PIPETYPE).name()); - return NULL; - } - - error.clear(); - return ppipe; + if (slot >= NSLOTS) + { + error = STRINGIZE(mDesc << " has no slot " << slot); + return NULL; + } + if (mPipes.is_null(slot)) + { + error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a monitored pipe"); + return NULL; + } + // Make sure we dynamic_cast in pointer domain so we can test, rather than + // accepting runtime's exception. + PIPETYPE* ppipe = dynamic_cast(&mPipes[slot]); + if (! ppipe) + { + error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a " << typeid(PIPETYPE).name()); + return NULL; + } + + error.clear(); + return ppipe; } template PIPETYPE& LLProcess::getPipe(FILESLOT slot) { - std::string error; - PIPETYPE* wp = getPipePtr(error, slot); - if (! wp) - { - throw NoPipe(error); - } - return *wp; + std::string error; + PIPETYPE* wp = getPipePtr(error, slot); + if (! wp) + { + throw NoPipe(error); + } + return *wp; } template boost::optional LLProcess::getOptPipe(FILESLOT slot) { - std::string error; - PIPETYPE* wp = getPipePtr(error, slot); - if (! wp) - { - LL_DEBUGS("LLProcess") << error << LL_ENDL; - return boost::optional(); - } - return *wp; + std::string error; + PIPETYPE* wp = getPipePtr(error, slot); + if (! wp) + { + LL_DEBUGS("LLProcess") << error << LL_ENDL; + return boost::optional(); + } + return *wp; } LLProcess::WritePipe& LLProcess::getWritePipe(FILESLOT slot) { - return getPipe(slot); + return getPipe(slot); } boost::optional LLProcess::getOptWritePipe(FILESLOT slot) { - return getOptPipe(slot); + return getOptPipe(slot); } LLProcess::ReadPipe& LLProcess::getReadPipe(FILESLOT slot) { - return getPipe(slot); + return getPipe(slot); } boost::optional LLProcess::getOptReadPipe(FILESLOT slot) { - return getOptPipe(slot); + return getOptPipe(slot); } std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) @@ -932,7 +964,7 @@ static std::string WindowsErrorString(const std::string& operation) NULL) != 0) { - // convert from wide-char string to multi-byte string + // convert from wide-char string to multi-byte string char message[256]; wcstombs(message, error_str, sizeof(message)); message[sizeof(message)-1] = 0; diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 06be0954c0..96a3dce5b3 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -158,7 +158,8 @@ public: args("args"), cwd("cwd"), autokill("autokill", true), - files("files") + files("files"), + postend("postend") {} /// pathname of executable @@ -184,6 +185,20 @@ public: * underlying implementation library doesn't support that. */ Multiple files; + /** + * On child-process termination, if this LLProcess object still + * exists, post LLSD event to LLEventPump with specified name (default + * no event). Event contains at least: + * + * - "id" as obtained from getProcessID() + * - "desc" short string description of child (executable + pid) + * - "state" @c state enum value, from Status.mState + * - "data" if "state" is EXITED, exit code; if KILLED, on Posix, + * signal number + * - "string" English text describing "state" and "data" (e.g. "exited + * with code 0") + */ + Optional postend; }; typedef LLSDParamAdapter LLSDOrParams; @@ -462,6 +477,7 @@ private: PIPETYPE* getPipePtr(std::string& error, FILESLOT slot); std::string mDesc; + std::string mPostend; apr_proc_t mProcess; bool mAutokill; Status mStatus; diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index c67605cc0b..1a755c283c 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -1206,6 +1206,65 @@ namespace tut ensure("find(\"ghi\", 27)", childout.find("ghi", 27) == LLProcess::ReadPipe::npos); } + template<> template<> + void object::test<20>() + { + set_test_name("good postend"); + PythonProcessLauncher py("postend", + "import sys\n" + "sys.exit(35)\n"); + std::string pumpname("postend"); + EventListener listener(LLEventPumps::instance().obtain(pumpname)); + py.mParams.postend = pumpname; + py.launch(); + LLProcess::id childid(py.mPy->getProcessID()); + // Don't use waitfor(), which calls isRunning(); instead wait for an + // event on pumpname. + int i, timeout = 60; + for (i = 0; i < timeout && listener.mHistory.empty(); ++i) + { + yield(); + } + ensure("no postend event", i < timeout); + ensure_equals("number of postend events", listener.mHistory.size(), 1); + LLSD postend(listener.mHistory.front()); + ensure_equals("id", postend["id"].asInteger(), childid); + ensure("desc empty", ! postend["desc"].asString().empty()); + ensure_equals("state", postend["state"].asInteger(), LLProcess::EXITED); + ensure_equals("data", postend["data"].asInteger(), 35); + std::string str(postend["string"]); + ensure_contains("string", str, "exited"); + ensure_contains("string", str, "35"); + } + + template<> template<> + void object::test<21>() + { + set_test_name("bad postend"); + std::string pumpname("postend"); + EventListener listener(LLEventPumps::instance().obtain(pumpname)); + LLProcess::Params params; + params.postend = pumpname; + LLProcessPtr child = LLProcess::create(params); + ensure("shouldn't have launched", ! child); + ensure_equals("number of postend events", listener.mHistory.size(), 1); + LLSD postend(listener.mHistory.front()); + ensure("has id", ! postend.has("id")); + // Ha ha, in this case the implementation normally sets "desc" to + // params.executable. But as the nature of the problem is that + // params.executable is empty, expecting "desc" to be nonempty is a + // bit unreasonable! + //ensure("desc empty", ! postend["desc"].asString().empty()); + ensure_equals("state", postend["state"].asInteger(), LLProcess::UNSTARTED); + ensure("has data", ! postend.has("data")); + std::string error(postend["string"]); + // All we get from canned parameter validation is a bool, so the + // "validation failed" message we ourselves generate can't mention + // "executable" by name. Just check that it's nonempty. + //ensure_contains("error", error, "executable"); + ensure("string", ! error.empty()); + } + // TODO: // test EOF -- check logging -- cgit v1.2.3 From 999484a60896b11df1af9a44e58ccae6fa6ecbed Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 20 Feb 2012 14:22:32 -0500 Subject: Let LLProcess consumer specify desired description for logging. If caller runs (e.g.) a Python script, it's not very helpful to a human log reader to keep seeing LLProcess instances logged as /pathname/to/python (pid). If caller is aware, the code can at least use the script name as the desc -- or maybe even a hint as to the script's purpose. If caller doesn't explicitly pass a desc, at least shorten to just the basename of the executable. --- indra/llcommon/llprocess.cpp | 30 +++++++++++++++++++++++++++--- indra/llcommon/llprocess.h | 10 +++++++++- indra/llcommon/tests/llprocess_test.cpp | 8 +++----- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 9799ed1938..b4c6a647d7 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -50,6 +50,7 @@ static const char* whichfile[] = { "stdin", "stdout", "stderr" }; static std::string empty; static LLProcess::Status interpret_status(int status); +static std::string getDesc(const LLProcess::Params& params); /** * Ref-counted "mainloop" listener. As long as there are still outstanding @@ -404,7 +405,7 @@ LLProcessPtr LLProcess::create(const LLSDOrParams& params) LLEventPumps::instance().obtain(params.postend) .post(LLSDMap // no "id" - ("desc", std::string(params.executable)) + ("desc", getDesc(params)) ("state", LLProcess::UNSTARTED) // no "data" ("string", e.what()) @@ -561,8 +562,8 @@ LLProcess::LLProcess(const LLSDOrParams& params): sProcessListener.addPoll(*this); mStatus.mState = RUNNING; - mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcess.pid << ')'); - LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcess.pid << ")" << LL_ENDL; + mDesc = STRINGIZE(getDesc(params) << " (" << mProcess.pid << ')'); + LL_INFOS("LLProcess") << mDesc << ": launched " << params << LL_ENDL; // Unless caller explicitly turned off autokill (child should persist), // take steps to terminate the child. This is all suspenders-and-belt: in @@ -604,6 +605,29 @@ LLProcess::LLProcess(const LLSDOrParams& params): } } +// Helper to obtain a description string, given a Params block +static std::string getDesc(const LLProcess::Params& params) +{ + // If caller specified a description string, by all means use it. + std::string desc(params.desc); + if (! desc.empty()) + return desc; + + // Caller didn't say. Use the executable name -- but use just the filename + // part. On Mac, for instance, full pathnames get cumbersome. + // If there are Linden utility functions to manipulate pathnames, I + // haven't found them -- and for this usage, Boost.Filesystem seems kind + // of heavyweight. + std::string executable(params.executable); + std::string::size_type delim = executable.find_last_of("\\/"); + // If executable contains no pathname delimiters, return the whole thing. + if (delim == std::string::npos) + return executable; + + // Return just the part beyond the last delimiter. + return executable.substr(delim + 1); +} + LLProcess::~LLProcess() { // Only in state RUNNING are we registered for callback. In UNSTARTED we diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 96a3dce5b3..d005847e18 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -159,7 +159,8 @@ public: cwd("cwd"), autokill("autokill", true), files("files"), - postend("postend") + postend("postend"), + desc("desc") {} /// pathname of executable @@ -199,6 +200,13 @@ public: * with code 0") */ Optional postend; + /** + * Description of child process for logging purposes. It need not be + * unique; the logged description string will contain the PID as well. + * If this is omitted, a description will be derived from the + * executable name. + */ + Optional desc; }; typedef LLSDParamAdapter LLSDOrParams; diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 1a755c283c..fe599e7892 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -136,6 +136,7 @@ struct PythonProcessLauncher const char* PYTHON(getenv("PYTHON")); tut::ensure("Set $PYTHON to the Python interpreter", PYTHON); + mParams.desc = desc + " script"; mParams.executable = PYTHON; mParams.args.add(mScript.getName()); } @@ -1244,17 +1245,14 @@ namespace tut std::string pumpname("postend"); EventListener listener(LLEventPumps::instance().obtain(pumpname)); LLProcess::Params params; + params.desc = "bad postend"; params.postend = pumpname; LLProcessPtr child = LLProcess::create(params); ensure("shouldn't have launched", ! child); ensure_equals("number of postend events", listener.mHistory.size(), 1); LLSD postend(listener.mHistory.front()); ensure("has id", ! postend.has("id")); - // Ha ha, in this case the implementation normally sets "desc" to - // params.executable. But as the nature of the problem is that - // params.executable is empty, expecting "desc" to be nonempty is a - // bit unreasonable! - //ensure("desc empty", ! postend["desc"].asString().empty()); + ensure_equals("desc", postend["desc"].asString(), std::string(params.desc)); ensure_equals("state", postend["state"].asInteger(), LLProcess::UNSTARTED); ensure("has data", ! postend.has("data")); std::string error(postend["string"]); -- cgit v1.2.3 From 14687b1c37555946f46dc4c7d83554f917ffe066 Mon Sep 17 00:00:00 2001 From: "Debi King (Dessie)" Date: Wed, 22 Feb 2012 14:04:12 -0500 Subject: Added tag DRTVWR-118_3.2.9-beta2, 3.2.9-beta2 for changeset a01ef9bed286 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index d4bf3a81f8..8c9f92ad8f 100644 --- a/.hgtags +++ b/.hgtags @@ -266,3 +266,5 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 37dd400ad721e2a89ee820ffc1e7e433c68f3ca2 3.2.9-start e9c82fca5ae6fb8a8af29012d78fb194a29323f3 DRTVWR-117_3.2.9-beta1 e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1 +a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2 +a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2 -- cgit v1.2.3 From 14ddc6474a0ae83db8d034b00138289fb15e41b7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 Feb 2012 13:41:26 -0500 Subject: Tighten up LLProcess pipe support, per Richard's code review. Clarify wording in some of the doc comments; be a bit more explicit about some of the parameter fields. Make some query methods 'const'. Change default LLProcess::ReadPipe::getLimit() value to 0: don't post any incoming data with notification event unless caller requests it. But do post pertinent FILESLOT in case caller reuses same listener for both stdout and stderr. Use more idiomatic, readable syntax for accessing LLProcess::Params data. --- indra/llcommon/llprocess.cpp | 119 +++++++++++++++++++------------- indra/llcommon/llprocess.h | 63 +++++++++++------ indra/llcommon/tests/llprocess_test.cpp | 4 +- 3 files changed, 116 insertions(+), 70 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index b4c6a647d7..3b17b819bd 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -47,11 +47,18 @@ #include #include -static const char* whichfile[] = { "stdin", "stdout", "stderr" }; +static const char* whichfile_[] = { "stdin", "stdout", "stderr" }; static std::string empty; static LLProcess::Status interpret_status(int status); static std::string getDesc(const LLProcess::Params& params); +static std::string whichfile(LLProcess::FILESLOT index) +{ + if (index < LL_ARRAY_SIZE(whichfile_)) + return whichfile_[index]; + return STRINGIZE("file slot " << index); +} + /** * Ref-counted "mainloop" listener. As long as there are still outstanding * LLProcess objects, keep listening on "mainloop" so we can keep polling APR @@ -122,6 +129,7 @@ static LLProcessListener sProcessListener; LLProcess::BasePipe::~BasePipe() {} const LLProcess::BasePipe::size_type + // use funky syntax to call max() to avoid blighted max() macros LLProcess::BasePipe::npos((std::numeric_limits::max)()); class WritePipeImpl: public LLProcess::WritePipe @@ -205,14 +213,14 @@ class ReadPipeImpl: public LLProcess::ReadPipe { LOG_CLASS(ReadPipeImpl); public: - ReadPipeImpl(const std::string& desc, apr_file_t* pipe): + ReadPipeImpl(const std::string& desc, apr_file_t* pipe, LLProcess::FILESLOT index): mDesc(desc), mPipe(pipe), + mIndex(index), // Essential to initialize our std::istream with our special streambuf! mStream(&mStreambuf), mPump("ReadPipe", true), // tweak name as needed to avoid collisions - // use funky syntax to call max() to avoid blighted max() macros - mLimit(npos) + mLimit(0) { mConnection = LLEventPumps::instance().obtain("mainloop") .listen(LLEventPump::inventName("ReadPipe"), @@ -364,7 +372,10 @@ private: size_type datasize((std::min)(mLimit, size_type(mStreambuf.size()))); mPump.post(LLSDMap ("data", peek(0, datasize)) - ("len", LLSD::Integer(mStreambuf.size()))); + ("len", LLSD::Integer(mStreambuf.size())) + ("index", LLSD::Integer(mIndex)) + ("name", whichfile(mIndex)) + ("desc", mDesc)); } return false; @@ -372,6 +383,7 @@ private: std::string mDesc; apr_file_t* mPipe; + LLProcess::FILESLOT mIndex; LLTempBoundListener mConnection; boost::asio::streambuf mStreambuf; std::istream mStream; @@ -400,7 +412,7 @@ LLProcessPtr LLProcess::create(const LLSDOrParams& params) // indicating bad launch. This may prevent someone waiting forever for // a termination post that can't arrive because the child never // started. - if (! std::string(params.postend).empty()) + if (params.postend.isProvided()) { LLEventPumps::instance().obtain(params.postend) .post(LLSDMap @@ -458,22 +470,24 @@ LLProcess::LLProcess(const LLSDOrParams& params): // and passing it as both stdout and stderr (apr_procattr_child_out_set(), // apr_procattr_child_err_set()), or accepting a filename, opening it and // passing that apr_file_t (simple <, >, 2> redirect emulation). - std::vector fparams(params.files.begin(), params.files.end()); - // By default, pass APR_NO_PIPE for each slot. - std::vector select(LL_ARRAY_SIZE(whichfile), APR_NO_PIPE); - for (size_t i = 0; i < (std::min)(LL_ARRAY_SIZE(whichfile), fparams.size()); ++i) + std::vector select; + BOOST_FOREACH(const FileParam& fparam, params.files) { - if (std::string(fparams[i].type).empty()) // inherit our file descriptor + // Every iteration, we're going to append an item to 'select'. At the + // top of the loop, its size() is, in effect, an index. Use that to + // pick a string description for messages. + std::string which(whichfile(FILESLOT(select.size()))); + if (fparam.type().empty()) // inherit our file descriptor { - select[i] = APR_NO_PIPE; + select.push_back(APR_NO_PIPE); } - else if (std::string(fparams[i].type) == "pipe") // anonymous pipe + else if (fparam.type() == "pipe") // anonymous pipe { - if (! std::string(fparams[i].name).empty()) + if (! fparam.name().empty()) { - LL_WARNS("LLProcess") << "For " << std::string(params.executable) + LL_WARNS("LLProcess") << "For " << params.executable() << ": internal names for reusing pipes ('" - << std::string(fparams[i].name) << "' for " << whichfile[i] + << fparam.name() << "' for " << which << ") are not yet supported -- creating distinct pipe" << LL_ENDL; } @@ -482,16 +496,21 @@ LLProcess::LLProcess(const LLSDOrParams& params): // makes very little sense to set nonblocking I/O for the child // end of a pipe: only a specially-written child could deal with // that. - select[i] = APR_CHILD_BLOCK; + select.push_back(APR_CHILD_BLOCK); } else { - throw LLProcessError(STRINGIZE("For " << std::string(params.executable) - << ": unsupported FileParam for " << whichfile[i] - << ": type='" << std::string(fparams[i].type) - << "', name='" << std::string(fparams[i].name) << "'")); + throw LLProcessError(STRINGIZE("For " << params.executable() + << ": unsupported FileParam for " << which + << ": type='" << fparam.type() + << "', name='" << fparam.name() << "'")); } } + // By default, pass APR_NO_PIPE for unspecified slots. + while (select.size() < NSLOTS) + { + select.push_back(APR_NO_PIPE); + } chkapr(apr_procattr_io_set(procattr, select[STDIN], select[STDOUT], select[STDERR])); // Thumbs down on implicitly invoking the shell to invoke the child. From @@ -527,24 +546,32 @@ LLProcess::LLProcess(const LLSDOrParams& params): #endif } - // Have to instantiate named std::strings for string params items so their - // c_str() values persist. - std::string cwd(params.cwd); - if (! cwd.empty()) + // In preparation for calling apr_proc_create(), we collect a number of + // const char* pointers obtained from std::string::c_str(). Turns out + // LLInitParam::Block's helpers Optional, Mandatory, Multiple et al. + // guarantee that converting to the wrapped type (std::string in our + // case), e.g. by calling operator(), returns a reference to *the same + // instance* of the wrapped type that's stored in our Block subclass. + // That's important! We know 'params' persists throughout this method + // call; but without that guarantee, we'd have to assume that converting + // one of its members to std::string might return a different (temp) + // instance. Capturing the c_str() from a temporary std::string is Bad Bad + // Bad. But armed with this knowledge, when you see params.cwd().c_str(), + // grit your teeth and smile and carry on. + + if (params.cwd.isProvided()) { - chkapr(apr_procattr_dir_set(procattr, cwd.c_str())); + chkapr(apr_procattr_dir_set(procattr, params.cwd().c_str())); } // create an argv vector for the child process std::vector argv; - // add the executable path - std::string executable(params.executable); - argv.push_back(executable.c_str()); + // Add the executable path. See above remarks about c_str(). + argv.push_back(params.executable().c_str()); - // and any arguments - std::vector args(params.args.begin(), params.args.end()); - BOOST_FOREACH(const std::string& arg, args) + // Add arguments. See above remarks about c_str(). + BOOST_FOREACH(const std::string& arg, params.args) { argv.push_back(arg.c_str()); } @@ -590,7 +617,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): { if (select[i] != APR_CHILD_BLOCK) continue; - std::string desc(STRINGIZE(mDesc << ' ' << whichfile[i])); + std::string desc(STRINGIZE(mDesc << ' ' << whichfile(FILESLOT(i)))); apr_file_t* pipe(mProcess.*(members[i])); if (i == STDIN) { @@ -598,7 +625,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): } else { - mPipes.replace(i, new ReadPipeImpl(desc, pipe)); + mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i))); } LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() << "('" << desc << "')" << LL_ENDL; @@ -609,9 +636,8 @@ LLProcess::LLProcess(const LLSDOrParams& params): static std::string getDesc(const LLProcess::Params& params) { // If caller specified a description string, by all means use it. - std::string desc(params.desc); - if (! desc.empty()) - return desc; + if (params.desc.isProvided()) + return params.desc; // Caller didn't say. Use the executable name -- but use just the filename // part. On Mac, for instance, full pathnames get cumbersome. @@ -670,22 +696,22 @@ bool LLProcess::kill(const std::string& who) return ! isRunning(); } -bool LLProcess::isRunning(void) +bool LLProcess::isRunning() const { return getStatus().mState == RUNNING; } -LLProcess::Status LLProcess::getStatus() +LLProcess::Status LLProcess::getStatus() const { return mStatus; } -std::string LLProcess::getStatusString() +std::string LLProcess::getStatusString() const { return getStatusString(getStatus()); } -std::string LLProcess::getStatusString(const Status& status) +std::string LLProcess::getStatusString(const Status& status) const { return getStatusString(mDesc, status); } @@ -816,7 +842,7 @@ LLProcess::handle LLProcess::getProcessHandle() const #endif } -std::string LLProcess::getPipeName(FILESLOT) +std::string LLProcess::getPipeName(FILESLOT) const { // LLProcess::FileParam::type "npipe" is not yet implemented return ""; @@ -832,7 +858,7 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) } if (mPipes.is_null(slot)) { - error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a monitored pipe"); + error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a monitored pipe"); return NULL; } // Make sure we dynamic_cast in pointer domain so we can test, rather than @@ -840,7 +866,7 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) PIPETYPE* ppipe = dynamic_cast(&mPipes[slot]); if (! ppipe) { - error = STRINGIZE(mDesc << ' ' << whichfile[slot] << " not a " << typeid(PIPETYPE).name()); + error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a " << typeid(PIPETYPE).name()); return NULL; } @@ -895,10 +921,9 @@ boost::optional LLProcess::getOptReadPipe(FILESLOT slot) std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) { - std::string cwd(params.cwd); - if (! cwd.empty()) + if (params.cwd.isProvided()) { - out << "cd " << LLStringUtil::quote(cwd) << ": "; + out << "cd " << LLStringUtil::quote(params.cwd) << ": "; } out << LLStringUtil::quote(params.executable); BOOST_FOREACH(const std::string& arg, params.args) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index d005847e18..637b7e2f9c 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -58,12 +58,16 @@ typedef boost::shared_ptr LLProcessPtr; * arguments. It also keeps track of whether the process is still running, and * can kill it if required. * + * In discussing LLProcess, we use the term "parent" to refer to this process + * (the process invoking LLProcess), versus "child" to refer to the process + * spawned by LLProcess. + * * LLProcess relies on periodic post() calls on the "mainloop" LLEventPump: an - * LLProcess object's Status won't update until the next "mainloop" tick. The - * viewer's main loop already posts to that LLEventPump once per iteration - * (hence the name). See indra/llcommon/tests/llprocess_test.cpp for an - * example of waiting for child-process termination in a standalone test - * context. + * LLProcess object's Status won't update until the next "mainloop" tick. For + * instance, the Second Life viewer's main loop already posts to an + * LLEventPump by that name once per iteration. See + * indra/llcommon/tests/llprocess_test.cpp for an example of waiting for + * child-process termination in a standalone test context. */ class LL_COMMON_API LLProcess: public boost::noncopyable { @@ -110,10 +114,10 @@ public: * pumping nonblocking I/O every frame. The expectation (at least * for stdout or stderr) is that the caller will listen for * incoming data and consume it as it arrives. It's important not - * to neglect such a pipe, because it's buffered in viewer memory. - * If you suspect the child may produce a great volume of output - * between viewer frames, consider directing the child to write to - * a filesystem file instead, then read the file later. + * to neglect such a pipe, because it's buffered in memory. If you + * suspect the child may produce a great volume of output between + * frames, consider directing the child to write to a filesystem + * file instead, then read the file later. * * - "tpipe": do not engage LLProcess machinery to monitor the * parent end of the pipe. A "tpipe" is used only to connect @@ -145,9 +149,14 @@ public: Optional name; FileParam(const std::string& tp="", const std::string& nm=""): - type("type", tp), - name("name", nm) - {} + type("type"), + name("name") + { + // If caller wants to specify values, use explicit assignment to + // set them rather than initialization. + if (! tp.empty()) type = tp; + if (! nm.empty()) name = nm; + } }; /// Param block definition @@ -175,17 +184,28 @@ public: /// current working directory, if need it changed Optional cwd; /// implicitly kill process on destruction of LLProcess object + /// (default true) Optional autokill; /** * Up to three FileParam items: for child stdin, stdout, stderr. * Passing two FileParam entries means default treatment for stderr, * and so forth. * + * @note LLInitParam::Block permits usage like this: + * @code + * LLProcess::Params params; + * ... + * params.files + * .add(LLProcess::FileParam()) // stdin + * .add(LLProcess::FileParam().type("pipe") // stdout + * .add(LLProcess::FileParam().type("file").name("error.log")); + * @endcode + * * @note While it's theoretically plausible to pass additional open * file handles to a child specifically written to expect them, our - * underlying implementation library doesn't support that. + * underlying implementation doesn't yet support that. */ - Multiple files; + Multiple > files; /** * On child-process termination, if this LLProcess object still * exists, post LLSD event to LLEventPump with specified name (default @@ -217,9 +237,8 @@ public: static LLProcessPtr create(const LLSDOrParams& params); virtual ~LLProcess(); - // isRunning() isn't const because, when child terminates, it sets stored - // Status - bool isRunning(void); + /// Is child process still running? + bool isRunning() const; /** * State of child process @@ -252,11 +271,11 @@ public: }; /// Status query - Status getStatus(); + Status getStatus() const; /// English Status string query, for logging etc. - std::string getStatusString(); + std::string getStatusString() const; /// English Status string query for previously-captured Status - std::string getStatusString(const Status& status); + std::string getStatusString(const Status& status) const; /// static English Status string query static std::string getStatusString(const std::string& desc, const Status& status); @@ -311,7 +330,7 @@ public: * filesystem name for the specified pipe. Otherwise returns the empty * string. @see LLProcess::FileParam::type */ - std::string getPipeName(FILESLOT); + std::string getPipeName(FILESLOT) const; /// base of ReadPipe, WritePipe class LL_COMMON_API BasePipe @@ -419,7 +438,7 @@ public: * contain "data"="abcde". However, you may still read the entire * "abcdef" from get_istream(): this limit affects only the size of * the data posted with the LLSD event. If you don't call this method, - * all pending data will be posted. + * @em no data will be posted: the default is 0 bytes. */ virtual void setLimit(size_type limit) = 0; diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index fe599e7892..d7feddd26b 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -696,7 +696,7 @@ namespace tut "syntax_error:\n"); py.mParams.files.add(LLProcess::FileParam()); // inherit stdin py.mParams.files.add(LLProcess::FileParam()); // inherit stdout - py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr + py.mParams.files.add(LLProcess::FileParam().type("pipe")); // pipe for stderr py.run(); ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("Status.mData", py.mPy->getStatus().mData, 1); @@ -1088,6 +1088,8 @@ namespace tut py.launch(); std::ostream& childin(py.mPy->getWritePipe(LLProcess::STDIN).get_ostream()); LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + // lift the default limit; allow event to carry (some of) the actual data + childout.setLimit(20); // listen for incoming data on childout EventListener listener(childout.getPump()); // also listen with a function that prompts the child to continue -- cgit v1.2.3 From 025329b6a2ecb8ddee3022d6a73344f862f0d326 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Feb 2012 15:06:44 -0500 Subject: Add LLStringUtil::getTokens() overload handling quoted substrings. We didn't have any tokenizer suitable for scanning something like a bash command line. We do have a couple hacks, e.g. LLExternalEditor::tokenize() and LLCommandLineParser::parseCommandLineString(). Both try to work around boost::tokenizer limitations; but existing boost::tokenizer support just doesn't address this case. Neither of the above is available as a general scanner anyway, and parseCommandLineString() fails outright when passed "". New getTokens() also distinguishes between "drop delimiters" (e.g. space, return, newline) to be discarded from the token stream, versus "keep delimiters" (e.g. "+-*/") to be returned as tokens in their own right. There's an overload that honors escapes and a more efficient one that doesn't; each has a convenience overload that returns the scanned string vector rather than requiring a separate declaration. Tweak and comment older getTokens() implementation. Add unit tests for both old and new getTokens() implementations. Break out StringVec and std::ostream << StringVec from indra/llcommon/tests/listener.h to StringVec.h: that's coming in handy for a number of different TUT test sources. --- indra/llcommon/llstring.cpp | 16 +- indra/llcommon/llstring.h | 355 ++++++++++++++++++++++++++++++++- indra/llcommon/tests/StringVec.h | 37 ++++ indra/llcommon/tests/listener.h | 21 +- indra/llcommon/tests/llstring_test.cpp | 115 +++++++++++ 5 files changed, 517 insertions(+), 27 deletions(-) create mode 100644 indra/llcommon/tests/StringVec.h diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index e7fe656808..fa0eb9f72c 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -912,22 +912,24 @@ S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions); template<> void LLStringUtil::getTokens(const std::string& instr, std::vector& tokens, const std::string& delims) { - std::string currToken; - std::string::size_type begIdx, endIdx; - - begIdx = instr.find_first_not_of (delims); - while (begIdx != std::string::npos) + // Starting at offset 0, scan forward for the next non-delimiter. We're + // done when the only characters left in 'instr' are delimiters. + for (std::string::size_type begIdx, endIdx = 0; + (begIdx = instr.find_first_not_of (delims, endIdx)) != std::string::npos; ) { + // Found a non-delimiter. After that, find the next delimiter. endIdx = instr.find_first_of (delims, begIdx); if (endIdx == std::string::npos) { + // No more delimiters: this token extends to the end of the string. endIdx = instr.length(); } - currToken = instr.substr(begIdx, endIdx - begIdx); + // extract the token between begIdx and endIdx; substr() needs length + std::string currToken(instr.substr(begIdx, endIdx - begIdx)); LLStringUtil::trim (currToken); tokens.push_back(currToken); - begIdx = instr.find_first_not_of (delims, endIdx); + // next scan past delimiters starts at endIdx } } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 7b24b5e279..e4ae54cec5 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -40,6 +40,7 @@ #endif #include +#include #if LL_SOLARIS // stricmp and strnicmp do not exist on Solaris: @@ -247,7 +248,38 @@ public: static const string_type null; typedef std::map format_map_t; - LL_COMMON_API static void getTokens(const string_type& instr, std::vector& tokens, const string_type& delims); + /// considers any sequence of delims as a single field separator + LL_COMMON_API static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& delims); + /// like simple scan overload, but returns scanned vector + LL_COMMON_API static std::vector getTokens(const string_type& instr, + const string_type& delims); + /// add support for keep_delims and quotes (either could be empty string) + LL_COMMON_API static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); + /// like keep_delims-and-quotes overload, but returns scanned vector + LL_COMMON_API static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); + /// add support for escapes (could be empty string) + LL_COMMON_API static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); + /// like escapes overload, but returns scanned vector + LL_COMMON_API static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); + LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals); LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch); LL_COMMON_API static S32 format(string_type& s, const format_map_t& substitutions); @@ -262,6 +294,11 @@ public: return !string.empty() && (0 <= i) && (i <= string.size()); } + static bool contains(const string_type& string, T c, size_type i=0) + { + return string.find(c, i) != string_type::npos; + } + static void trimHead(string_type& string); static void trimTail(string_type& string); static void trim(string_type& string) { trimHead(string); trimTail(string); } @@ -650,10 +687,324 @@ namespace LLStringFn //////////////////////////////////////////////////////////// // NOTE: LLStringUtil::format, getTokens, and support functions moved to llstring.cpp. // There is no LLWStringUtil::format implementation currently. -// Calling thse for anything other than LLStringUtil will produce link errors. +// Calling these for anything other than LLStringUtil will produce link errors. //////////////////////////////////////////////////////////// +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, const string_type& delims) +{ + std::vector tokens; + getTokens(instr, tokens, delims); + return tokens; +} + +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes) +{ + std::vector tokens; + getTokens(instr, tokens, drop_delims, keep_delims, quotes); + return tokens; +} + +// static +template +std::vector::string_type> +LLStringUtilBase::getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes) +{ + std::vector tokens; + getTokens(instr, tokens, drop_delims, keep_delims, quotes, escapes); + return tokens; +} + +namespace LLStringUtilBaseImpl +{ + +/** + * Input string scanner helper for getTokens(), or really any other + * character-parsing routine that may have to deal with escape characters. + * This implementation defines the concept (also an interface, should you + * choose to implement the concept by subclassing) and provides trivial + * implementations for a string @em without escape processing. + */ +template +struct InString +{ + typedef std::basic_string string_type; + typedef typename string_type::const_iterator const_iterator; + + InString(const_iterator b, const_iterator e): + iter(b), + end(e) + {} + + bool done() const { return iter == end; } + /// Is the current character (*iter) escaped? This implementation can + /// answer trivially because it doesn't support escapes. + virtual bool escaped() const { return false; } + /// Obtain the current character and advance @c iter. + virtual T next() { return *iter++; } + /// Does the current character match specified character? + virtual bool is(T ch) const { return (! done()) && *iter == ch; } + /// Is the current character any one of the specified characters? + virtual bool oneof(const string_type& delims) const + { + return (! done()) && LLStringUtilBase::contains(delims, *iter); + } + + /** + * Scan forward from @from until either @a delim or end. This is primarily + * useful for processing quoted substrings. + * + * If we do see @a delim, append everything from @from until (excluding) + * @a delim to @a into, advance @c iter to skip @a delim, and return @c + * true. + * + * If we do not see @a delim, do not alter @a into or @c iter and return + * @c false. Do not pass GO, do not collect $200. + * + * @note The @c false case described above implements normal getTokens() + * treatment of an unmatched open quote: treat the quote character as if + * escaped, that is, simply collect it as part of the current token. Other + * plausible behaviors directly affect the way getTokens() deals with an + * unmatched quote: e.g. throwing an exception to treat it as an error, or + * assuming a close quote beyond end of string (in which case return @c + * true). + */ + virtual bool collect_until(string_type& into, const_iterator from, T delim) + { + const_iterator found = std::find(from, end, delim); + // If we didn't find delim, change nothing, just tell caller. + if (found == end) + return false; + // Found delim! Append everything between from and found. + into.append(from, found); + // advance past delim in input + iter = found + 1; + return true; + } + + const_iterator iter, end; +}; + +/// InString subclass that handles escape characters +template +class InEscString: public InString +{ +public: + typedef InString super; + typedef typename super::string_type string_type; + typedef typename super::const_iterator const_iterator; + using super::done; + using super::iter; + using super::end; + + InEscString(const_iterator b, const_iterator e, const string_type& escapes_): + super(b, e), + escapes(escapes_) + { + // Even though we've already initialized 'iter' via our base-class + // constructor, set it again to check for initial escape char. + setiter(b); + } + + /// This implementation uses the answer cached by setiter(). + virtual bool escaped() const { return isesc; } + virtual T next() + { + // If we're looking at the escape character of an escape sequence, + // skip that character. This is the one time we can modify 'iter' + // without using setiter: for this one case we DO NOT CARE if the + // escaped character is itself an escape. + if (isesc) + ++iter; + // If we were looking at an escape character, this is the escaped + // character; otherwise it's just the next character. + T result(*iter); + // Advance iter, checking for escape sequence. + setiter(iter + 1); + return result; + } + + virtual bool is(T ch) const + { + // Like base-class is(), except that an escaped character matches + // nothing. + return (! done()) && (! isesc) && *iter == ch; + } + + virtual bool oneof(const string_type& delims) const + { + // Like base-class oneof(), except that an escaped character matches + // nothing. + return (! done()) && (! isesc) && LLStringUtilBase::contains(delims, *iter); + } + + virtual bool collect_until(string_type& into, const_iterator from, T delim) + { + // Deal with escapes in the characters we collect; that is, an escaped + // character must become just that character without the preceding + // escape. Collect characters in a separate string rather than + // directly appending to 'into' in case we do not find delim, in which + // case we're supposed to leave 'into' unmodified. + string_type collected; + // For scanning purposes, we're going to work directly with 'iter'. + // Save its current value in case we fail to see delim. + const_iterator save_iter(iter); + // Okay, set 'iter', checking for escape. + setiter(from); + while (! done()) + { + // If we see an unescaped delim, stop and report success. + if ((! isesc) && *iter == delim) + { + // Append collected chars to 'into'. + into.append(collected); + // Don't forget to advance 'iter' past delim. + setiter(iter + 1); + return true; + } + // We're not at end, and either we're not looking at delim or it's + // escaped. Collect this character and keep going. + collected.push_back(next()); + } + // Here we hit 'end' without ever seeing delim. Restore iter and tell + // caller. + setiter(save_iter); + return false; + } + +private: + void setiter(const_iterator i) + { + iter = i; + + // Every time we change 'iter', set 'isesc' to be able to repetitively + // answer escaped() without having to rescan 'escapes'. isesc caches + // contains(escapes, *iter). + + // We're looking at an escaped char if we're not already at end (that + // is, *iter is even meaningful); if *iter is in fact one of the + // specified escape characters; and if there's one more character + // following it. That is, if an escape character is the very last + // character of the input string, it loses its special meaning. + isesc = (! done()) && + LLStringUtilBase::contains(escapes, *iter) && + (iter+1) != end; + } + + const string_type escapes; + bool isesc; +}; + +/// getTokens() implementation based on InString concept +template +void getTokens(INSTRING& instr, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes) +{ + // There are times when we want to match either drop_delims or + // keep_delims. Concatenate them up front to speed things up. + string_type all_delims(drop_delims + keep_delims); + // no tokens yet + tokens.clear(); + + // try for another token + while (! instr.done()) + { + // scan past any drop_delims + while (instr.oneof(drop_delims)) + { + // skip this drop_delim + instr.next(); + // but if that was the end of the string, done + if (instr.done()) + return; + } + // found the start of another token: make a slot for it + tokens.push_back(string_type()); + if (instr.oneof(keep_delims)) + { + // *iter is a keep_delim, a token of exactly 1 character. Append + // that character to the new token and proceed. + tokens.back().push_back(instr.next()); + continue; + } + // Here we have a non-delimiter token, which might consist of a mix of + // quoted and unquoted parts. Use bash rules for quoting: you can + // embed a quoted substring in the midst of an unquoted token (e.g. + // ~/"sub dir"/myfile.txt); you can ram two quoted substrings together + // to make a single token (e.g. 'He said, "'"Don't."'"'). We diverge + // from bash in that bash considers an unmatched quote an error. Our + // param signature doesn't allow for errors, so just pretend it's not + // a quote and embed it. + // At this level, keep scanning until we hit the next delimiter of + // either type (drop_delims or keep_delims). + while (! instr.oneof(all_delims)) + { + // If we're looking at an open quote, search forward for + // a close quote, collecting characters along the way. + if (instr.oneof(quotes) && + instr.collect_until(tokens.back(), instr.iter+1, *instr.iter)) + { + // collect_until is cleverly designed to do exactly what we + // need here. No further action needed if it returns true. + } + else + { + // Either *iter isn't a quote, or there's no matching close + // quote: in other words, just an ordinary char. Append it to + // current token. + tokens.back().push_back(instr.next()); + } + // having scanned that segment of this token, if we've reached the + // end of the string, we're done + if (instr.done()) + return; + } + } +} + +} // namespace LLStringUtilBaseImpl + +// static +template +void LLStringUtilBase::getTokens(const string_type& string, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes) +{ + // Because this overload doesn't support escapes, use simple InString to + // manage input range. + LLStringUtilBaseImpl::InString instring(string.begin(), string.end()); + LLStringUtilBaseImpl::getTokens(instring, tokens, drop_delims, keep_delims, quotes); +} + +// static +template +void LLStringUtilBase::getTokens(const string_type& string, std::vector& tokens, + const string_type& drop_delims, const string_type& keep_delims, + const string_type& quotes, const string_type& escapes) +{ + // This overload must deal with escapes. Delegate that to InEscString + // (unless there ARE no escapes). + boost::scoped_ptr< LLStringUtilBaseImpl::InString > instrp; + if (escapes.empty()) + instrp.reset(new LLStringUtilBaseImpl::InString(string.begin(), string.end())); + else + instrp.reset(new LLStringUtilBaseImpl::InEscString(string.begin(), string.end(), escapes)); + LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes); +} // static template diff --git a/indra/llcommon/tests/StringVec.h b/indra/llcommon/tests/StringVec.h new file mode 100644 index 0000000000..a380b00a05 --- /dev/null +++ b/indra/llcommon/tests/StringVec.h @@ -0,0 +1,37 @@ +/** + * @file StringVec.h + * @author Nat Goodspeed + * @date 2012-02-24 + * @brief Extend TUT ensure_equals() to handle std::vector + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_STRINGVEC_H) +#define LL_STRINGVEC_H + +#include +#include +#include + +typedef std::vector StringVec; + +std::ostream& operator<<(std::ostream& out, const StringVec& strings) +{ + out << '('; + StringVec::const_iterator begin(strings.begin()), end(strings.end()); + if (begin != end) + { + out << '"' << *begin << '"'; + while (++begin != end) + { + out << ", \"" << *begin << '"'; + } + } + out << ')'; + return out; +} + +#endif /* ! defined(LL_STRINGVEC_H) */ diff --git a/indra/llcommon/tests/listener.h b/indra/llcommon/tests/listener.h index dcdb2412be..9c5c18a150 100644 --- a/indra/llcommon/tests/listener.h +++ b/indra/llcommon/tests/listener.h @@ -30,6 +30,8 @@ #define LL_LISTENER_H #include "llsd.h" +#include "llevents.h" +#include "tests/StringVec.h" #include /***************************************************************************** @@ -133,24 +135,7 @@ struct Collect return false; } void clear() { result.clear(); } - typedef std::vector StringList; - StringList result; + StringVec result; }; -std::ostream& operator<<(std::ostream& out, const Collect::StringList& strings) -{ - out << '('; - Collect::StringList::const_iterator begin(strings.begin()), end(strings.end()); - if (begin != end) - { - out << '"' << *begin << '"'; - while (++begin != end) - { - out << ", \"" << *begin << '"'; - } - } - out << ')'; - return out; -} - #endif /* ! defined(LL_LISTENER_H) */ diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 6a1cbf652a..821deeac21 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -29,7 +29,11 @@ #include "linden_common.h" #include "../test/lltut.h" +#include #include "../llstring.h" +#include "StringVec.h" + +using boost::assign::list_of; namespace tut { @@ -750,4 +754,115 @@ namespace tut ensure("empty substr.", !LLStringUtil::endsWith(empty, value)); ensure("empty everything.", !LLStringUtil::endsWith(empty, empty)); } + + template<> template<> + void string_index_object_t::test<41>() + { + set_test_name("getTokens(\"delims\")"); + ensure_equals("empty string", LLStringUtil::getTokens("", " "), StringVec()); + ensure_equals("only delims", + LLStringUtil::getTokens(" \r\n ", " \r\n"), StringVec()); + ensure_equals("sequence of delims", + LLStringUtil::getTokens(",,, one ,,,", ","), list_of("one")); + // nat considers this a dubious implementation side effect, but I'd + // hate to change it now... + ensure_equals("noncontiguous tokens", + LLStringUtil::getTokens(", ,, , one ,,,", ","), list_of("")("")("one")); + ensure_equals("space-padded tokens", + LLStringUtil::getTokens(", one , two ,", ","), list_of("one")("two")); + ensure_equals("no delims", LLStringUtil::getTokens("one", ","), list_of("one")); + } + + // Shorthand for verifying that getTokens() behaves the same when you + // don't pass a string of escape characters, when you pass an empty string + // (different overloads), and when you pass a string of characters that + // aren't actually present. + void ensure_getTokens(const std::string& desc, + const std::string& string, + const std::string& drop_delims, + const std::string& keep_delims, + const std::string& quotes, + const std::vector& expect) + { + ensure_equals(desc + " - no esc", + LLStringUtil::getTokens(string, drop_delims, keep_delims, quotes), + expect); + ensure_equals(desc + " - empty esc", + LLStringUtil::getTokens(string, drop_delims, keep_delims, quotes, ""), + expect); + ensure_equals(desc + " - unused esc", + LLStringUtil::getTokens(string, drop_delims, keep_delims, quotes, "!"), + expect); + } + + void ensure_getTokens(const std::string& desc, + const std::string& string, + const std::string& drop_delims, + const std::string& keep_delims, + const std::vector& expect) + { + ensure_getTokens(desc, string, drop_delims, keep_delims, "", expect); + } + + template<> template<> + void string_index_object_t::test<42>() + { + set_test_name("getTokens(\"delims\", etc.)"); + // Signatures to test in this method: + // getTokens(string, drop_delims, keep_delims [, quotes [, escapes]]) + // If you omit keep_delims, you get the older function (test above). + + // cases like the getTokens(string, delims) tests above + ensure_getTokens("empty string", "", " ", "", StringVec()); + ensure_getTokens("only delims", + " \r\n ", " \r\n", "", StringVec()); + ensure_getTokens("sequence of delims", + ",,, one ,,,", ", ", "", list_of("one")); + // Note contrast with the case in the previous method + ensure_getTokens("noncontiguous tokens", + ", ,, , one ,,,", ", ", "", list_of("one")); + ensure_getTokens("space-padded tokens", + ", one , two ,", ", ", "", + list_of("one")("two")); + ensure_getTokens("no delims", "one", ",", "", list_of("one")); + + // drop_delims vs. keep_delims + ensure_getTokens("arithmetic", + " ab+def / xx* yy ", " ", "+-*/", + list_of("ab")("+")("def")("/")("xx")("*")("yy")); + + // quotes + ensure_getTokens("no quotes", + "She said, \"Don't go.\"", " ", ",", "", + list_of("She")("said")(",")("\"Don't")("go.\"")); + ensure_getTokens("quotes", + "She said, \"Don't go.\"", " ", ",", "\"", + list_of("She")("said")(",")("Don't go.")); + ensure_getTokens("quotes and delims", + "run c:/'Documents and Settings'/someone", " ", "", "'", + list_of("run")("c:/Documents and Settings/someone")); + ensure_getTokens("unmatched quote", + "baby don't leave", " ", "", "'", + list_of("baby")("don't")("leave")); + ensure_getTokens("adjacent quoted", + "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", + list_of("abcdef \"ghijkl' mnopqr")); + + // escapes + // Don't use backslash as an escape for these tests -- you'll go nuts + // between the C++ string scanner and getTokens() escapes. Test with + // something else! + ensure_equals("escaped delims", + LLStringUtil::getTokens("^ a - dog^-gone^ phrase", " ", "-", "", "^"), + list_of(" a")("-")("dog-gone phrase")); + ensure_equals("escaped quotes", + LLStringUtil::getTokens("say: 'this isn^'t w^orking'.", " ", "", "'", "^"), + list_of("say:")("this isn't working.")); + ensure_equals("escaped escape", + LLStringUtil::getTokens("want x^^2", " ", "", "", "^"), + list_of("want")("x^2")); + ensure_equals("escape at end", + LLStringUtil::getTokens("it's^ up there^", " ", "", "'", "^"), + list_of("it's up")("there^")); + } } -- cgit v1.2.3 From 5adc39753b9392050d961eb01edb31f8a6fbb05d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Feb 2012 16:02:39 -0500 Subject: Update llevents_tut.cpp to use StringVec, not local StringList. --- indra/test/llevents_tut.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp index ca4c74099f..a9114075fc 100644 --- a/indra/test/llevents_tut.cpp +++ b/indra/test/llevents_tut.cpp @@ -316,7 +316,6 @@ void events_object::test<7>() { set_test_name("listener dependency order"); typedef LLEventPump::NameList NameList; - typedef Collect::StringList StringList; LLEventPump& button(pumps.obtain("button")); Collect collector; button.listen("Mary", @@ -330,7 +329,7 @@ void events_object::test<7>() button.listen("spot", boost::bind(&Collect::add, boost::ref(collector), "spot", _1)); button.post(1); - ensure_equals(collector.result, make(list_of("spot")("checked")("Mary"))); + ensure_equals(collector.result, make(list_of("spot")("checked")("Mary"))); collector.clear(); button.stopListening("Mary"); button.listen("Mary", @@ -339,7 +338,7 @@ void events_object::test<7>() // now "Mary" must come before "spot" make(list_of("spot"))); button.post(2); - ensure_equals(collector.result, make(list_of("Mary")("spot")("checked"))); + ensure_equals(collector.result, make(list_of("Mary")("spot")("checked"))); collector.clear(); button.stopListening("spot"); std::string threw; @@ -373,7 +372,7 @@ void events_object::test<7>() boost::bind(&Collect::add, boost::ref(collector), "shoelaces", _1), make(list_of("checked"))); button.post(3); - ensure_equals(collector.result, make(list_of("Mary")("checked")("yellow")("shoelaces"))); + ensure_equals(collector.result, make(list_of("Mary")("checked")("yellow")("shoelaces"))); collector.clear(); threw.clear(); try @@ -395,7 +394,7 @@ void events_object::test<7>() ensure_contains("old order", threw, "was: Mary, checked, yellow, shoelaces"); ensure_contains("new order", threw, "now: Mary, checked, shoelaces, of, yellow"); button.post(4); - ensure_equals(collector.result, make(list_of("Mary")("checked")("yellow")("shoelaces"))); + ensure_equals(collector.result, make(list_of("Mary")("checked")("yellow")("shoelaces"))); } template<> template<> -- cgit v1.2.3 From 4edf93d6d991af3f1aa0aba764388ad52ab1464b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Feb 2012 16:50:47 -0500 Subject: "Then there's Windows..." Fix llstring.h to build there too. --- indra/llcommon/llstring.h | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index e4ae54cec5..5085d32f7f 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -253,32 +253,32 @@ public: std::vector& tokens, const string_type& delims); /// like simple scan overload, but returns scanned vector - LL_COMMON_API static std::vector getTokens(const string_type& instr, - const string_type& delims); + static std::vector getTokens(const string_type& instr, + const string_type& delims); /// add support for keep_delims and quotes (either could be empty string) - LL_COMMON_API static void getTokens(const string_type& instr, - std::vector& tokens, - const string_type& drop_delims, - const string_type& keep_delims, - const string_type& quotes=string_type()); + static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); /// like keep_delims-and-quotes overload, but returns scanned vector - LL_COMMON_API static std::vector getTokens(const string_type& instr, - const string_type& drop_delims, - const string_type& keep_delims, - const string_type& quotes=string_type()); + static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes=string_type()); /// add support for escapes (could be empty string) - LL_COMMON_API static void getTokens(const string_type& instr, - std::vector& tokens, - const string_type& drop_delims, - const string_type& keep_delims, - const string_type& quotes, - const string_type& escapes); + static void getTokens(const string_type& instr, + std::vector& tokens, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); /// like escapes overload, but returns scanned vector - LL_COMMON_API static std::vector getTokens(const string_type& instr, - const string_type& drop_delims, - const string_type& keep_delims, - const string_type& quotes, - const string_type& escapes); + static std::vector getTokens(const string_type& instr, + const string_type& drop_delims, + const string_type& keep_delims, + const string_type& quotes, + const string_type& escapes); LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals); LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch); @@ -748,6 +748,7 @@ struct InString iter(b), end(e) {} + virtual ~InString() {} bool done() const { return iter == end; } /// Is the current character (*iter) escaped? This implementation can -- cgit v1.2.3 From d2faf5d25a0f6cc3ccaaf450fe6d3585fef058b7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Feb 2012 17:14:07 -0500 Subject: Get rid of indra/llcommon/tests/setpython.py. run_build_test.py already has the capability to set environment variables, and we may as well direct it to set PYTHON to the running Python interpreter. That completely eliminates one level of process wrapper. --- indra/cmake/LLTestCommand.cmake | 3 +++ indra/llcommon/CMakeLists.txt | 6 ++---- indra/llcommon/tests/setpython.py | 19 ------------------- 3 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 indra/llcommon/tests/setpython.py diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake index b5a0580a90..f75c23a5de 100644 --- a/indra/cmake/LLTestCommand.cmake +++ b/indra/cmake/LLTestCommand.cmake @@ -9,6 +9,9 @@ MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH) FOREACH(dir ${LD_LIBRARY_PATH}) LIST(APPEND value "-l${dir}") ENDFOREACH(dir) + # Enough different tests want to be able to find CMake's PYTHON_EXECUTABLE + # that we should just pop it into the environment for everybody. + LIST(APPEND value "-DPYTHON=${PYTHON_EXECUTABLE}") LIST(APPEND value ${ARGN}) SET(${OUTVAR} ${value}) ##IF(LL_TEST_VERBOSE) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 3255e28e8e..1cab648cfa 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -324,8 +324,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llprocessor "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}" - "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/setpython.py") + LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llsingleton "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") @@ -333,8 +332,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}" - "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/tests/setpython.py") + LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") # *TODO - reenable these once tcmalloc libs no longer break the build. diff --git a/indra/llcommon/tests/setpython.py b/indra/llcommon/tests/setpython.py deleted file mode 100644 index df7b90428e..0000000000 --- a/indra/llcommon/tests/setpython.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/python -"""\ -@file setpython.py -@author Nat Goodspeed -@date 2011-07-13 -@brief Set PYTHON environment variable for tests that care. - -$LicenseInfo:firstyear=2011&license=viewerlgpl$ -Copyright (c) 2011, Linden Research, Inc. -$/LicenseInfo$ -""" - -import os -import sys -import subprocess - -if __name__ == "__main__": - os.environ["PYTHON"] = sys.executable - sys.exit(subprocess.call(sys.argv[1:])) -- cgit v1.2.3 From bf7c215692435ceb85d8991a9337933688dc0cf0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 26 Feb 2012 07:17:08 -0500 Subject: Add LLStringUtil::getTokens() test for quoted empty string. This is an important differentiator between getTokens() and the present LLCommandLineParser::parseCommandLineString() logic: you cannot currently --set SomeVar to an empty string value because parseCommandLineString() discards empty strings. --- indra/llcommon/tests/llstring_test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 821deeac21..93d3968dbf 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -847,6 +847,9 @@ namespace tut ensure_getTokens("adjacent quoted", "abc'def \"ghi'\"jkl' mno\"pqr", " ", "", "\"'", list_of("abcdef \"ghijkl' mnopqr")); + ensure_getTokens("quoted empty string", + "--set SomeVar ''", " ", "", "'", + list_of("--set")("SomeVar")("")); // escapes // Don't use backslash as an escape for these tests -- you'll go nuts -- cgit v1.2.3 From 4a7848148e886676dd24bfcf4f50db06bffb28da Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 26 Feb 2012 07:21:51 -0500 Subject: Add TODOs for getTokens() to known places that scan command lines. Lacking time to properly test new LLStringUtil::getTokens() against the present (different!) command-line scanners in LLExternalEditor::tokenize() and LLCommandLineParser::parseCommandLineString(), just annotate as future work the goal of unifying them... SIGH. --- indra/newview/llcommandlineparser.cpp | 9 +++++++++ indra/newview/llexternaleditor.cpp | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 65c61c4a8b..17d403bbe1 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -342,6 +342,15 @@ bool LLCommandLineParser::parseCommandLine(int argc, char **argv) return parseAndStoreResults(clp); } +// TODO: +// - Break out this funky parsing logic into separate method +// - Unit-test it with tests like LLStringUtil::getTokens() (the command-line +// overload that supports quoted tokens) +// - Unless this logic offers significant semantic benefits, replace it with +// LLStringUtil::getTokens(). This would fix a known bug: you cannot --set a +// string-valued variable to the empty string, because empty strings are +// eliminated below. + bool LLCommandLineParser::parseCommandLineString(const std::string& str) { // Split the string content into tokens diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index db482f023e..9480e54809 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -119,6 +119,12 @@ std::string LLExternalEditor::getErrorMessage(EErrorCode code) return LLTrans::getString("Unknown"); } +// TODO: +// - Unit-test this with tests like LLStringUtil::getTokens() (the +// command-line overload that supports quoted tokens) +// - Unless there are significant semantic differences, eliminate this method +// and use LLStringUtil::getTokens() instead. + // static size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str) { -- cgit v1.2.3 From c0318d1bf988217e1fbb0593d03c4f0235a13ea3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 27 Feb 2012 11:50:47 -0500 Subject: Make LLInstanceTracker::getInstance(T*) validate passed T*. For the T* specialization (no string, or whatever, key), the original getInstance() method simply returned the passed-in T* value. It was defined, as the comments noted, for completeness of the analogy with the keyed LLInstanceTracker specialization. It turns out, though, that getInstance(T*) can still be useful to ask whether the T* you have in hand still references a valid T instance. Support that usage. --- indra/llcommon/llinstancetracker.h | 21 +++++++++++++++++---- indra/llcommon/tests/llinstancetracker_test.cpp | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 34d841a4e0..403df08990 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -167,8 +167,9 @@ public: static T* getInstance(const KEY& k) { - typename InstanceMap::const_iterator found = getMap_().find(k); - return (found == getMap_().end()) ? NULL : found->second; + const InstanceMap& map(getMap_()); + typename InstanceMap::const_iterator found = map.find(k); + return (found == map.end()) ? NULL : found->second; } static instance_iter beginInstances() @@ -239,8 +240,20 @@ class LLInstanceTracker : public LLInstanceTrackerBase public: - /// for completeness of analogy with the generic implementation - static T* getInstance(T* k) { return k; } + /** + * Does a particular instance still exist? Of course, if you already have + * a T* in hand, you need not call getInstance() to @em locate the + * instance -- unlike the case where getInstance() accepts some kind of + * key. Nonetheless this method is still useful to @em validate a + * particular T*, since each instance's destructor removes itself from the + * underlying set. + */ + static T* getInstance(T* k) + { + const InstanceSet& set(getSet_()); + typename InstanceSet::const_iterator found = set.find(k); + return (found == set.end())? NULL : *found; + } static S32 instanceCount() { return getSet_().size(); } class instance_iter : public boost::iterator_facade diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index b34d1c5fd3..294e21bac5 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -95,6 +95,7 @@ namespace tut void object::test<2>() { ensure_equals(Unkeyed::instanceCount(), 0); + Unkeyed* dangling = NULL; { Unkeyed one; ensure_equals(Unkeyed::instanceCount(), 1); @@ -107,7 +108,11 @@ namespace tut ensure_equals(found, two.get()); } ensure_equals(Unkeyed::instanceCount(), 1); - } + // store an unwise pointer to a temp Unkeyed instance + dangling = &one; + } // make that instance vanish + // check the now-invalid pointer to the destroyed instance + ensure("getInstance(T*) failed to track destruction", ! Unkeyed::getInstance(dangling)); ensure_equals(Unkeyed::instanceCount(), 0); } -- cgit v1.2.3 From 6f53796ccf4dc29368920a322baeaceb3fd2266f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 27 Feb 2012 14:47:40 -0500 Subject: Add LLInstanceTracker test for exception in subclass constructor. We want to verify the sequence: LLInstanceTracker constructor adds instance to underlying container Subclass constructor throws exception LLInstanceTracker destructor removes instance from underlying container. --- indra/llcommon/tests/llinstancetracker_test.cpp | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index b34d1c5fd3..fda932c355 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -35,6 +35,7 @@ #include #include #include // std::sort() +#include // std headers // external library headers #include @@ -42,6 +43,11 @@ #include "../test/lltut.h" #include "wrapllerrs.h" +struct Badness: public std::runtime_error +{ + Badness(const std::string& what): std::runtime_error(what) {} +}; + struct Keyed: public LLInstanceTracker { Keyed(const std::string& name): @@ -53,6 +59,17 @@ struct Keyed: public LLInstanceTracker struct Unkeyed: public LLInstanceTracker { + Unkeyed(const std::string& thrw="") + { + // LLInstanceTracker should respond appropriately if a subclass + // constructor throws an exception. Specifically, it should run + // LLInstanceTracker's destructor and remove itself from the + // underlying container. + if (! thrw.empty()) + { + throw Badness(thrw); + } + } }; /***************************************************************************** @@ -229,4 +246,49 @@ namespace tut } ensure(! what.empty()); } + + template<> template<> + void object::test<8>() + { + set_test_name("exception in subclass ctor"); + typedef std::set InstanceSet; + InstanceSet existing; + // We can't use the iterator-range InstanceSet constructor because + // beginInstances() returns an iterator that dereferences to an + // Unkeyed&, not an Unkeyed*. + for (Unkeyed::instance_iter uki(Unkeyed::beginInstances()), + ukend(Unkeyed::endInstances()); + uki != ukend; ++uki) + { + existing.insert(&*uki); + } + Unkeyed* puk = NULL; + try + { + // We don't expect the assignment to take place because we expect + // Unkeyed to respond to the non-empty string param by throwing. + // We know the LLInstanceTracker base-class constructor will have + // run before Unkeyed's constructor, therefore the new instance + // will have added itself to the underlying set. The whole + // question is, when Unkeyed's constructor throws, will + // LLInstanceTracker's destructor remove it from the set? I + // realize we're testing the C++ implementation more than + // Unkeyed's implementation, but this seems an important point to + // nail down. + puk = new Unkeyed("throw"); + } + catch (const Badness&) + { + } + // Ensure that every member of the new, updated set of Unkeyed + // instances was also present in the original set. If that's not true, + // it's because our new Unkeyed ended up in the updated set despite + // its constructor exception. + for (Unkeyed::instance_iter uki(Unkeyed::beginInstances()), + ukend(Unkeyed::endInstances()); + uki != ukend; ++uki) + { + ensure("failed to remove instance", existing.find(&*uki) != existing.end()); + } + } } // namespace tut -- cgit v1.2.3 From 7fd281ac9971caa1dfffd42e6ff16dd44da20179 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 27 Feb 2012 15:24:14 -0500 Subject: Reduce redundancy in llprocess_test.cpp using get_test_name(). --- indra/llcommon/tests/llprocess_test.cpp | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index d7feddd26b..b02a5c0631 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -620,7 +620,7 @@ namespace tut // guaranteed to exist on every machine, under every OS? Have to // create one. Naturally, ensure we clean it up when done. NamedTempDir tempdir; - PythonProcessLauncher py("getcwd()", + PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import os, sys\n" "with open(sys.argv[1], 'w') as f:\n" @@ -634,7 +634,7 @@ namespace tut void object::test<3>() { set_test_name("arguments"); - PythonProcessLauncher py("args", + PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys\n" // note nonstandard output-file arg! @@ -668,7 +668,7 @@ namespace tut void object::test<4>() { set_test_name("exit(0)"); - PythonProcessLauncher py("exit(0)", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(0)\n"); py.run(); @@ -680,7 +680,7 @@ namespace tut void object::test<5>() { set_test_name("exit(2)"); - PythonProcessLauncher py("exit(2)", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(2)\n"); py.run(); @@ -692,7 +692,7 @@ namespace tut void object::test<6>() { set_test_name("syntax_error:"); - PythonProcessLauncher py("syntax_error:", + PythonProcessLauncher py(get_test_name(), "syntax_error:\n"); py.mParams.files.add(LLProcess::FileParam()); // inherit stdin py.mParams.files.add(LLProcess::FileParam()); // inherit stdout @@ -713,7 +713,7 @@ namespace tut void object::test<7>() { set_test_name("explicit kill()"); - PythonProcessLauncher py("kill()", + PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys, time\n" "with open(sys.argv[1], 'w') as f:\n" @@ -750,7 +750,7 @@ namespace tut // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. - ensure_equals("kill() script output", readfile(out.getName()), "ok"); + ensure_equals(get_test_name() + " script output", readfile(out.getName()), "ok"); } template<> template<> @@ -760,7 +760,7 @@ namespace tut NamedTempFile out("out", "not started"); LLProcess::handle phandle(0); { - PythonProcessLauncher py("kill()", + PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys, time\n" "with open(sys.argv[1], 'w') as f:\n" @@ -792,7 +792,7 @@ namespace tut // If kill() failed, the script would have woken up on its own and // overwritten the file with 'bad'. But if kill() succeeded, it should // not have had that chance. - ensure_equals("kill() script output", readfile(out.getName()), "ok"); + ensure_equals(get_test_name() + " script output", readfile(out.getName()), "ok"); } template<> template<> @@ -803,7 +803,7 @@ namespace tut NamedTempFile to("to", ""); LLProcess::handle phandle(0); { - PythonProcessLauncher py("autokill", + PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys, time\n" "with open(sys.argv[1], 'w') as f:\n" @@ -852,7 +852,7 @@ namespace tut waitfor(phandle, "autokill script"); // If the LLProcess destructor implicitly called kill(), the // script could not have written 'ack' as we expect. - ensure_equals("autokill script output", readfile(from.getName()), "ack"); + ensure_equals(get_test_name() + " script output", readfile(from.getName()), "ack"); } template<> template<> @@ -860,7 +860,7 @@ namespace tut { set_test_name("'bogus' test"); TestRecorder recorder; - PythonProcessLauncher py("'bogus' test", + PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam("bogus")); py.mPy = LLProcess::create(py.mParams); @@ -876,7 +876,7 @@ namespace tut set_test_name("'file' test"); // Replace this test with one or more real 'file' tests when we // implement 'file' support - PythonProcessLauncher py("'file' test", + PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam("file")); @@ -891,7 +891,7 @@ namespace tut // Replace this test with one or more real 'tpipe' tests when we // implement 'tpipe' support TestRecorder recorder; - PythonProcessLauncher py("'tpipe' test", + PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam("tpipe")); @@ -909,7 +909,7 @@ namespace tut // Replace this test with one or more real 'npipe' tests when we // implement 'npipe' support TestRecorder recorder; - PythonProcessLauncher py("'npipe' test", + PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam()); @@ -926,7 +926,7 @@ namespace tut { set_test_name("internal pipe name warning"); TestRecorder recorder; - PythonProcessLauncher py("pipe warning", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(7)\n"); py.mParams.files.add(LLProcess::FileParam("pipe", "somename")); @@ -990,7 +990,7 @@ namespace tut void object::test<15>() { set_test_name("get*Pipe() validation"); - PythonProcessLauncher py("just stderr", + PythonProcessLauncher py(get_test_name(), "print 'this output is expected'\n"); py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stdin py.mParams.files.add(LLProcess::FileParam()); // inherit stdout @@ -1010,7 +1010,7 @@ namespace tut void object::test<16>() { set_test_name("talk to stdin/stdout"); - PythonProcessLauncher py("stdin/stdout", + PythonProcessLauncher py(get_test_name(), "import sys, time\n" "print 'ok'\n" "sys.stdout.flush()\n" @@ -1071,7 +1071,7 @@ namespace tut void object::test<17>() { set_test_name("listen for ReadPipe events"); - PythonProcessLauncher py("ReadPipe listener", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.stdout.write('abc')\n" "sys.stdout.flush()\n" @@ -1131,7 +1131,7 @@ namespace tut void object::test<18>() { set_test_name("setLimit()"); - PythonProcessLauncher py("setLimit()", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.stdout.write(sys.argv[1])\n"); std::string abc("abcdefghijklmnopqrstuvwxyz"); @@ -1160,7 +1160,7 @@ namespace tut void object::test<19>() { set_test_name("peek() ReadPipe data"); - PythonProcessLauncher py("peek() ReadPipe", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.stdout.write(sys.argv[1])\n"); std::string abc("abcdefghijklmnopqrstuvwxyz"); @@ -1213,7 +1213,7 @@ namespace tut void object::test<20>() { set_test_name("good postend"); - PythonProcessLauncher py("postend", + PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(35)\n"); std::string pumpname("postend"); @@ -1247,7 +1247,7 @@ namespace tut std::string pumpname("postend"); EventListener listener(LLEventPumps::instance().obtain(pumpname)); LLProcess::Params params; - params.desc = "bad postend"; + params.desc = get_test_name(); params.postend = pumpname; LLProcessPtr child = LLProcess::create(params); ensure("shouldn't have launched", ! child); -- cgit v1.2.3 From 1effb12705d9e85c8fbea45177b2cdb9be1f9bed Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 28 Feb 2012 12:50:10 -0800 Subject: EXP-1888 FIX Update text for emtpy Received Items folder in the Viewer --- indra/newview/skins/default/xui/en/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c82f99ffe6..4bc72be49b 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2037,7 +2037,7 @@ Returns a string with the requested data about the region Didn't find what you're looking for? Try [secondlife:///app/search/places/[SEARCH_TERM] Search]. Drag a landmark here to add it to your favorites. You do not have a copy of this texture in your inventory - Certain items you receive, such as Marketplace purchases and objects shared with you in world, will appear here. You may then drag them into your inventory to use them. + Your Marketplace purchases will appear here. You may then drag them into your inventory to use them. https://marketplace.[MARKETPLACE_DOMAIN_NAME]/ http://community.secondlife.com/t5/English-Knowledge-Base/Selling-in-the-Marketplace/ta-p/700193#Section_.4 https://marketplace.[MARKETPLACE_DOMAIN_NAME]/merchants/store/dashboard -- cgit v1.2.3 From 3649eda62ad3a04203e6c562e78815a95896bbd4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 29 Feb 2012 17:10:19 -0500 Subject: Guarantee LLProcess::Params::postend listener any ReadPipe data. Previously one might get process-terminated notification but still have to wait for the child process's final data to arrive on one or more ReadPipes. That required complex consumer timing logic to handle incomplete pending ReadPipe data, e.g. a partial last line with no terminating newline. New code guarantees that by the time LLProcess sends process-terminated notification, all pending pipe data will have been buffered in ReadPipes. Document LLProcess::ReadPipe::getPump() notification event; add "eof" key. Add LLProcess::ReadPipe::getline() and read() convenience methods. Add static LLProcess::getline() and basename() convenience methods, publishing logic already present elsewhere. Use ReadPipe::getline() and read() in unit tests. Add unit test for "eof" event on ReadPipe::getPump(). Add unit test verifying that final data have been buffered by termination notification event. --- indra/llcommon/llprocess.cpp | 107 +++++++++++++++++++----- indra/llcommon/llprocess.h | 31 ++++++- indra/llcommon/tests/llprocess_test.cpp | 139 ++++++++++++++++++++++---------- 3 files changed, 210 insertions(+), 67 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 3b17b819bd..edfdebfe87 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -220,7 +220,8 @@ public: // Essential to initialize our std::istream with our special streambuf! mStream(&mStreambuf), mPump("ReadPipe", true), // tweak name as needed to avoid collisions - mLimit(0) + mLimit(0), + mEOF(false) { mConnection = LLEventPumps::instance().obtain("mainloop") .listen(LLEventPump::inventName("ReadPipe"), @@ -230,11 +231,25 @@ public: // Much of the implementation is simply connecting the abstract virtual // methods with implementation data concealed from the base class. virtual std::istream& get_istream() { return mStream; } + virtual std::string getline() { return LLProcess::getline(mStream); } virtual LLEventPump& getPump() { return mPump; } virtual void setLimit(size_type limit) { mLimit = limit; } virtual size_type getLimit() const { return mLimit; } virtual size_type size() const { return mStreambuf.size(); } + virtual std::string read(size_type len) + { + // Read specified number of bytes into a buffer. Make a buffer big + // enough. + size_type readlen((std::min)(size(), len)); + std::vector buffer(readlen); + mStream.read(&buffer[0], readlen); + // Since we've already clamped 'readlen', we can think of no reason + // why mStream.read() should read fewer than 'readlen' bytes. + // Nonetheless, use the actual retrieved length. + return std::string(&buffer[0], mStream.gcount()); + } + virtual std::string peek(size_type offset=0, size_type len=npos) const { // Constrain caller's offset and len to overlap actual buffer content. @@ -287,14 +302,18 @@ public: return (found == end)? npos : (found - begin); } -private: bool tick(const LLSD&) { + // Once we've hit EOF, skip all the rest of this. + if (mEOF) + return false; + typedef boost::asio::streambuf::mutable_buffers_type mutable_buffer_sequence; // Try, every time, to read into our streambuf. In fact, we have no // idea how much data the child might be trying to send: keep trying // until we're convinced we've temporarily exhausted the pipe. - bool exhausted = false; + enum PipeState { RETRY, EXHAUSTED, CLOSED }; + PipeState state = RETRY; std::size_t committed(0); do { @@ -329,7 +348,9 @@ private: } // Either way, though, we won't need any more tick() calls. mConnection.disconnect(); - exhausted = true; // also break outer retry loop + // Ignore any subsequent calls we might get anyway. + mEOF = true; + state = CLOSED; // also break outer retry loop break; } @@ -347,7 +368,7 @@ private: if (gotten < toread) { // break outer retry loop too - exhausted = true; + state = EXHAUSTED; break; } } @@ -356,15 +377,20 @@ private: mStreambuf.commit(tocommit); committed += tocommit; - // 'exhausted' is set when we can't fill any one buffer of the - // mutable_buffer_sequence established by the current prepare() - // call -- whether due to error or not enough bytes. That is, - // 'exhausted' is still false when we've filled every physical + // state is changed from RETRY when we can't fill any one buffer + // of the mutable_buffer_sequence established by the current + // prepare() call -- whether due to error or not enough bytes. + // That is, if state is still RETRY, we've filled every physical // buffer in the mutable_buffer_sequence. In that case, for all we // know, the child might have still more data pending -- go for it! - } while (! exhausted); - - if (committed) + } while (state == RETRY); + + // Once we recognize that the pipe is closed, make one more call to + // listener. The listener might be waiting for a particular substring + // to arrive, or a particular length of data or something. The event + // with "eof" == true announces that nothing further will arrive, so + // use it or lose it. + if (committed || state == CLOSED) { // If we actually received new data, publish it on our LLEventPump // as advertised. Constrain it by mLimit. But show listener the @@ -373,14 +399,16 @@ private: mPump.post(LLSDMap ("data", peek(0, datasize)) ("len", LLSD::Integer(mStreambuf.size())) - ("index", LLSD::Integer(mIndex)) + ("slot", LLSD::Integer(mIndex)) ("name", whichfile(mIndex)) - ("desc", mDesc)); + ("desc", mDesc) + ("eof", state == CLOSED)); } return false; } +private: std::string mDesc; apr_file_t* mPipe; LLProcess::FILESLOT mIndex; @@ -389,6 +417,7 @@ private: std::istream mStream; LLEventStream mPump; size_type mLimit; + bool mEOF; }; /// Need an exception to avoid constructing an invalid LLProcess object, but @@ -641,17 +670,22 @@ static std::string getDesc(const LLProcess::Params& params) // Caller didn't say. Use the executable name -- but use just the filename // part. On Mac, for instance, full pathnames get cumbersome. + return LLProcess::basename(params.executable); +} + +//static +std::string LLProcess::basename(const std::string& path) +{ // If there are Linden utility functions to manipulate pathnames, I // haven't found them -- and for this usage, Boost.Filesystem seems kind // of heavyweight. - std::string executable(params.executable); - std::string::size_type delim = executable.find_last_of("\\/"); - // If executable contains no pathname delimiters, return the whole thing. + std::string::size_type delim = path.find_last_of("\\/"); + // If path contains no pathname delimiters, return the whole thing. if (delim == std::string::npos) - return executable; + return path; // Return just the part beyond the last delimiter. - return executable.substr(delim + 1); + return path.substr(delim + 1); } LLProcess::~LLProcess() @@ -804,6 +838,24 @@ void LLProcess::handle_status(int reason, int status) // KILLED; refine below. mStatus.mState = EXITED; + // Make last-gasp calls for each of the ReadPipes we have on hand. Since + // they're listening on "mainloop", we can be sure they'll eventually + // collect all pending data from the child. But we want to be able to + // guarantee to our consumer that by the time we post on the "postend" + // LLEventPump, our ReadPipes are already buffering all the data there + // will ever be from the child. That lets the "postend" listener decide + // what to do with that final data. + for (size_t i = 0; i < mPipes.size(); ++i) + { + std::string error; + ReadPipeImpl* ppipe = getPipePtr(error, FILESLOT(i)); + if (ppipe) + { + static LLSD trivial; + ppipe->tick(trivial); + } + } + // wi->rv = apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT); // It's just wrong to call apr_proc_wait() here. The only way APR knows to // call us with APR_OC_REASON_DEATH is that it's already reaped this child @@ -919,6 +971,23 @@ boost::optional LLProcess::getOptReadPipe(FILESLOT slot) return getOptPipe(slot); } +//static +std::string LLProcess::getline(std::istream& in) +{ + std::string line; + std::getline(in, line); + // Blur the distinction between "\r\n" and plain "\n". std::getline() will + // have eaten the "\n", but we could still end up with a trailing "\r". + std::string::size_type lastpos = line.find_last_not_of("\r"); + if (lastpos != std::string::npos) + { + // Found at least one character that's not a trailing '\r'. SKIP OVER + // IT and erase the rest of the line. + line.erase(lastpos+1); + } + return line; +} + std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) { if (params.cwd.isProvided()) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 637b7e2f9c..06ada83698 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -156,7 +156,7 @@ public: // set them rather than initialization. if (! tp.empty()) type = tp; if (! nm.empty()) name = nm; - } + } }; /// Param block definition @@ -375,6 +375,18 @@ public: */ virtual std::istream& get_istream() = 0; + /** + * Like std::getline(get_istream(), line), but trims off trailing '\r' + * to make calling code less platform-sensitive. + */ + virtual std::string getline() = 0; + + /** + * Like get_istream().read(buffer, n), but returns std::string rather + * than requiring caller to construct a buffer, etc. + */ + virtual std::string read(size_type len) = 0; + /** * Get accumulated buffer length. * Often we need to refrain from actually reading the std::istream @@ -420,9 +432,15 @@ public: /** * Get LLEventPump& on which to listen for incoming data. The posted - * LLSD::Map event will contain a key "data" whose value is an - * LLSD::String containing (part of) the data accumulated in the - * buffer. + * LLSD::Map event will contain: + * + * - "data" part of pending data; see setLimit() + * - "len" entire length of pending data, regardless of setLimit() + * - "slot" this ReadPipe's FILESLOT, e.g. LLProcess::STDOUT + * - "name" e.g. "stdout" + * - "desc" e.g. "SLPlugin (pid) stdout" + * - "eof" @c true means there no more data will arrive on this pipe, + * therefore no more events on this pump * * If the child sends "abc", and this ReadPipe posts "data"="abc", but * you don't consume it by reading the std::istream returned by @@ -487,6 +505,11 @@ public: */ boost::optional getOptReadPipe(FILESLOT slot); + /// little utilities that really should already be somewhere else in the + /// code base + static std::string basename(const std::string& path); + static std::string getline(std::istream&); + private: /// constructor is private: use create() instead LLProcess(const LLSDOrParams& params); diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index b02a5c0631..3537133a47 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -295,22 +295,6 @@ public: LLError::Settings* mOldSettings; }; -std::string getline(std::istream& in) -{ - std::string line; - std::getline(in, line); - // Blur the distinction between "\r\n" and plain "\n". std::getline() will - // have eaten the "\n", but we could still end up with a trailing "\r". - std::string::size_type lastpos = line.find_last_not_of("\r"); - if (lastpos != std::string::npos) - { - // Found at least one character that's not a trailing '\r'. SKIP OVER - // IT and then erase the rest of the line. - line.erase(lastpos+1); - } - return line; -} - /***************************************************************************** * TUT *****************************************************************************/ @@ -1030,7 +1014,7 @@ namespace tut } ensure("script never started", i < timeout); ensure_equals("bad wakeup from stdin/stdout script", - getline(childout.get_istream()), "ok"); + childout.getline(), "ok"); // important to get the implicit flush from std::endl py.mPy->getWritePipe().get_ostream() << "go" << std::endl; for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) @@ -1038,7 +1022,7 @@ namespace tut yield(); } ensure("script never replied", childout.contains("\n")); - ensure_equals("child didn't ack", getline(childout.get_istream()), "ack"); + ensure_equals("child didn't ack", childout.getline(), "ack"); ensure_equals("bad child termination", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("bad child exit code", py.mPy->getStatus().mData, 0); } @@ -1129,6 +1113,32 @@ namespace tut template<> template<> void object::test<18>() + { + set_test_name("ReadPipe \"eof\" event"); + PythonProcessLauncher py(get_test_name(), + "print 'Hello from Python!'\n"); + py.mParams.files.add(LLProcess::FileParam()); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.launch(); + LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); + EventListener listener(childout.getPump()); + waitfor(*py.mPy); + // We can't be positive there will only be a single event, if the OS + // (or any other intervening layer) does crazy buffering. What we want + // to ensure is that there was exactly ONE event with "eof" true, and + // that it was the LAST event. + std::list::const_reverse_iterator rli(listener.mHistory.rbegin()), + rlend(listener.mHistory.rend()); + ensure("no events", rli != rlend); + ensure("last event not \"eof\"", (*rli)["eof"].asBoolean()); + while (++rli != rlend) + { + ensure("\"eof\" event not last", ! (*rli)["eof"].asBoolean()); + } + } + + template<> template<> + void object::test<19>() { set_test_name("setLimit()"); PythonProcessLauncher py(get_test_name(), @@ -1157,7 +1167,7 @@ namespace tut } template<> template<> - void object::test<19>() + void object::test<20>() { set_test_name("peek() ReadPipe data"); PythonProcessLauncher py(get_test_name(), @@ -1210,7 +1220,32 @@ namespace tut } template<> template<> - void object::test<20>() + void object::test<21>() + { + set_test_name("bad postend"); + std::string pumpname("postend"); + EventListener listener(LLEventPumps::instance().obtain(pumpname)); + LLProcess::Params params; + params.desc = get_test_name(); + params.postend = pumpname; + LLProcessPtr child = LLProcess::create(params); + ensure("shouldn't have launched", ! child); + ensure_equals("number of postend events", listener.mHistory.size(), 1); + LLSD postend(listener.mHistory.front()); + ensure("has id", ! postend.has("id")); + ensure_equals("desc", postend["desc"].asString(), std::string(params.desc)); + ensure_equals("state", postend["state"].asInteger(), LLProcess::UNSTARTED); + ensure("has data", ! postend.has("data")); + std::string error(postend["string"]); + // All we get from canned parameter validation is a bool, so the + // "validation failed" message we ourselves generate can't mention + // "executable" by name. Just check that it's nonempty. + //ensure_contains("error", error, "executable"); + ensure("string", ! error.empty()); + } + + template<> template<> + void object::test<22>() { set_test_name("good postend"); PythonProcessLauncher py(get_test_name(), @@ -1240,32 +1275,48 @@ namespace tut ensure_contains("string", str, "35"); } + struct PostendListener + { + PostendListener(LLProcess::ReadPipe& rpipe, + const std::string& pumpname, + const std::string& expect): + mReadPipe(rpipe), + mExpect(expect), + mTriggered(false) + { + LLEventPumps::instance().obtain(pumpname) + .listen("PostendListener", boost::bind(&PostendListener::postend, this, _1)); + } + + bool postend(const LLSD&) + { + mTriggered = true; + ensure_equals("postend listener", mReadPipe.read(mReadPipe.size()), mExpect); + return false; + } + + LLProcess::ReadPipe& mReadPipe; + std::string mExpect; + bool mTriggered; + }; + template<> template<> - void object::test<21>() + void object::test<23>() { - set_test_name("bad postend"); + set_test_name("all data visible at postend"); + PythonProcessLauncher py(get_test_name(), + "import sys\n" + // note, no '\n' in written data + "sys.stdout.write('partial line')\n"); std::string pumpname("postend"); - EventListener listener(LLEventPumps::instance().obtain(pumpname)); - LLProcess::Params params; - params.desc = get_test_name(); - params.postend = pumpname; - LLProcessPtr child = LLProcess::create(params); - ensure("shouldn't have launched", ! child); - ensure_equals("number of postend events", listener.mHistory.size(), 1); - LLSD postend(listener.mHistory.front()); - ensure("has id", ! postend.has("id")); - ensure_equals("desc", postend["desc"].asString(), std::string(params.desc)); - ensure_equals("state", postend["state"].asInteger(), LLProcess::UNSTARTED); - ensure("has data", ! postend.has("data")); - std::string error(postend["string"]); - // All we get from canned parameter validation is a bool, so the - // "validation failed" message we ourselves generate can't mention - // "executable" by name. Just check that it's nonempty. - //ensure_contains("error", error, "executable"); - ensure("string", ! error.empty()); + py.mParams.files.add(LLProcess::FileParam()); // stdin + py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout + py.mParams.postend = pumpname; + py.launch(); + PostendListener listener(py.mPy->getReadPipe(LLProcess::STDOUT), + pumpname, + "partial line"); + waitfor(*py.mPy); + ensure("postend never triggered", listener.mTriggered); } - - // TODO: - // test EOF -- check logging - } // namespace tut -- cgit v1.2.3 From bc7771a415ee6d8e10b529a3ea535b00d5666b75 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 29 Feb 2012 15:08:06 -0800 Subject: Added tag 3.3.0-start for changeset d5f263687f43 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5b9726b47c..e994e188e7 100644 --- a/.hgtags +++ b/.hgtags @@ -269,3 +269,4 @@ e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1 a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2 a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2 987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 +d5f263687f43f278107363365938f0a214920a4b 3.3.0-start -- cgit v1.2.3 From ca36a06d2e994178cecfae249f7f1cc3af3554a0 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 29 Feb 2012 15:08:57 -0800 Subject: increment viewer version to 3.3.1 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index a869c74189..26ff1b5c55 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 3; -const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_PATCH = 1; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 40dc3e0d3bee6ff70fb68d9ba7f0a2ee9da96f68 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 29 Feb 2012 19:40:18 -0500 Subject: When constructing a pipe to child stdin on Posix, ignore SIGPIPE. We can't count on every child process reading everything we try to write to it. And if the child terminates with WritePipe data still pending, unless we explicitly suppress it, Posix will hit us with SIGPIPE. That would terminate the calling process, boom. "Ignoring" it means APR gets the correct errno, passes it back to us, we log it, etc. --- indra/llcommon/llprocess.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index edfdebfe87..8ccd39152b 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -145,6 +145,15 @@ public: mConnection = LLEventPumps::instance().obtain("mainloop") .listen(LLEventPump::inventName("WritePipe"), boost::bind(&WritePipeImpl::tick, this, _1)); + +#if ! LL_WINDOWS + // We can't count on every child process reading everything we try to + // write to it. And if the child terminates with WritePipe data still + // pending, unless we explicitly suppress it, Posix will hit us with + // SIGPIPE. That would terminate the viewer, boom. "Ignoring" it means + // APR gets the correct errno, passes it back to us, we log it, etc. + signal(SIGPIPE, SIG_IGN); +#endif } virtual std::ostream& get_ostream() { return mStream; } -- cgit v1.2.3 From 2596816f316e13b717bcdacddad0da48c90c3b6d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 13:43:52 -0500 Subject: Break out TestRecorder class as CaptureLog into wrapllerrs.h. Giving more unit tests the ability to capture and examine log output is generally useful. Renaming the class just makes it less ambiguous: what's a TestRecorder? Something that records tests? --- indra/llcommon/tests/llprocess_test.cpp | 74 +++------------------------------ indra/llcommon/tests/wrapllerrs.h | 65 +++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 3537133a47..c07a9d3925 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -35,7 +35,7 @@ #include "stringize.h" #include "llsdutil.h" #include "llevents.h" -#include "llerrorcontrol.h" +#include "wrapllerrs.h" #if defined(LL_WINDOWS) #define sleep(secs) _sleep((secs) * 1000) @@ -233,68 +233,6 @@ private: std::string mPath; }; -// statically reference the function in test.cpp... it's short, we could -// replicate, but better to reuse -extern void wouldHaveCrashed(const std::string& message); - -/** - * Capture log messages. This is adapted (simplified) from the one in - * llerror_test.cpp. Sigh, should've broken that out into a separate header - * file, but time for this project is short... - */ -class TestRecorder : public LLError::Recorder -{ -public: - TestRecorder(): - // Mostly what we're trying to accomplish by saving and resetting - // LLError::Settings is to bypass the default RecordToStderr and - // RecordToWinDebug Recorders. As these are visible only inside - // llerror.cpp, we can't just call LLError::removeRecorder() with - // each. For certain tests we need to produce, capture and examine - // DEBUG log messages -- but we don't want to spam the user's console - // with that output. If it turns out that saveAndResetSettings() has - // some bad effect, give up and just let the DEBUG level log messages - // display. - mOldSettings(LLError::saveAndResetSettings()) - { - LLError::setFatalFunction(wouldHaveCrashed); - LLError::setDefaultLevel(LLError::LEVEL_DEBUG); - LLError::addRecorder(this); - } - - ~TestRecorder() - { - LLError::removeRecorder(this); - LLError::restoreSettings(mOldSettings); - } - - void recordMessage(LLError::ELevel level, - const std::string& message) - { - mMessages.push_back(message); - } - - /// Don't assume the message we want is necessarily the LAST log message - /// emitted by the underlying code; search backwards through all messages - /// for the sought string. - std::string messageWith(const std::string& search) - { - for (std::list::const_reverse_iterator rmi(mMessages.rbegin()), - rmend(mMessages.rend()); - rmi != rmend; ++rmi) - { - if (rmi->find(search) != std::string::npos) - return *rmi; - } - // failed to find any such message - return std::string(); - } - - typedef std::list MessageList; - MessageList mMessages; - LLError::Settings* mOldSettings; -}; - /***************************************************************************** * TUT *****************************************************************************/ @@ -843,7 +781,7 @@ namespace tut void object::test<10>() { set_test_name("'bogus' test"); - TestRecorder recorder; + CaptureLog recorder; PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam("bogus")); @@ -874,7 +812,7 @@ namespace tut set_test_name("'tpipe' test"); // Replace this test with one or more real 'tpipe' tests when we // implement 'tpipe' support - TestRecorder recorder; + CaptureLog recorder; PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam()); @@ -892,7 +830,7 @@ namespace tut set_test_name("'npipe' test"); // Replace this test with one or more real 'npipe' tests when we // implement 'npipe' support - TestRecorder recorder; + CaptureLog recorder; PythonProcessLauncher py(get_test_name(), "print 'Hello world'\n"); py.mParams.files.add(LLProcess::FileParam()); @@ -909,7 +847,7 @@ namespace tut void object::test<14>() { set_test_name("internal pipe name warning"); - TestRecorder recorder; + CaptureLog recorder; PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(7)\n"); @@ -965,7 +903,7 @@ namespace tut #define EXPECT_FAIL_WITH_LOG(EXPECT, CODE) \ do \ { \ - TestRecorder recorder; \ + CaptureLog recorder; \ ensure(#CODE " succeeded", ! (CODE)); \ ensure("wrong log message", ! recorder.messageWith(EXPECT).empty()); \ } while (0) diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index ffda84729b..a61f8451b3 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -30,6 +30,14 @@ #define LL_WRAPLLERRS_H #include "llerrorcontrol.h" +#include +#include +#include +#include + +// statically reference the function in test.cpp... it's short, we could +// replicate, but better to reuse +extern void wouldHaveCrashed(const std::string& message); struct WrapLL_ERRS { @@ -70,4 +78,61 @@ struct WrapLL_ERRS LLError::FatalFunction mPriorFatal; }; +/** + * Capture log messages. This is adapted (simplified) from the one in + * llerror_test.cpp. + */ +class CaptureLog : public LLError::Recorder +{ +public: + CaptureLog(): + // Mostly what we're trying to accomplish by saving and resetting + // LLError::Settings is to bypass the default RecordToStderr and + // RecordToWinDebug Recorders. As these are visible only inside + // llerror.cpp, we can't just call LLError::removeRecorder() with + // each. For certain tests we need to produce, capture and examine + // DEBUG log messages -- but we don't want to spam the user's console + // with that output. If it turns out that saveAndResetSettings() has + // some bad effect, give up and just let the DEBUG level log messages + // display. + mOldSettings(LLError::saveAndResetSettings()) + { + LLError::setFatalFunction(wouldHaveCrashed); + LLError::setDefaultLevel(LLError::LEVEL_DEBUG); + LLError::addRecorder(this); + } + + ~CaptureLog() + { + LLError::removeRecorder(this); + LLError::restoreSettings(mOldSettings); + } + + void recordMessage(LLError::ELevel level, + const std::string& message) + { + mMessages.push_back(message); + } + + /// Don't assume the message we want is necessarily the LAST log message + /// emitted by the underlying code; search backwards through all messages + /// for the sought string. + std::string messageWith(const std::string& search) + { + for (std::list::const_reverse_iterator rmi(mMessages.rbegin()), + rmend(mMessages.rend()); + rmi != rmend; ++rmi) + { + if (rmi->find(search) != std::string::npos) + return *rmi; + } + // failed to find any such message + return std::string(); + } + + typedef std::list MessageList; + MessageList mMessages; + LLError::Settings* mOldSettings; +}; + #endif /* ! defined(LL_WRAPLLERRS_H) */ -- cgit v1.2.3 From 22fcb563ce45e64f23c9911bdcd07b0086bc892a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 14:27:32 -0500 Subject: Log better error message in case of apr_proc_create() failure. We were using uniform macro to report the APR function and its C++ parameter expressions. But specifically for apr_proc_create() failure, better to report the command we're attempting to execute. --- indra/llcommon/llprocess.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 8ccd39152b..9c49517598 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -617,8 +617,14 @@ LLProcess::LLProcess(const LLSDOrParams& params): // terminate with a null pointer argv.push_back(NULL); - // Launch! The NULL would be the environment block, if we were passing one. - chkapr(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, gAPRPoolp)); + // Launch! The NULL would be the environment block, if we were passing + // one. Hand-expand chkapr() macro so we can fill in the actual command + // string instead of the variable names. + if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, + gAPRPoolp))) + { + throw LLProcessError(STRINGIZE(params << " failed")); + } // arrange to call status_callback() apr_proc_other_child_register(&mProcess, &LLProcess::status_callback, this, mProcess.in, -- cgit v1.2.3 From f904867720291bc63ea5e140194069d29f70fb40 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 14:33:23 -0500 Subject: Make CaptureLog::withMessage() raise tut::failure if not found. All known callers were using ensure(! withMessage(...).empty()). Centralize that logic. Make failure message report the string being sought and the log messages in which it wasn't found. In case someone does want to permit the search to fail, add an optional 'required' parameter, default true. Leverage new functionality in llprocess_test.cpp. --- indra/llcommon/tests/llprocess_test.cpp | 6 +----- indra/llcommon/tests/wrapllerrs.h | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index c07a9d3925..6103764f24 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -788,7 +788,6 @@ namespace tut py.mPy = LLProcess::create(py.mParams); ensure("should have rejected 'bogus'", ! py.mPy); std::string message(recorder.messageWith("bogus")); - ensure("did not log 'bogus' type", ! message.empty()); ensure_contains("did not name 'stdin'", message, "stdin"); } @@ -820,7 +819,6 @@ namespace tut py.mPy = LLProcess::create(py.mParams); ensure("should have rejected 'tpipe'", ! py.mPy); std::string message(recorder.messageWith("tpipe")); - ensure("did not log 'tpipe' type", ! message.empty()); ensure_contains("did not name 'stdout'", message, "stdout"); } @@ -839,7 +837,6 @@ namespace tut py.mPy = LLProcess::create(py.mParams); ensure("should have rejected 'npipe'", ! py.mPy); std::string message(recorder.messageWith("npipe")); - ensure("did not log 'npipe' type", ! message.empty()); ensure_contains("did not name 'stderr'", message, "stderr"); } @@ -856,7 +853,6 @@ namespace tut ensure_equals("Status.mState", py.mPy->getStatus().mState, LLProcess::EXITED); ensure_equals("Status.mData", py.mPy->getStatus().mData, 7); std::string message(recorder.messageWith("not yet supported")); - ensure("did not log pipe name warning", ! message.empty()); ensure_contains("log message did not mention internal pipe name", message, "somename"); } @@ -905,7 +901,7 @@ namespace tut { \ CaptureLog recorder; \ ensure(#CODE " succeeded", ! (CODE)); \ - ensure("wrong log message", ! recorder.messageWith(EXPECT).empty()); \ + recorder.messageWith(EXPECT); \ } while (0) template<> template<> diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index a61f8451b3..28ffbf517f 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -29,11 +29,13 @@ #if ! defined(LL_WRAPLLERRS_H) #define LL_WRAPLLERRS_H +#include #include "llerrorcontrol.h" #include #include #include #include +#include // statically reference the function in test.cpp... it's short, we could // replicate, but better to reuse @@ -117,17 +119,26 @@ public: /// Don't assume the message we want is necessarily the LAST log message /// emitted by the underlying code; search backwards through all messages /// for the sought string. - std::string messageWith(const std::string& search) + std::string messageWith(const std::string& search, bool required=true) { - for (std::list::const_reverse_iterator rmi(mMessages.rbegin()), - rmend(mMessages.rend()); + for (MessageList::const_reverse_iterator rmi(mMessages.rbegin()), rmend(mMessages.rend()); rmi != rmend; ++rmi) { if (rmi->find(search) != std::string::npos) return *rmi; } // failed to find any such message - return std::string(); + if (! required) + return std::string(); + + std::ostringstream out; + out << "failed to find '" << search << "' in captured log messages:"; + for (MessageList::const_iterator mi(mMessages.begin()), mend(mMessages.end()); + mi != mend; ++mi) + { + out << '\n' << *mi; + } + throw tut::failure(out.str()); } typedef std::list MessageList; -- cgit v1.2.3 From c8032de94e7fcad3cc8ce45db2d20cb1664ebea9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 14:37:41 -0500 Subject: Add NamedExtTempFile to invent arbitrary name with specified ext. This arises, for instance, if you want to be able to create a temporary Python module you can import from test scripts. The Python module file MUST have the .py extension. --- indra/test/namedtempfile.h | 97 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/indra/test/namedtempfile.h b/indra/test/namedtempfile.h index aa7058b111..6069064627 100644 --- a/indra/test/namedtempfile.h +++ b/indra/test/namedtempfile.h @@ -12,6 +12,7 @@ #if ! defined(LL_NAMEDTEMPFILE_H) #define LL_NAMEDTEMPFILE_H +#include "llerror.h" #include "llapr.h" #include "apr_file_io.h" #include @@ -28,6 +29,7 @@ */ class NamedTempFile: public boost::noncopyable { + LOG_CLASS(NamedTempFile); public: NamedTempFile(const std::string& pfx, const std::string& content, apr_pool_t* pool=gAPRPoolp): mPool(pool) @@ -53,12 +55,12 @@ public: createFile(pfx, func); } - ~NamedTempFile() + virtual ~NamedTempFile() { ll_apr_assert_status(apr_file_remove(mPath.c_str(), mPool)); } - std::string getName() const { return mPath; } + virtual std::string getName() const { return mPath; } void peep() { @@ -70,7 +72,7 @@ public: std::cout << "---\n"; } -private: +protected: void createFile(const std::string& pfx, const Streamer& func) { // Create file in a temporary place. @@ -111,4 +113,93 @@ private: apr_pool_t* mPool; }; +/** + * Create a NamedTempFile with a specified filename extension. This is useful + * when, for instance, you must be able to use the file in a Python import + * statement. + * + * A NamedExtTempFile actually has two different names. We retain the original + * no-extension name as a placeholder in the temp directory to ensure + * uniqueness; to that we link the name plus the desired extension. Naturally, + * both must be removed on destruction. + */ +class NamedExtTempFile: public NamedTempFile +{ + LOG_CLASS(NamedExtTempFile); +public: + NamedExtTempFile(const std::string& ext, const std::string& content, apr_pool_t* pool=gAPRPoolp): + NamedTempFile(remove_dot(ext), content, pool), + mLink(mPath + ensure_dot(ext)) + { + linkto(mLink); + } + + // Disambiguate when passing string literal + NamedExtTempFile(const std::string& ext, const char* content, apr_pool_t* pool=gAPRPoolp): + NamedTempFile(remove_dot(ext), content, pool), + mLink(mPath + ensure_dot(ext)) + { + linkto(mLink); + } + + NamedExtTempFile(const std::string& ext, const Streamer& func, apr_pool_t* pool=gAPRPoolp): + NamedTempFile(remove_dot(ext), func, pool), + mLink(mPath + ensure_dot(ext)) + { + linkto(mLink); + } + + virtual ~NamedExtTempFile() + { + ll_apr_assert_status(apr_file_remove(mLink.c_str(), mPool)); + } + + // Since the caller has gone to the trouble to create the name with the + // extension, that should be the name we return. In this class, mPath is + // just a placeholder to ensure that future createFile() calls won't + // collide. + virtual std::string getName() const { return mLink; } + + static std::string ensure_dot(const std::string& ext) + { + if (ext.empty()) + { + // What SHOULD we do when the caller makes a point of using + // NamedExtTempFile to generate a file with a particular + // extension, then passes an empty extension? Use just "."? That + // sounds like a Bad Idea, especially on Windows. Treat that as a + // coding error. + LL_ERRS("NamedExtTempFile") << "passed empty extension" << LL_ENDL; + } + if (ext[0] == '.') + { + return ext; + } + return std::string(".") + ext; + } + + static std::string remove_dot(const std::string& ext) + { + std::string::size_type found = ext.find_first_not_of("."); + if (found == std::string::npos) + { + return ext; + } + return ext.substr(found); + } + +private: + void linkto(const std::string& path) + { + // This method assumes that since mPath (without extension) is + // guaranteed by apr_file_mktemp() to be unique, then (mPath + any + // extension) is also unique. This is likely, though not guaranteed: + // files could be created in the same temp directory other than by + // this class. + ll_apr_assert_status(apr_file_link(mPath.c_str(), path.c_str())); + } + + std::string mLink; +}; + #endif /* ! defined(LL_NAMEDTEMPFILE_H) */ -- cgit v1.2.3 From 739532ee4ffdd58f9d0999901340d5476533fec2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 1 Mar 2012 12:41:27 -0800 Subject: Added tag DRTVWR-113_3.2.8-release, 3.2.8-release for changeset 51b2fd52e36a --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 8b381a88a5..77446bee30 100644 --- a/.hgtags +++ b/.hgtags @@ -263,3 +263,5 @@ c6175c955a19e9b9353d242889ec1779b5762522 3.2.5-release 16f8e2915f3f2e4d732fb3125daf229cb0fd1875 3.2.8-beta1 987425b1acf4752379b2e1eb20944b4b35d67a85 DRTVWR-115_3.2.8-beta2 987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 +51b2fd52e36aab8f670e0874e7e1472434ec4b4a DRTVWR-113_3.2.8-release +51b2fd52e36aab8f670e0874e7e1472434ec4b4a 3.2.8-release -- cgit v1.2.3 From f0612f6fc424ab4726ef187f41a257c0abdd1d34 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 17:30:50 -0500 Subject: Allow CaptureLog's consumer to specify desired log level. Of course, given the way the log machinery works, it's really "everything at that level or stronger." --- indra/llcommon/tests/wrapllerrs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index 28ffbf517f..10cf25b39e 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -87,7 +87,7 @@ struct WrapLL_ERRS class CaptureLog : public LLError::Recorder { public: - CaptureLog(): + CaptureLog(LLError::ELevel level=LLError::LEVEL_DEBUG): // Mostly what we're trying to accomplish by saving and resetting // LLError::Settings is to bypass the default RecordToStderr and // RecordToWinDebug Recorders. As these are visible only inside @@ -100,7 +100,7 @@ public: mOldSettings(LLError::saveAndResetSettings()) { LLError::setFatalFunction(wouldHaveCrashed); - LLError::setDefaultLevel(LLError::LEVEL_DEBUG); + LLError::setDefaultLevel(level); LLError::addRecorder(this); } -- cgit v1.2.3 From 0ef99cd33b4b450712e105e8ab448c2dab7081d2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 17:46:44 -0500 Subject: Add LLLeap class, initial implementation, initial unit tests. Instantiating LLLeap with a command to execute a particular child process sets up machinery to speak LLSD Event API Plugin protocol with that child process. LLLeap is an LLInstanceTracker subclass, so the code that instantiates need not hold the pointer. LLLeap monitors child-process termination and deletes itself when done. --- indra/llcommon/CMakeLists.txt | 3 + indra/llcommon/llleap.cpp | 379 +++++++++++++++++++++++++++++++++++ indra/llcommon/llleap.h | 80 ++++++++ indra/llcommon/tests/llleap_test.cpp | 261 ++++++++++++++++++++++++ 4 files changed, 723 insertions(+) create mode 100644 indra/llcommon/llleap.cpp create mode 100644 indra/llcommon/llleap.h create mode 100644 indra/llcommon/tests/llleap_test.cpp diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 1cab648cfa..47a8aa96aa 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -63,6 +63,7 @@ set(llcommon_SOURCE_FILES llheartbeat.cpp llinitparam.cpp llinstancetracker.cpp + llleap.cpp llliveappconfig.cpp lllivefile.cpp lllog.cpp @@ -180,6 +181,7 @@ set(llcommon_HEADER_FILES llinstancetracker.h llkeythrottle.h lllazy.h + llleap.h lllistenerwrapper.h lllinkedqueue.h llliveappconfig.h @@ -333,6 +335,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(llleap "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") # *TODO - reenable these once tcmalloc libs no longer break the build. diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp new file mode 100644 index 0000000000..dddf1286ac --- /dev/null +++ b/indra/llcommon/llleap.cpp @@ -0,0 +1,379 @@ +/** + * @file llleap.cpp + * @author Nat Goodspeed + * @date 2012-02-20 + * @brief Implementation for llleap. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llleap.h" +// STL headers +#include +#include +// std headers +// external library headers +#include +#include +#include +// other Linden headers +#include "llerror.h" +#include "llstring.h" +#include "llprocess.h" +#include "llevents.h" +#include "stringize.h" +#include "llsdutil.h" +#include "llsdserialize.h" + +LLLeap::LLLeap() {} +LLLeap::~LLLeap() {} + +class LLLeapImpl: public LLLeap +{ +public: + // Called only by LLLeap::create() + LLLeapImpl(const std::string& desc, const std::vector& plugin): + // We might reassign mDesc in the constructor body if it's empty here. + mDesc(desc), + // We expect multiple LLLeapImpl instances. Definitely tweak + // mDonePump's name for uniqueness. + mDonePump("LLLeap", true), + // Troubling thought: what if one plugin intentionally messes with + // another plugin? LLEventPump names are in a single global namespace. + // Try to make that more difficult by generating a UUID for the reply- + // pump name -- so it should NOT need tweaking for uniqueness. + mReplyPump(LLUUID::generateNewID().asString()), + mExpect(0) + { + // Rule out empty vector + if (plugin.empty()) + { + throw Error("no plugin command"); + } + + // Don't leave desc empty either, but in this case, if we weren't + // given one, we'll fake one. + if (desc.empty()) + { + mDesc = LLProcess::basename(plugin[0]); + // how about a toLower() variant that returns the transformed string?! + std::string desclower(mDesc); + LLStringUtil::toLower(desclower); + // If we're running a Python script, use the script name for the + // desc instead of just 'python'. Arguably we should check for + // more different interpreters as well, but there's a reason to + // notice Python specially: we provide Python LLSD serialization + // support, so there's a pretty good reason to implement plugins + // in that language. + if (plugin.size() >= 2 && (desclower == "python" || desclower == "python.exe")) + { + mDesc = LLProcess::basename(plugin[1]); + } + } + + // Listen for child "termination" right away to catch launch errors. + mDonePump.listen("LLLeap", boost::bind(&LLLeapImpl::bad_launch, this, _1)); + + // Okay, launch child. + LLProcess::Params params; + params.desc = mDesc; + std::vector::const_iterator pi(plugin.begin()), pend(plugin.end()); + params.executable = *pi++; + for ( ; pi != pend; ++pi) + { + params.args.add(*pi); + } + params.files.add(LLProcess::FileParam("pipe")); // stdin + params.files.add(LLProcess::FileParam("pipe")); // stdout + params.files.add(LLProcess::FileParam("pipe")); // stderr + params.postend = mDonePump.getName(); + mChild = LLProcess::create(params); + // If that didn't work, no point in keeping this LLLeap object. + if (! mChild) + { + throw Error(STRINGIZE("failed to run " << mDesc)); + } + + // Okay, launch apparently worked. Change our mDonePump listener. + mDonePump.stopListening("LLLeap"); + mDonePump.listen("LLLeap", boost::bind(&LLLeapImpl::done, this, _1)); + + // Child might pump large volumes of data through either stdout or + // stderr. Don't bother copying all that data into notification event. + LLProcess::ReadPipe + &childout(mChild->getReadPipe(LLProcess::STDOUT)), + &childerr(mChild->getReadPipe(LLProcess::STDERR)); + childout.setLimit(20); + childerr.setLimit(20); + + // Serialize any event received on mReplyPump to our child's stdin, + // suitably enriched with the pump name on which it was received. + mStdinConnection = mReplyPump + .listen("LLLeap", + boost::bind(&LLLeapImpl::wstdin, this, mReplyPump.getName(), _1)); + + // Listening on stdout is stateful. In general, we're either waiting + // for the length prefix or waiting for the specified length of data. + // We address that with two different listener methods -- one of which + // is blocked at any given time. + mStdoutConnection = childout.getPump() + .listen("prefix", boost::bind(&LLLeapImpl::rstdout, this, _1)); + mStdoutDataConnection = childout.getPump() + .listen("data", boost::bind(&LLLeapImpl::rstdoutData, this, _1)); + mBlocker.reset(new LLEventPump::Blocker(mStdoutDataConnection)); + + // Log anything sent up through stderr. When a typical program + // encounters an error, it writes its error message to stderr and + // terminates with nonzero exit code. In particular, the Python + // interpreter behaves that way. More generally, though, a plugin + // author can log whatever s/he wants to the viewer log using stderr. + mStderrConnection = childerr.getPump() + .listen("LLLeap", boost::bind(&LLLeapImpl::rstderr, this, _1)); + + // Send child a preliminary event reporting our own reply-pump name -- + // which would otherwise be pretty tricky to guess! +// TODO TODO inject name of command pump here. + wstdin(mReplyPump.getName(), + LLSDMap + ("command", LLSD()) + // Include LLLeap features -- this may be important for child to + // construct (or recognize) current protocol. + ("features", LLSD::emptyMap())); + } + + // Normally we'd expect to arrive here only via done() + virtual ~LLLeapImpl() + { + LL_DEBUGS("LLLeap") << "destroying LLLeap(\"" << mDesc << "\")" << LL_ENDL; + } + + // Listener for failed launch attempt + bool bad_launch(const LLSD& data) + { + LL_WARNS("LLLeap") << data["string"].asString() << LL_ENDL; + return false; + } + + // Listener for child-process termination + bool done(const LLSD& data) + { + // Log the termination + LL_INFOS("LLLeap") << data["string"].asString() << LL_ENDL; + + // Any leftover data at this moment are because protocol was not + // satisfied. Possibly the child was interrupted in the middle of + // sending a message, possibly the child didn't flush stdout before + // terminating, possibly it's just garbage. Log its existence but + // discard it. + LLProcess::ReadPipe& childout(mChild->getReadPipe(LLProcess::STDOUT)); + if (childout.size()) + { + LLProcess::ReadPipe::size_type + peeklen((std::min)(LLProcess::ReadPipe::size_type(50), childout.size())); + LL_WARNS("LLLeap") << "Discarding final " << childout.size() << " bytes: " + << childout.peek(0, peeklen) << "..." << LL_ENDL; + } + + // Kill this instance. MUST BE LAST before return! + delete this; + return false; + } + + // Listener for events on mReplyPump: send to child stdin + bool wstdin(const std::string& pump, const LLSD& data) + { + LLSD packet(LLSDMap("pump", pump)("data", data)); + + std::ostringstream buffer; + buffer << LLSDNotationStreamer(packet); + + LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':'; + std::string::size_type truncate(80); + if (buffer.tellp() <= truncate) + { + LL_CONT << buffer.str(); + } + else + { + LL_CONT << buffer.str().substr(0, truncate) << "..."; + } + LL_CONT << LL_ENDL; + + LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN)); + childin.get_ostream() << buffer.tellp() << ':' << buffer.str() << std::flush; + return false; + } + + // Initial state of stateful listening on child stdout: wait for a length + // prefix, followed by ':'. + bool rstdout(const LLSD& data) + { + LLProcess::ReadPipe& childout(mChild->getReadPipe(LLProcess::STDOUT)); + // It's possible we got notified of a couple digit characters without + // seeing the ':' -- unlikely, but still. Until we see ':', keep + // waiting. + if (childout.contains(':')) + { + std::istream& childstream(childout.get_istream()); + // Saw ':', read length prefix and store in mExpect. + size_t expect; + childstream >> expect; + int colon(childstream.get()); + if (colon != ':') + { + // Protocol failure. Clear out the rest of the pending data in + // childout (well, up to a max length) to log what was wrong. + LLProcess::ReadPipe::size_type + readlen((std::min)(childout.size(), LLProcess::ReadPipe::size_type(80))); + std::vector buffer(readlen + 1); + childstream.read(&buffer[0], readlen); + buffer[childstream.gcount()] = '\0'; + bad_protocol(STRINGIZE(expect << char(colon) << &buffer[0])); + } + else + { + // Saw length prefix, saw colon, life is good. Now wait for + // that length of data to arrive. + mExpect = expect; + // Block calls to this method; resetting mBlocker unblocks + // calls to the other method. + mBlocker.reset(new LLEventPump::Blocker(mStdoutConnection)); + // Go check if we've already received all the advertised data. + if (childout.size()) + { + LLSD updata(data); + updata["len"] = LLSD::Integer(childout.size()); + rstdoutData(updata); + } + } + } + else if (childout.contains('\n')) + { + // Since this is the initial listening state, this is where we'd + // arrive if the child isn't following protocol at all -- say + // because the user specified 'ls' or some darn thing. + bad_protocol(childout.getline()); + } + return false; + } + + // State in which we listen on stdout for the specified length of data to + // arrive. + bool rstdoutData(const LLSD& data) + { + LLProcess::ReadPipe& childout(mChild->getReadPipe(LLProcess::STDOUT)); + // Until we've accumulated the promised length of data, keep waiting. + if (childout.size() >= mExpect) + { + // Ready to rock and roll. + LLSD data; + LLPointer parser(new LLSDNotationParser()); + S32 parse_status(parser->parse(childout.get_istream(), data, mExpect)); + if (parse_status == LLSDParser::PARSE_FAILURE) + { + bad_protocol("unparseable LLSD data"); + } + else if (! (data.isMap() && data["pump"].isString() && data.has("data"))) + { + // we got an LLSD object, but it lacks required keys + bad_protocol("missing 'pump' or 'data'"); + } + else + { + // The LLSD object we got from our stream contains the keys we + // need. + LLEventPumps::instance().obtain(data["pump"]).post(data["data"]); + // Block calls to this method; resetting mBlocker unblocks calls + // to the other method. + mBlocker.reset(new LLEventPump::Blocker(mStdoutDataConnection)); + // Go check for any more pending events in the buffer. + if (childout.size()) + { + LLSD updata(data); + data["len"] = LLSD::Integer(childout.size()); + rstdout(updata); + } + } + } + return false; + } + + void bad_protocol(const std::string& data) + { + LL_WARNS("LLLeap") << mDesc << ": invalid protocol: " << data << LL_ENDL; + // No point in continuing to run this child. + mChild->kill(); + } + + // Listen on child stderr and log everything that arrives + bool rstderr(const LLSD& data) + { + LLProcess::ReadPipe& childerr(mChild->getReadPipe(LLProcess::STDERR)); + // We might have gotten a notification involving only a partial line + // -- or multiple lines. Read all complete lines; stop when there's + // only a partial line left. + while (childerr.contains('\n')) + { + // DO NOT make calls with side effects in a logging statement! If + // that log level is suppressed, your side effects WON'T HAPPEN. + std::string line(childerr.getline()); + // Log the received line. Prefix it with the desc so we know which + // plugin it's from. This method name rstderr() is intentionally + // chosen to further qualify the log output. + LL_INFOS("LLLeap") << mDesc << ": " << line << LL_ENDL; + } + // What if child writes a final partial line to stderr? + if (data["eof"].asBoolean() && childerr.size()) + { + std::string rest(childerr.read(childerr.size())); + // Read all remaining bytes and log. + LL_INFOS("LLLeap") << mDesc << ": " << rest << LL_ENDL; + } + return false; + } + +private: + std::string mDesc; + LLEventStream mDonePump; + LLEventStream mReplyPump; + LLProcessPtr mChild; + LLTempBoundListener + mStdinConnection, mStdoutConnection, mStdoutDataConnection, mStderrConnection; + boost::scoped_ptr mBlocker; + LLProcess::ReadPipe::size_type mExpect; +}; + +// This must follow the declaration of LLLeapImpl, so it may as well be last. +LLLeap* LLLeap::create(const std::string& desc, const std::vector& plugin, bool exc) +{ + // If caller is willing to permit exceptions, just instantiate. + if (exc) + return new LLLeapImpl(desc, plugin); + + // Caller insists on suppressing LLLeap::Error. Very well, catch it. + try + { + return new LLLeapImpl(desc, plugin); + } + catch (const LLLeap::Error&) + { + return NULL; + } +} + +LLLeap* LLLeap::create(const std::string& desc, const std::string& plugin, bool exc) +{ + // Use LLStringUtil::getTokens() to parse the command line + return create(desc, + LLStringUtil::getTokens(plugin, + " \t\r\n", // drop_delims + "", // no keep_delims + "\"'", // either kind of quotes + "\\"), // backslash escape + exc); +} diff --git a/indra/llcommon/llleap.h b/indra/llcommon/llleap.h new file mode 100644 index 0000000000..1a1ad23d39 --- /dev/null +++ b/indra/llcommon/llleap.h @@ -0,0 +1,80 @@ +/** + * @file llleap.h + * @author Nat Goodspeed + * @date 2012-02-20 + * @brief Class that implements "LLSD Event API Plugin" + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLLEAP_H) +#define LL_LLLEAP_H + +#include "llinstancetracker.h" +#include +#include +#include + +/** + * LLSD Event API Plugin class. Because instances are managed by + * LLInstanceTracker, you can instantiate LLLeap and forget the instance + * unless you need it later. Each instance manages an LLProcess; when the + * child process terminates, LLLeap deletes itself. We don't require a unique + * LLInstanceTracker key. + * + * The fact that a given LLLeap instance vanishes when its child process + * terminates makes it problematic to store an LLLeap* anywhere. Any stored + * LLLeap* pointer should be validated before use by + * LLLeap::getInstance(LLLeap*) (see LLInstanceTracker). + */ +class LL_COMMON_API LLLeap: public LLInstanceTracker +{ +public: + /** + * Pass a brief string description, mostly for logging purposes. The desc + * need not be unique, but obviously the clearer we can make it, the + * easier these things will be to debug. The strings are the command line + * used to launch the desired plugin process. + * + * Pass exc=false to suppress LLLeap::Error exception. Obviously in that + * case the caller cannot discover the nature of the error, merely that an + * error of some kind occurred (because create() returned NULL). Either + * way, the error is logged. + */ + static LLLeap* create(const std::string& desc, const std::vector& plugin, + bool exc=true); + + /** + * Pass a brief string description, mostly for logging purposes. The desc + * need not be unique, but obviously the clearer we can make it, the + * easier these things will be to debug. Pass a command-line string + * to launch the desired plugin process. + * + * Pass exc=false to suppress LLLeap::Error exception. Obviously in that + * case the caller cannot discover the nature of the error, merely that an + * error of some kind occurred (because create() returned NULL). Either + * way, the error is logged. + */ + static LLLeap* create(const std::string& desc, const std::string& plugin, + bool exc=true); + + /** + * Exception thrown for invalid create() arguments, e.g. no plugin + * program. This is more resiliant than an LL_ERRS failure, because the + * string(s) passed to create() might come from an external source. This + * way the caller can catch LLLeap::Error and try to recover. + */ + struct Error: public std::runtime_error + { + Error(const std::string& what): std::runtime_error(what) {} + }; + + virtual ~LLLeap(); + +protected: + LLLeap(); +}; + +#endif /* ! defined(LL_LLLEAP_H) */ diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp new file mode 100644 index 0000000000..0264442437 --- /dev/null +++ b/indra/llcommon/tests/llleap_test.cpp @@ -0,0 +1,261 @@ +/** + * @file llleap_test.cpp + * @author Nat Goodspeed + * @date 2012-02-21 + * @brief Test for llleap. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llleap.h" +// STL headers +// std headers +// external library headers +#include +#include +#include +// other Linden headers +#include "../test/lltut.h" +#include "../test/namedtempfile.h" +#include "../test/manageapr.h" +#include "../test/catch_and_store_what_in.h" +#include "wrapllerrs.h" +#include "llevents.h" +#include "llprocess.h" +#include "stringize.h" +#include "StringVec.h" + +using boost::assign::list_of; + +static ManageAPR manager; + +StringVec sv(const StringVec& listof) { return listof; } + +#if defined(LL_WINDOWS) +#define sleep(secs) _sleep((secs) * 1000) +#endif + +void waitfor(const std::vector& instances) +{ + int i, timeout = 60; + for (i = 0; i < timeout; ++i) + { + // Every iteration, test whether any of the passed LLLeap instances + // still exist (are still running). + std::vector::const_iterator vli(instances.begin()), vlend(instances.end()); + for ( ; vli != vlend; ++vli) + { + // getInstance() returns NULL if it's terminated/gone, non-NULL if + // it's still running + if (LLLeap::getInstance(*vli)) + break; + } + // If we made it through all of 'instances' without finding one that's + // still running, we're done. + if (vli == vlend) + return; + // Found an instance that's still running. Wait and pump LLProcess. + sleep(1); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); + } + tut::ensure("timed out without terminating", i < timeout); +} + +void waitfor(LLLeap* instance) +{ + std::vector instances; + instances.push_back(instance); + waitfor(instances); +} + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct llleap_data + { + llleap_data(): + reader(".py", + // This logic is adapted from vita.viewerclient.receiveEvent() + "import sys\n" + "LEFTOVER = ''\n" + "class ProtocolError(Exception):\n" + " pass\n" + "def get():\n" + " global LEFTOVER\n" + " hdr = LEFTOVER\n" + " if ':' not in hdr:\n" + " hdr += sys.stdin.read(20)\n" + " if not hdr:\n" + " sys.exit(0)\n" + " parts = hdr.split(':', 1)\n" + " if len(parts) != 2:\n" + " raise ProtocolError('Expected len:data, got %r' % hdr)\n" + " try:\n" + " length = int(parts[0])\n" + " except ValueError:\n" + " raise ProtocolError('Non-numeric len %r' % parts[0])\n" + " del parts[0]\n" + " received = len(parts[0])\n" + " while received < length:\n" + " parts.append(sys.stdin.read(length - received))\n" + " received += len(parts[-1])\n" + " if received > length:\n" + " excess = length - received\n" + " LEFTOVER = parts[-1][excess:]\n" + " parts[-1] = parts[-1][:excess]\n" + " data = ''.join(parts)\n" + " assert len(data) == length\n" + " return data\n"), + // Get the actual pathname of the NamedExtTempFile and trim off + // the ".py" extension. (We could cache reader.getName() in a + // separate member variable, but I happen to know getName() just + // returns a NamedExtTempFile member rather than performing any + // computation, so I don't mind calling it twice.) Then take the + // basename. + reader_module(LLProcess::basename( + reader.getName().substr(0, reader.getName().length()-3))), + pPYTHON(getenv("PYTHON")), + PYTHON(pPYTHON? pPYTHON : "") + { + ensure("Set PYTHON to interpreter pathname", pPYTHON); + } + NamedExtTempFile reader; + const std::string reader_module; + const char* pPYTHON; + const std::string PYTHON; + }; + typedef test_group llleap_group; + typedef llleap_group::object object; + llleap_group llleapgrp("llleap"); + + template<> template<> + void object::test<1>() + { + set_test_name("multiple LLLeap instances"); + NamedTempFile script("py", + "import time\n" + "time.sleep(1)\n"); + std::vector instances; + instances.push_back(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + instances.push_back(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + // In this case we're simply establishing that two LLLeap instances + // can coexist without throwing exceptions or bombing in any other + // way. Wait for them to terminate. + waitfor(instances); + } + + template<> template<> + void object::test<2>() + { + set_test_name("stderr to log"); + NamedTempFile script("py", + "import sys\n" + "sys.stderr.write('''Hello from Python!\n" + "note partial line''')\n"); + CaptureLog log(LLError::LEVEL_INFO); + waitfor(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + log.messageWith("Hello from Python!"); + log.messageWith("note partial line"); + } + + template<> template<> + void object::test<3>() + { + set_test_name("empty plugin vector"); + std::string threw; + try + { + LLLeap::create("empty", StringVec()); + } + CATCH_AND_STORE_WHAT_IN(threw, LLLeap::Error) + ensure_contains("LLLeap::Error", threw, "no plugin"); + // try the suppress-exception variant + ensure("bad launch returned non-NULL", ! LLLeap::create("empty", StringVec(), false)); + } + + template<> template<> + void object::test<4>() + { + set_test_name("bad launch"); + // Synthesize bogus executable name + std::string BADPYTHON(PYTHON.substr(0, PYTHON.length()-1) + "x"); + CaptureLog log; + std::string threw; + try + { + LLLeap::create("bad exe", BADPYTHON); + } + CATCH_AND_STORE_WHAT_IN(threw, LLLeap::Error) + ensure_contains("LLLeap::create() didn't throw", threw, "failed"); + log.messageWith("failed"); + log.messageWith(BADPYTHON); + // try the suppress-exception variant + ensure("bad launch returned non-NULL", ! LLLeap::create("bad exe", BADPYTHON, false)); + } + + // Mimic a dummy little LLEventAPI that merely sends a reply back to its + // requester on the "reply" pump. + struct API + { + API(): + mPump("API", true) + { + mPump.listen("API", boost::bind(&API::entry, this, _1)); + } + + bool entry(const LLSD& request) + { + LLEventPumps::instance().obtain(request["reply"]).post("ack"); + return false; + } + + LLEventStream mPump; + }; + + template<> template<> + void object::test<5>() + { + set_test_name("round trip"); + API api; + NamedTempFile script("py", + boost::lambda::_1 << + "import re\n" + "import sys\n" + "from " << reader_module << " import get\n" + // this will throw if the initial write to stdin + // doesn't follow len:data protocol + "initial = get()\n" + "match = re.search(r\"'pump':'(.*?)'\", initial)\n" + // this will throw if we couldn't find + // 'pump':'etc.' in the initial write + "reply = match.group(1)\n" + "req = '''\\\n" + "{'pump':'" << api.mPump.getName() << "','data':{'reply':'%s'}}\\\n" + "''' % reply\n" + // make a request on our little API + "sys.stdout.write(':'.join((str(len(req)), req)))\n" + "sys.stdout.flush()\n" + // wait for its response + "resp = get()\n" + // it would be cleverer to be order-insensitive + // about 'data' and 'pump'; hopefully the C++ + // serializer doesn't change its rules soon + "result = 'good' if (resp == \"{'data':'ack','pump':'%s'}\" % reply)\\\n" + " else 'bad: ' + resp\n" + // write 'good' or 'bad' to the log so we can observe + "sys.stderr.write(result)\n"); + CaptureLog log(LLError::LEVEL_INFO); + waitfor(LLLeap::create(get_test_name(), sv(list_of(PYTHON)(script.getName())))); + log.messageWith("good"); + } +} // namespace tut -- cgit v1.2.3 From cfe37cbfb5bdec0aa01c86a608ecc6cdc3df8a2a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 22:45:16 -0500 Subject: Break out std::ostream << CaptureLog routine for general use. --- indra/llcommon/tests/wrapllerrs.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index 10cf25b39e..a9c0c19c28 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -31,11 +31,11 @@ #include #include "llerrorcontrol.h" +#include "stringize.h" #include #include #include #include -#include // statically reference the function in test.cpp... it's short, we could // replicate, but better to reuse @@ -131,14 +131,9 @@ public: if (! required) return std::string(); - std::ostringstream out; - out << "failed to find '" << search << "' in captured log messages:"; - for (MessageList::const_iterator mi(mMessages.begin()), mend(mMessages.end()); - mi != mend; ++mi) - { - out << '\n' << *mi; - } - throw tut::failure(out.str()); + throw tut::failure(STRINGIZE("failed to find '" << search + << "' in captured log messages:\n" + << *this)); } typedef std::list MessageList; @@ -146,4 +141,20 @@ public: LLError::Settings* mOldSettings; }; +std::ostream& operator<<(std::ostream& out, const CaptureLog& log) +{ + CaptureLog::MessageList::const_iterator mi(log.mMessages.begin()), mend(log.mMessages.end()); + if (mi != mend) + { + // handle first message separately: it doesn't get a newline + out << *mi++; + for ( ; mi != mend; ++mi) + { + // every subsequent message gets a newline + out << '\n' << *mi; + } + } + return out; +} + #endif /* ! defined(LL_WRAPLLERRS_H) */ -- cgit v1.2.3 From 9b5fcb78e7692c82328bd4ff6d178b68b4b47636 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Mar 2012 23:01:37 -0500 Subject: Refactor llleap_test.cpp to streamline adding more unit tests. Migrate logic from specific test to common reader module, notably parsing the wakeup message containing the reply-pump name. Make test script post to Result struct to communicate success/failure to C++ TUT test, rather than just writing to log. Make test script insensitive to key order in serialized LLSD::Map. --- indra/llcommon/tests/llleap_test.cpp | 118 ++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 31 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 0264442437..0ca8c9b684 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -83,6 +83,7 @@ namespace tut llleap_data(): reader(".py", // This logic is adapted from vita.viewerclient.receiveEvent() + "import re\n" "import sys\n" "LEFTOVER = ''\n" "class ProtocolError(Exception):\n" @@ -112,7 +113,29 @@ namespace tut " parts[-1] = parts[-1][:excess]\n" " data = ''.join(parts)\n" " assert len(data) == length\n" - " return data\n"), + " return data\n" + "\n" + "def put(req):\n" + " sys.stdout.write(':'.join((str(len(req)), req)))\n" + " sys.stdout.flush()\n" + "\n" + "# deal with initial stdin message\n" + // this will throw if the initial write to stdin + // doesn't follow len:data protocol + "_initial = get()\n" + "_match = re.search(r\"'pump':'(.*?)'\", _initial)\n" + // this will throw if we couldn't find + // 'pump':'etc.' in the initial write + "_reply = _match.group(1)\n" + "\n" + "def replypump():\n" + " return _reply\n" + "\n" + "def escape(str):\n" + " return ''.join(('\\\\'+c if c in r\"\\'\" else c) for c in str)\n" + "\n" + "def quote(str):\n" + " return \"'%s'\" % escape(str)\n"), // Get the actual pathname of the NamedExtTempFile and trim off // the ".py" extension. (We could cache reader.getName() in a // separate member variable, but I happen to know getName() just @@ -203,23 +226,64 @@ namespace tut ensure("bad launch returned non-NULL", ! LLLeap::create("bad exe", BADPYTHON, false)); } + // Generic self-contained listener: derive from this and override its + // call() method, then tell somebody to post on the pump named getName(). + // Control will reach your call() override. + struct ListenerBase + { + // Pass the pump name you want; will tweak for uniqueness. + ListenerBase(const std::string& name): + mPump(name, true) + { + mPump.listen(name, boost::bind(&ListenerBase::call, this, _1)); + } + + virtual bool call(const LLSD& request) + { + return false; + } + + LLEventPump& getPump() { return mPump; } + const LLEventPump& getPump() const { return mPump; } + + std::string getName() const { return mPump.getName(); } + void post(const LLSD& data) { mPump.post(data); } + + LLEventStream mPump; + }; + // Mimic a dummy little LLEventAPI that merely sends a reply back to its // requester on the "reply" pump. - struct API + struct API: public ListenerBase { - API(): - mPump("API", true) + API(): ListenerBase("API") {} + + virtual bool call(const LLSD& request) { - mPump.listen("API", boost::bind(&API::entry, this, _1)); + LLEventPumps::instance().obtain(request["reply"]).post("ack"); + return false; } + }; + + // Give LLLeap script a way to post success/failure. + struct Result: public ListenerBase + { + Result(): ListenerBase("Result") {} - bool entry(const LLSD& request) + virtual bool call(const LLSD& request) { - LLEventPumps::instance().obtain(request["reply"]).post("ack"); + mData = request; return false; } - LLEventStream mPump; + void ensure() const + { + tut::ensure(std::string("never posted to ") + getName(), mData.isDefined()); + // Post an empty string for success, non-empty string is failure message. + tut::ensure(mData, mData.asString().empty()); + } + + LLSD mData; }; template<> template<> @@ -227,35 +291,27 @@ namespace tut { set_test_name("round trip"); API api; + Result result; NamedTempFile script("py", boost::lambda::_1 << - "import re\n" "import sys\n" - "from " << reader_module << " import get\n" - // this will throw if the initial write to stdin - // doesn't follow len:data protocol - "initial = get()\n" - "match = re.search(r\"'pump':'(.*?)'\", initial)\n" - // this will throw if we couldn't find - // 'pump':'etc.' in the initial write - "reply = match.group(1)\n" - "req = '''\\\n" - "{'pump':'" << api.mPump.getName() << "','data':{'reply':'%s'}}\\\n" - "''' % reply\n" + "from " << reader_module << " import *\n" // make a request on our little API - "sys.stdout.write(':'.join((str(len(req)), req)))\n" - "sys.stdout.flush()\n" + "put(\"{'pump':'" << api.getName() << "','data':{'reply':'%s'}}\" %\n" + " replypump())\n" // wait for its response "resp = get()\n" - // it would be cleverer to be order-insensitive - // about 'data' and 'pump'; hopefully the C++ - // serializer doesn't change its rules soon - "result = 'good' if (resp == \"{'data':'ack','pump':'%s'}\" % reply)\\\n" - " else 'bad: ' + resp\n" - // write 'good' or 'bad' to the log so we can observe - "sys.stderr.write(result)\n"); - CaptureLog log(LLError::LEVEL_INFO); + // We expect "{'data':'ack','pump':'%s'}", but + // don't depend on the order of the keys. + "result = 'bad: ' + resp\n" + "if resp.startswith('{') and resp.endswith('}'):\n" + " expect = set((\"'data':'ack'\", \"'pump':'%s'\" % replypump()))\n" + " actual = set(resp[1:-1].split(','))\n" + " if actual == expect:\n" + " result = ''\n" + "put(\"{'pump':'" << result.getName() << "','data':%s}\" %\n" + " quote(result))\n"); waitfor(LLLeap::create(get_test_name(), sv(list_of(PYTHON)(script.getName())))); - log.messageWith("good"); + result.ensure(); } } // namespace tut -- cgit v1.2.3 From d16ce6bf0422f46e3a2d9966cd4210f4f4e35a83 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 09:47:27 -0500 Subject: Drag in Python llsd module, which greatly simplifies tests. It only took a few examples of trying to wrangle notation LLSD as string data to illustrate how clumsy that is. I'd forgotten that a couple other TUT tests already invoke Python code that depends on the llsd module. The trick is to recognize that at least as of now, there's still an obsolete version of the module in the viewer's own source tree. Python code is careful to try importing llbase.llsd before indra.base.llsd, so that if/when we finally do clear indra/lib/python from the viewer repo, we need only require that llbase be installed on every build machine. --- indra/llcommon/tests/llleap_test.cpp | 67 ++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 0ca8c9b684..bef3bf1543 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -83,8 +83,21 @@ namespace tut llleap_data(): reader(".py", // This logic is adapted from vita.viewerclient.receiveEvent() - "import re\n" + boost::lambda::_1 << + "import os\n" "import sys\n" + // Don't forget that this Python script is written to some + // temp directory somewhere! Its __file__ is useless in + // finding indra/lib/python. Use our __FILE__, with + // raw-string syntax to deal with Windows pathnames. + "mydir = os.path.dirname(r'" << __FILE__ << "')\n" + "try:\n" + " from llbase import llsd\n" + "except ImportError:\n" + // We expect mydir to be .../indra/llcommon/tests. + " sys.path.insert(0,\n" + " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" + " from indra.base import llsd\n" "LEFTOVER = ''\n" "class ProtocolError(Exception):\n" " pass\n" @@ -113,29 +126,28 @@ namespace tut " parts[-1] = parts[-1][:excess]\n" " data = ''.join(parts)\n" " assert len(data) == length\n" - " return data\n" - "\n" - "def put(req):\n" - " sys.stdout.write(':'.join((str(len(req)), req)))\n" - " sys.stdout.flush()\n" + " return llsd.parse(data)\n" "\n" "# deal with initial stdin message\n" - // this will throw if the initial write to stdin - // doesn't follow len:data protocol - "_initial = get()\n" - "_match = re.search(r\"'pump':'(.*?)'\", _initial)\n" - // this will throw if we couldn't find - // 'pump':'etc.' in the initial write - "_reply = _match.group(1)\n" + // this will throw if the initial write to stdin doesn't + // follow len:data protocol, or if we couldn't find 'pump' + // in the dict + "_reply = get()['pump']\n" "\n" "def replypump():\n" " return _reply\n" "\n" - "def escape(str):\n" - " return ''.join(('\\\\'+c if c in r\"\\'\" else c) for c in str)\n" + "def put(req):\n" + " sys.stdout.write(':'.join((str(len(req)), req)))\n" + " sys.stdout.flush()\n" + "\n" + "def send(pump, data):\n" + " put(llsd.format_notation(dict(pump=pump, data=data)))\n" "\n" - "def quote(str):\n" - " return \"'%s'\" % escape(str)\n"), + "def request(pump, data):\n" + " # we expect 'data' is a dict\n" + " data['reply'] = _reply\n" + " send(pump, data)\n"), // Get the actual pathname of the NamedExtTempFile and trim off // the ".py" extension. (We could cache reader.getName() in a // separate member variable, but I happen to know getName() just @@ -297,21 +309,18 @@ namespace tut "import sys\n" "from " << reader_module << " import *\n" // make a request on our little API - "put(\"{'pump':'" << api.getName() << "','data':{'reply':'%s'}}\" %\n" - " replypump())\n" + "request(pump='" << api.getName() << "', data={})\n" // wait for its response "resp = get()\n" - // We expect "{'data':'ack','pump':'%s'}", but - // don't depend on the order of the keys. - "result = 'bad: ' + resp\n" - "if resp.startswith('{') and resp.endswith('}'):\n" - " expect = set((\"'data':'ack'\", \"'pump':'%s'\" % replypump()))\n" - " actual = set(resp[1:-1].split(','))\n" - " if actual == expect:\n" - " result = ''\n" - "put(\"{'pump':'" << result.getName() << "','data':%s}\" %\n" - " quote(result))\n"); + "result = '' if resp == dict(pump=replypump(), data='ack')\\\n" + " else 'bad: ' + str(resp)\n" + "send(pump='" << result.getName() << "', data=result)\n"); waitfor(LLLeap::create(get_test_name(), sv(list_of(PYTHON)(script.getName())))); result.ensure(); } + + // TODO: + // many many small messages buffered in both directions + // very large message in both directions (md5) + } // namespace tut -- cgit v1.2.3 From 260883c11f051853876d34bf1c9448d0063f9f5a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 10:40:15 -0500 Subject: Clarify LLProcess debug log message about reading from child pipe. Previous "read N of M bytes" wording implied that the child had M bytes to send, but we only read N of them. In reality we have no idea how many bytes the child is trying to send, only how many the OS is willing to deliver at this moment. To me, "filled N of M bytes" more clearly implies that M is the buffer size. --- indra/llcommon/llprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 9c49517598..ad8e3a930e 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -367,7 +367,7 @@ public: // received. Make sure we commit those later. (Don't commit them // now, that would invalidate the buffer iterator sequence!) tocommit += gotten; - LL_DEBUGS("LLProcess") << "read " << gotten << " of " << toread + LL_DEBUGS("LLProcess") << "filled " << gotten << " of " << toread << " bytes from " << mDesc << LL_ENDL; // The parent end of this pipe is nonblocking. If we weren't even -- cgit v1.2.3 From c6c7cabd1daad23898edc9f352349a028888f8ee Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 12:00:38 -0500 Subject: Add "load test" LLLeap unit tests: many small messages, one large. These tests rule out corruption as we cross buffer boundaries in OS pipes and the LLLeap implementation itself. --- indra/llcommon/tests/llleap_test.cpp | 120 ++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 10 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index bef3bf1543..652a95ac6b 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -40,9 +40,11 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -void waitfor(const std::vector& instances) +const size_t BUFFERED_LENGTH = 1024*1024; // try wrangling a megabyte of data + +void waitfor(const std::vector& instances, int timeout=60) { - int i, timeout = 60; + int i; for (i = 0; i < timeout; ++i) { // Every iteration, test whether any of the passed LLLeap instances @@ -66,11 +68,11 @@ void waitfor(const std::vector& instances) tut::ensure("timed out without terminating", i < timeout); } -void waitfor(LLLeap* instance) +void waitfor(LLLeap* instance, int timeout=60) { std::vector instances; instances.push_back(instance); - waitfor(instances); + waitfor(instances, timeout); } /***************************************************************************** @@ -266,9 +268,9 @@ namespace tut // Mimic a dummy little LLEventAPI that merely sends a reply back to its // requester on the "reply" pump. - struct API: public ListenerBase + struct AckAPI: public ListenerBase { - API(): ListenerBase("API") {} + AckAPI(): ListenerBase("AckAPI") {} virtual bool call(const LLSD& request) { @@ -302,11 +304,10 @@ namespace tut void object::test<5>() { set_test_name("round trip"); - API api; + AckAPI api; Result result; NamedTempFile script("py", boost::lambda::_1 << - "import sys\n" "from " << reader_module << " import *\n" // make a request on our little API "request(pump='" << api.getName() << "', data={})\n" @@ -319,8 +320,107 @@ namespace tut result.ensure(); } + struct ReqIDAPI: public ListenerBase + { + ReqIDAPI(): ListenerBase("ReqIDAPI") {} + + virtual bool call(const LLSD& request) + { + // free function from llevents.h + sendReply(LLSD(), request); + return false; + } + }; + + template<> template<> + void object::test<6>() + { + set_test_name("many small messages"); + // It's not clear to me whether there's value in iterating many times + // over a send/receive loop -- I don't think that will exercise any + // interesting corner cases. This test first sends a large number of + // messages, then receives all the responses. The intent is to ensure + // that some of that data stream crosses buffer boundaries, loop + // iterations etc. in OS pipes and the LLLeap/LLProcess implementation. + ReqIDAPI api; + Result result; + NamedTempFile script("py", + boost::lambda::_1 << + "import sys\n" + "from " << reader_module << " import *\n" + // Note that since reader imports llsd, this + // 'import *' gets us llsd too. + "sample = llsd.format_notation(dict(pump='" << + api.getName() << "', data=dict(reqid=999999, reply=replypump())))\n" + // The whole packet has length prefix too: "len:data" + "samplen = len(str(len(sample))) + 1 + len(sample)\n" + // guess how many messages it will take to + // accumulate BUFFERED_LENGTH + "count = int(" << BUFFERED_LENGTH << "/samplen)\n" + "print >>sys.stderr, 'Sending %s requests' % count\n" + "for i in xrange(count):\n" + " request('" << api.getName() << "', dict(reqid=i))\n" + // The assumption in this specific test that + // replies will arrive in the same order as + // requests is ONLY valid because the API we're + // invoking sends replies instantly. If the API + // had to wait for some external event before + // sending its reply, replies could arrive in + // arbitrary order, and we'd have to tick them + // off from a set. + "result = ''\n" + "for i in xrange(count):\n" + " resp = get()\n" + " if resp['data']['reqid'] != i:\n" + " result = 'expected reqid=%s in %s' % (i, resp)\n" + " break\n" + "send(pump='" << result.getName() << "', data=result)\n"); + waitfor(LLLeap::create(get_test_name(), sv(list_of(PYTHON)(script.getName()))), + 300); // needs more realtime than most tests + result.ensure(); + } + + template<> template<> + void object::test<7>() + { + set_test_name("very large message"); + ReqIDAPI api; + Result result; + NamedTempFile script("py", + boost::lambda::_1 << + "import sys\n" + "from " << reader_module << " import *\n" + // Generate a very large string value. + "desired = int(sys.argv[1])\n" + // 7 chars per item: 6 digits, 1 comma + "count = int((desired - 50)/7)\n" + "large = ''.join('%06d,' % i for i in xrange(count))\n" + // Pass 'large' as reqid because we know the API + // will echo reqid, and we want to receive it back. + "request('" << api.getName() << "', dict(reqid=large))\n" + "resp = get()\n" + "echoed = resp['data']['reqid']\n" + "if echoed == large:\n" + " send('" << result.getName() << "', '')\n" + " sys.exit(0)\n" + // Here we know echoed did NOT match; try to find where + "for i in xrange(count):\n" + " start = 7*i\n" + " end = 7*(i+1)\n" + " if end > len(echoed)\\\n" + " or echoed[start:end] != large[start:end]:\n" + " send('" << result.getName() << "',\n" + " 'at offset %s, expected %r but got %r' %\n" + " (start, large[start:end], echoed[start:end]))\n" + "sys.exit(1)\n"); + waitfor(LLLeap::create(get_test_name(), + sv(list_of + (PYTHON) + (script.getName()) + (stringize(BUFFERED_LENGTH))))); + result.ensure(); + } + // TODO: - // many many small messages buffered in both directions - // very large message in both directions (md5) } // namespace tut -- cgit v1.2.3 From d09d4e1a7e64b01fa1d9f3015de819a2e7069ac4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 13:43:13 -0500 Subject: Add LLLeap unit tests for strange data on child stdout. --- indra/llcommon/tests/llleap_test.cpp | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 652a95ac6b..053a6cea80 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -207,6 +207,34 @@ namespace tut template<> template<> void object::test<3>() + { + set_test_name("bad stdout protocol"); + NamedTempFile script("py", + "print 'Hello from Python!'\n"); + CaptureLog log(LLError::LEVEL_WARN); + waitfor(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + ensure_contains("error log line", + log.messageWith("invalid protocol"), "Hello from Python!"); + } + + template<> template<> + void object::test<4>() + { + set_test_name("leftover stdout"); + NamedTempFile script("py", + "import sys\n" + // note lack of newline + "sys.stdout.write('Hello from Python!')\n"); + CaptureLog log(LLError::LEVEL_WARN); + waitfor(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + ensure_contains("error log line", + log.messageWith("Discarding"), "Hello from Python!"); + } + + template<> template<> + void object::test<5>() { set_test_name("empty plugin vector"); std::string threw; @@ -221,7 +249,7 @@ namespace tut } template<> template<> - void object::test<4>() + void object::test<6>() { set_test_name("bad launch"); // Synthesize bogus executable name @@ -301,7 +329,7 @@ namespace tut }; template<> template<> - void object::test<5>() + void object::test<7>() { set_test_name("round trip"); AckAPI api; @@ -333,7 +361,7 @@ namespace tut }; template<> template<> - void object::test<6>() + void object::test<8>() { set_test_name("many small messages"); // It's not clear to me whether there's value in iterating many times @@ -381,7 +409,7 @@ namespace tut } template<> template<> - void object::test<7>() + void object::test<9>() { set_test_name("very large message"); ReqIDAPI api; -- cgit v1.2.3 From e8f463ef7a9cddda3813d20935957708d3b4aa3b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 14:54:24 -0500 Subject: Use LLProcess::ReadPipe::read() in LLLeap. The code was using LLProcess::ReadPipe::get_istream().read(), but that's much uglier, as it requires constructing a char* buffer etc. etc. --- indra/llcommon/llleap.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index dddf1286ac..beb7fa8333 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -230,10 +230,7 @@ public: // childout (well, up to a max length) to log what was wrong. LLProcess::ReadPipe::size_type readlen((std::min)(childout.size(), LLProcess::ReadPipe::size_type(80))); - std::vector buffer(readlen + 1); - childstream.read(&buffer[0], readlen); - buffer[childstream.gcount()] = '\0'; - bad_protocol(STRINGIZE(expect << char(colon) << &buffer[0])); + bad_protocol(STRINGIZE(expect << char(colon) << childout.read(readlen))); } else { -- cgit v1.2.3 From 674f9fb111919f9dffaddf8c0732267f6dbfdf2a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Mar 2012 14:56:00 -0500 Subject: Add LLLeap unit test for invalid length prefix from child stdout. --- indra/llcommon/tests/llleap_test.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 053a6cea80..328b9c3562 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -235,6 +235,20 @@ namespace tut template<> template<> void object::test<5>() + { + set_test_name("bad stdout len prefix"); + NamedTempFile script("py", + "import sys\n" + "sys.stdout.write('5a2:something')\n"); + CaptureLog log(LLError::LEVEL_WARN); + waitfor(LLLeap::create(get_test_name(), + sv(list_of(PYTHON)(script.getName())))); + ensure_contains("error log line", + log.messageWith("invalid protocol"), "5a2:"); + } + + template<> template<> + void object::test<6>() { set_test_name("empty plugin vector"); std::string threw; @@ -249,7 +263,7 @@ namespace tut } template<> template<> - void object::test<6>() + void object::test<7>() { set_test_name("bad launch"); // Synthesize bogus executable name @@ -329,7 +343,7 @@ namespace tut }; template<> template<> - void object::test<7>() + void object::test<8>() { set_test_name("round trip"); AckAPI api; @@ -361,7 +375,7 @@ namespace tut }; template<> template<> - void object::test<8>() + void object::test<9>() { set_test_name("many small messages"); // It's not clear to me whether there's value in iterating many times @@ -409,7 +423,7 @@ namespace tut } template<> template<> - void object::test<9>() + void object::test<10>() { set_test_name("very large message"); ReqIDAPI api; -- cgit v1.2.3 From e7d129875a4ccdc09f921e08fea1dccbb025b705 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 3 Mar 2012 06:28:47 -0500 Subject: Add a couple LLLeap DEBUG messages for incoming-events control flow. --- indra/llcommon/llleap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index beb7fa8333..34f77c3f3a 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -237,6 +237,8 @@ public: // Saw length prefix, saw colon, life is good. Now wait for // that length of data to arrive. mExpect = expect; + LL_DEBUGS("LLLeap") << "got length, waiting for " + << mExpect << " bytes of data" << LL_ENDL; // Block calls to this method; resetting mBlocker unblocks // calls to the other method. mBlocker.reset(new LLEventPump::Blocker(mStdoutConnection)); @@ -268,6 +270,8 @@ public: if (childout.size() >= mExpect) { // Ready to rock and roll. + LL_DEBUGS("LLLeap") << "needed " << mExpect << " bytes, got " + << childout.size() << ", parsing LLSD" << LL_ENDL; LLSD data; LLPointer parser(new LLSDNotationParser()); S32 parse_status(parser->parse(childout.get_istream(), data, mExpect)); -- cgit v1.2.3 From d72d9f73b6ff93f11e9bc4360d4c7bf2e76d1eec Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 3 Mar 2012 06:37:05 -0500 Subject: Add debugging output in case LLLeap writes corrupt data to plugin. New llleap_test.cpp load testing turned up Windows issue in which plugin process received corrupt packet, producing LLSDParseError. Add code to dump the bad packet in that case -- but if LLSDParseError is willing to state the offset of the problem, not ALL of the packet. Quiet MSVC warning about little internal base class needing virtual destructor. --- indra/llcommon/tests/llleap_test.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 328b9c3562..4fb80df788 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -86,6 +86,7 @@ namespace tut reader(".py", // This logic is adapted from vita.viewerclient.receiveEvent() boost::lambda::_1 << + "import re\n" "import os\n" "import sys\n" // Don't forget that this Python script is written to some @@ -128,7 +129,33 @@ namespace tut " parts[-1] = parts[-1][:excess]\n" " data = ''.join(parts)\n" " assert len(data) == length\n" - " return llsd.parse(data)\n" + " try:\n" + " return llsd.parse(data)\n" + " except llsd.LLSDParseError, e:\n" + " print >>sys.stderr, 'Bad received packet (%s), %s bytes:' % \\\n" + " (e, len(data))\n" + " showmax = 40\n" + // We've observed failures with very large packets; + // dumping the entire packet wastes time and space. + // But if the error states a particular byte offset, + // truncate to (near) that offset when dumping data. + " location = re.search(r' at byte ([0-9]+)', str(e))\n" + " if not location:\n" + " # didn't find offset, dump whole thing, no ellipsis\n" + " ellipsis = ''\n" + " else:\n" + " # found offset within error message\n" + " trunc = int(location.group(1)) + showmax\n" + " data = data[:trunc]\n" + " ellipsis = '... (%s more)' % (length - trunc)\n" + " offset = -showmax\n" + " for offset in xrange(0, len(data)-showmax, showmax):\n" + " print >>sys.stderr, '%04d: %r +' % \\\n" + " (offset, data[offset:offset+showmax])\n" + " offset += showmax\n" + " print >>sys.stderr, '%04d: %r%s' % \\\n" + " (offset, data[offset:], ellipsis)\n" + " raise\n" "\n" "# deal with initial stdin message\n" // this will throw if the initial write to stdin doesn't @@ -294,6 +321,8 @@ namespace tut mPump.listen(name, boost::bind(&ListenerBase::call, this, _1)); } + virtual ~ListenerBase() {} // pacify MSVC + virtual bool call(const LLSD& request) { return false; -- cgit v1.2.3 From 75f412549242c949851938ffeac65b9e7145de5e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 3 Mar 2012 06:45:19 -0500 Subject: Break large buffer into chunks to write to LLProcess child pipe. On Windows we ran into trouble trying to write a biggish (~1 MB) buffer of data to the child process's stdin pipe with a single apr_file_write() call. The child actually received corrupted data -- suggesting a possible bug in either APR or Windows pipes; the same test driving the same logic worked fine on Mac and Linux. Empirically, iterating over chunks of the buffered data is more robust. --- indra/llcommon/llprocess.cpp | 74 ++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index ad8e3a930e..d926791e9e 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -168,38 +168,58 @@ public: const_buffer_sequence bufs = mStreambuf.data(); // In general, our streambuf might contain a number of different // physical buffers; iterate over those. + bool keepwriting = true; for (const_buffer_sequence::const_iterator bufi(bufs.begin()), bufend(bufs.end()); - bufi != bufend; ++bufi) + bufi != bufend && keepwriting; ++bufi) { // http://www.boost.org/doc/libs/1_49_0_beta1/doc/html/boost_asio/reference/buffer.html#boost_asio.reference.buffer.accessing_buffer_contents - std::size_t towrite(boost::asio::buffer_size(*bufi)); - apr_size_t written(towrite); - apr_status_t err = apr_file_write(mPipe, - boost::asio::buffer_cast(*bufi), - &written); - // EAGAIN is exactly what we want from a nonblocking pipe. - // Rather than waiting for data, it should return immediately. - if (! (err == APR_SUCCESS || APR_STATUS_IS_EAGAIN(err))) + // Although apr_file_write() accepts const void*, we + // manipulate const char* so we can increment the pointer. + const char* remainptr = boost::asio::buffer_cast(*bufi); + std::size_t remainlen = boost::asio::buffer_size(*bufi); + while (remainlen) { - LL_WARNS("LLProcess") << "apr_file_write(" << towrite << ") on " << mDesc - << " got " << err << ":" << LL_ENDL; - ll_apr_warn_status(err); - } + // Tackle the current buffer in discrete chunks. On + // Windows, we've observed strange failures when trying to + // write big lengths (~1 MB) in a single operation. + std::size_t towrite((std::min)(remainlen, std::size_t(32*1024))); + apr_size_t written(towrite); + apr_status_t err = apr_file_write(mPipe, remainptr, &written); + // EAGAIN is exactly what we want from a nonblocking pipe. + // Rather than waiting for data, it should return immediately. + if (! (err == APR_SUCCESS || APR_STATUS_IS_EAGAIN(err))) + { + LL_WARNS("LLProcess") << "apr_file_write(" << towrite << ") on " << mDesc + << " got " << err << ":" << LL_ENDL; + ll_apr_warn_status(err); + } - // 'written' is modified to reflect the number of bytes actually - // written. Make sure we consume those later. (Don't consume them - // now, that would invalidate the buffer iterator sequence!) - consumed += written; - LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite - << " bytes to " << mDesc - << " (original " << total << ")" << LL_ENDL; - - // The parent end of this pipe is nonblocking. If we weren't able - // to write everything we wanted, don't keep banging on it -- that - // won't change until the child reads some. Wait for next tick(). - if (written < towrite) - break; - } + // 'written' is modified to reflect the number of bytes actually + // written. Make sure we consume those later. (Don't consume them + // now, that would invalidate the buffer iterator sequence!) + consumed += written; + // don't forget to advance to next chunk of current buffer + remainptr += written; + remainlen -= written; + + char msgbuf[512]; + LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite + << " bytes to " << mDesc + << " (original " << total << ")," + << " code " << err << ": " + << apr_strerror(err, msgbuf, sizeof(msgbuf)) + << LL_ENDL; + + // The parent end of this pipe is nonblocking. If we weren't able + // to write everything we wanted, don't keep banging on it -- that + // won't change until the child reads some. Wait for next tick(). + if (written < towrite) + { + keepwriting = false; // break outer loop over buffers too + break; + } + } // next chunk of current buffer + } // next buffer // In all, we managed to write 'consumed' bytes. Remove them from the // streambuf so we don't keep trying to send them. This could be // anywhere from 0 up to mStreambuf.size(); anything we haven't yet -- cgit v1.2.3 From ca703b2b9cd9469ad86539f2b95dbf1162b786f2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 4 Mar 2012 16:59:48 -0500 Subject: Make llleap_test.cpp avoid hard limit on MSVC std::ostringstream max. In load testing, we have observed intermittent failures on Windows in which LLSDNotationStreamer into std::ostringstream seems to bump into a hard limit of 1048590 bytes. ostringstream reports that much buffered data and returns that much -- even though, on examination, the notation-serialized stream is incomplete at that point. It's our intention to load-test LLLeap and LLProcess, not the local iostream implementation; we hope that this kind of data volume is comfortably greater than actual usage. Back off the load-testing max size a bit. --- indra/llcommon/tests/llleap_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 4fb80df788..677f4830ea 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -40,7 +40,7 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -const size_t BUFFERED_LENGTH = 1024*1024; // try wrangling a megabyte of data +const size_t BUFFERED_LENGTH = 1024*1023; // try wrangling just under a megabyte of data void waitfor(const std::vector& instances, int timeout=60) { @@ -139,13 +139,13 @@ namespace tut // dumping the entire packet wastes time and space. // But if the error states a particular byte offset, // truncate to (near) that offset when dumping data. - " location = re.search(r' at byte ([0-9]+)', str(e))\n" + " location = re.search(r' at (byte|index) ([0-9]+)', str(e))\n" " if not location:\n" " # didn't find offset, dump whole thing, no ellipsis\n" " ellipsis = ''\n" " else:\n" " # found offset within error message\n" - " trunc = int(location.group(1)) + showmax\n" + " trunc = int(location.group(2)) + showmax\n" " data = data[:trunc]\n" " ellipsis = '... (%s more)' % (length - trunc)\n" " offset = -showmax\n" -- cgit v1.2.3 From 30e8e23d7cf666c406901d85a59d16401dca67ab Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 4 Mar 2012 21:27:42 -0500 Subject: Simplify llleap_test.cpp plugin by reading individual characters. While we're accumulating the 'length:' prefix, the present socket-based logic reads 20 characters, then reads 'length' more, then discards any excess (in case the whole 'length:data' packet ends up being less than 20 characters). That's probably a bug: whatever characters follow that packet, however short it may be, are probably the 'length:' prefix of the next packet. We probably only get away with it because we probably never send packets that short. Earlier llleap_test.cpp plugin logic still read 20 characters, then, if there were any left after the present packet, cached them as the start of the next packet. This is probably more correct, but complicated. Easier just to read individual characters until we've seen 'length:', then try for exactly the specified length over however many reads that requires. --- indra/llcommon/tests/llleap_test.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 677f4830ea..73d7217608 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -101,32 +101,25 @@ namespace tut " sys.path.insert(0,\n" " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" " from indra.base import llsd\n" - "LEFTOVER = ''\n" "class ProtocolError(Exception):\n" " pass\n" "def get():\n" - " global LEFTOVER\n" - " hdr = LEFTOVER\n" - " if ':' not in hdr:\n" - " hdr += sys.stdin.read(20)\n" + " hdr = ''\n" + " while ':' not in hdr and len(hdr) < 20:\n" + " hdr += sys.stdin.read(1)\n" " if not hdr:\n" " sys.exit(0)\n" - " parts = hdr.split(':', 1)\n" - " if len(parts) != 2:\n" + " if not hdr.endswith(':'):\n" " raise ProtocolError('Expected len:data, got %r' % hdr)\n" " try:\n" - " length = int(parts[0])\n" + " length = int(hdr[:-1])\n" " except ValueError:\n" - " raise ProtocolError('Non-numeric len %r' % parts[0])\n" - " del parts[0]\n" - " received = len(parts[0])\n" + " raise ProtocolError('Non-numeric len %r' % hdr[:-1])\n" + " parts = []\n" + " received = 0\n" " while received < length:\n" " parts.append(sys.stdin.read(length - received))\n" " received += len(parts[-1])\n" - " if received > length:\n" - " excess = length - received\n" - " LEFTOVER = parts[-1][excess:]\n" - " parts[-1] = parts[-1][:excess]\n" " data = ''.join(parts)\n" " assert len(data) == length\n" " try:\n" -- cgit v1.2.3 From b3b51f012f49d82c3b7f6f5cadfc0d76ef82f8bf Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 13:03:23 -0500 Subject: Move std::ostream << CaptureLog logic into CaptureLog::streamto(). That lets us reliably declare the operator<<() free function inline, which permits multiple translation units in the same executable to #include "wrapllerrs.h". --- indra/llcommon/tests/wrapllerrs.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index a9c0c19c28..f79acacb22 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -136,25 +136,31 @@ public: << *this)); } + std::ostream& streamto(std::ostream& out) const + { + MessageList::const_iterator mi(mMessages.begin()), mend(mMessages.end()); + if (mi != mend) + { + // handle first message separately: it doesn't get a newline + out << *mi++; + for ( ; mi != mend; ++mi) + { + // every subsequent message gets a newline + out << '\n' << *mi; + } + } + return out; + } + typedef std::list MessageList; MessageList mMessages; LLError::Settings* mOldSettings; }; +inline std::ostream& operator<<(std::ostream& out, const CaptureLog& log) { - CaptureLog::MessageList::const_iterator mi(log.mMessages.begin()), mend(log.mMessages.end()); - if (mi != mend) - { - // handle first message separately: it doesn't get a newline - out << *mi++; - for ( ; mi != mend; ++mi) - { - // every subsequent message gets a newline - out << '\n' << *mi; - } - } - return out; + return log.streamto(out); } #endif /* ! defined(LL_WRAPLLERRS_H) */ -- cgit v1.2.3 From f02ded46fe6f166a07673d97301bf169eb0b9ba8 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 13:07:14 -0500 Subject: Make test.cpp support LOGFAIL env var: only failed tests show log. Set LOGFAIL= one of ALL, DEBUG, INFO, WARN, ERROR, NONE. A passing test will run silently, as now; but a failing test will replay log output at the specified level or higher. While at it, support LOGTEST environment variable, same values. This is like setting --debug (or -d), but allows specifying an arbitrary level -- and, unlike --debug, can be set for a TeamCity build config without modifying any scripts or code. Publish LLError::decodeLevel(std::string), previously private to llerror.cpp. --- indra/llcommon/llerror.cpp | 6 +- indra/llcommon/llerrorcontrol.h | 3 +- indra/test/test.cpp | 126 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 119 insertions(+), 16 deletions(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e4381dbbd6..7e6eee0f3c 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -654,9 +654,7 @@ namespace LLError g.invalidateCallSites(); s.tagLevelMap[tag_name] = level; } -} -namespace { LLError::ELevel decodeLevel(std::string name) { static LevelMap level_names; @@ -681,7 +679,9 @@ namespace { return i->second; } - +} + +namespace { void setLevels(LevelMap& map, const LLSD& list, LLError::ELevel level) { LLSD::array_const_iterator i, end; diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index ed9de002f5..1be49cebc8 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -80,7 +80,8 @@ namespace LLError LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel); LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel); LL_COMMON_API void setTagLevel(const std::string& file_name, LLError::ELevel); - + + LL_COMMON_API LLError::ELevel decodeLevel(std::string name); LL_COMMON_API void configure(const LLSD&); // the LLSD can configure all of the settings // usually read automatically from the live errorlog.xml file diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 1adcfb6f45..128d84e428 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -38,6 +38,7 @@ #include "llerrorcontrol.h" #include "lltut.h" #include "stringize.h" +#include "namedtempfile.h" #include "apr_pools.h" #include "apr_getopt.h" @@ -69,17 +70,79 @@ #include #include +#include + +void wouldHaveCrashed(const std::string& message); + namespace tut { std::string sSourceDir; - - test_runner_singleton runner; + + test_runner_singleton runner; } +class LLReplayLog +{ +public: + LLReplayLog() {} + virtual ~LLReplayLog() {} + + virtual void reset() {} + virtual void replay(std::ostream&) {} +}; + +class LLReplayLogReal: public LLReplayLog, public LLError::Recorder +{ +public: + LLReplayLogReal(LLError::ELevel level, apr_pool_t* pool): + mOldSettings(LLError::saveAndResetSettings()), + mTempFile("log", "", pool), // create file + mFile(mTempFile.getName().c_str()) // open it + { + LLError::setFatalFunction(wouldHaveCrashed); + LLError::setDefaultLevel(level); + LLError::addRecorder(this); + } + + virtual ~LLReplayLogReal() + { + LLError::removeRecorder(this); + LLError::restoreSettings(mOldSettings); + } + + virtual void recordMessage(LLError::ELevel level, const std::string& message) + { + mFile << message << std::endl; + } + + virtual void reset() + { + mFile.close(); + mFile.open(mTempFile.getName().c_str()); + } + + virtual void replay(std::ostream& out) + { + mFile.close(); + std::ifstream inf(mTempFile.getName().c_str()); + std::string line; + while (std::getline(inf, line)) + { + out << line << std::endl; + } + } + +private: + LLError::Settings* mOldSettings; + NamedTempFile mTempFile; + std::ofstream mFile; +}; + class LLTestCallback : public tut::callback { public: - LLTestCallback(bool verbose_mode, std::ostream *stream) : + LLTestCallback(bool verbose_mode, std::ostream *stream, + boost::shared_ptr replayer) : mVerboseMode(verbose_mode), mTotalTests(0), mPassedTests(0), @@ -87,7 +150,8 @@ public: mSkippedTests(0), // By default, capture a shared_ptr to std::cout, with a no-op "deleter" // so that destroying the shared_ptr makes no attempt to delete std::cout. - mStream(boost::shared_ptr(&std::cout, boost::lambda::_1)) + mStream(boost::shared_ptr(&std::cout, boost::lambda::_1)), + mReplayer(replayer) { if (stream) { @@ -125,6 +189,16 @@ public: virtual void test_completed(const tut::test_result& tr) { ++mTotalTests; + + // If this test failed, dump requested log messages BEFORE stating the + // test result. + if (tr.result != tut::test_result::ok && tr.result != tut::test_result::skip) + { + mReplayer->replay(*mStream); + } + // Either way, clear stored messages in preparation for next test. + mReplayer->reset(); + std::ostringstream out; out << "[" << tr.group << ", " << tr.test; if (! tr.name.empty()) @@ -205,6 +279,7 @@ protected: int mFailedTests; int mSkippedTests; boost::shared_ptr mStream; + boost::shared_ptr mReplayer; }; // TeamCity specific class which emits service messages @@ -213,8 +288,9 @@ protected: class LLTCTestCallback : public LLTestCallback { public: - LLTCTestCallback(bool verbose_mode, std::ostream *stream) : - LLTestCallback(verbose_mode, stream) + LLTCTestCallback(bool verbose_mode, std::ostream *stream, + boost::shared_ptr replayer) : + LLTestCallback(verbose_mode, stream, replayer) { } @@ -355,6 +431,14 @@ void stream_usage(std::ostream& s, const char* app) ++option; } + s << app << " is also sensitive to environment variables:\n" + << "LOGTEST=level : for all tests, emit log messages at level 'level'\n" + << "LOGFAIL=level : only for failed tests, emit log messages at level 'level'\n" + << "where 'level' is one of ALL, DEBUG, INFO, WARN, ERROR, NONE.\n" + << "--debug is like LOGTEST=DEBUG, but --debug overrides LOGTEST.\n" + << "Setting LOGFAIL overrides both LOGTEST and --debug: the only log\n" + << "messages you will see will be for failed tests.\n\n"; + s << "Examples:" << std::endl; s << " " << app << " --verbose" << std::endl; s << "\tRun all the tests and report all results." << std::endl; @@ -391,8 +475,14 @@ int main(int argc, char **argv) LLError::initForApplication("."); LLError::setFatalFunction(wouldHaveCrashed); LLError::setDefaultLevel(LLError::LEVEL_ERROR); - //< *TODO: should come from error config file. Note that we - // have a command line option that sets this to debug. + // ^ possibly overridden by --debug, LOGTEST or LOGFAIL + + // LOGTEST overrides default, but can be overridden by --debug or LOGFAIL. + const char* LOGTEST = getenv("LOGTEST"); + if (LOGTEST) + { + LLError::setDefaultLevel(LLError::decodeLevel(LOGTEST)); + } #ifdef CTYPE_WORKAROUND ctype_workaround(); @@ -467,8 +557,6 @@ int main(int argc, char **argv) wait_at_exit = true; break; case 'd': - // *TODO: should come from error config file. We set it to - // ERROR by default, so this allows full debug levels. LLError::setDefaultLevel(LLError::LEVEL_DEBUG); break; case 'x': @@ -483,14 +571,28 @@ int main(int argc, char **argv) // run the tests + const char* LOGFAIL = getenv("LOGFAIL"); + boost::shared_ptr replayer; + // As described in stream_usage(), LOGFAIL overrides both --debug and + // LOGTEST. + if (LOGFAIL) + { + LLError::ELevel level = LLError::decodeLevel(LOGFAIL); + replayer.reset(new LLReplayLogReal(level, pool)); + } + else + { + replayer.reset(new LLReplayLog()); + } + LLTestCallback* mycallback; if (getenv("TEAMCITY_PROJECT_NAME")) { - mycallback = new LLTCTestCallback(verbose_mode, output); + mycallback = new LLTCTestCallback(verbose_mode, output, replayer); } else { - mycallback = new LLTestCallback(verbose_mode, output); + mycallback = new LLTestCallback(verbose_mode, output, replayer); } tut::runner.get().set_callback(mycallback); -- cgit v1.2.3 From 63b393da31e9fb972428fe957a05955a3d903113 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 18:49:27 -0500 Subject: Introduce (disabled) LLLeap debugging code to validate stdin writes. While debugging mysterious problem on Windows, one potential failure mode to rule out was the possibility that streaming std::ostringstream << LLSDNotationStreamer(large_LLSD) might itself cause trouble -- even before attempting to write to the LLProcess::WritePipe. The debugging code validated that the correct length is being reported, and that deserializing the resulting buffer produces equivalent LLSD. This code verified correct operation, and so has been disabled, as it's expensive at runtime. --- indra/llcommon/llleap.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 34f77c3f3a..034c809330 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -192,6 +192,31 @@ public: std::ostringstream buffer; buffer << LLSDNotationStreamer(packet); +/*==========================================================================*| + // DEBUGGING ONLY: don't copy str() if we can avoid it. + std::string strdata(buffer.str()); + if (std::size_t(buffer.tellp()) != strdata.length()) + { + LL_ERRS("LLLeap") << "tellp() -> " << buffer.tellp() << " != " + << "str().length() -> " << strdata.length() << LL_ENDL; + } + // DEBUGGING ONLY: reading back is terribly inefficient. + std::istringstream readback(strdata); + LLSD echo; + LLPointer parser(new LLSDNotationParser()); + S32 parse_status(parser->parse(readback, echo, strdata.length())); + if (parse_status == LLSDParser::PARSE_FAILURE) + { + LL_ERRS("LLLeap") << "LLSDNotationParser() cannot parse output of " + << "LLSDNotationStreamer()" << LL_ENDL; + } + if (! llsd_equals(echo, packet)) + { + LL_ERRS("LLLeap") << "LLSDNotationParser() produced different LLSD " + << "than passed to LLSDNotationStreamer()" << LL_ENDL; + } +|*==========================================================================*/ + LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':'; std::string::size_type truncate(80); if (buffer.tellp() <= truncate) -- cgit v1.2.3 From 2491e2bda53ac3a1f2f021e425e7c7c4859e68ad Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 18:55:48 -0500 Subject: Additional diagnostic code to track down strange Windows pipe error. It seems that under certain circumstances, write logic was duplicating a chunk of the data being streamed down our pipe. But as this condition is only driven with a very large data stream, eyeballing that data stream is tedious. Add code to compare the raw received data with the expected stream, reporting where and how they first differ. --- indra/llcommon/tests/llleap_test.cpp | 51 +++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 73d7217608..f1309c5e32 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -89,6 +89,7 @@ namespace tut "import re\n" "import os\n" "import sys\n" + "\n" // Don't forget that this Python script is written to some // temp directory somewhere! Its __file__ is useless in // finding indra/lib/python. Use our __FILE__, with @@ -101,8 +102,15 @@ namespace tut " sys.path.insert(0,\n" " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" " from indra.base import llsd\n" + "\n" "class ProtocolError(Exception):\n" + " def __init__(self, msg, data):\n" + " Exception.__init__(self, msg)\n" + " self.data = data\n" + "\n" + "class ParseError(ProtocolError):\n" " pass\n" + "\n" "def get():\n" " hdr = ''\n" " while ':' not in hdr and len(hdr) < 20:\n" @@ -110,11 +118,11 @@ namespace tut " if not hdr:\n" " sys.exit(0)\n" " if not hdr.endswith(':'):\n" - " raise ProtocolError('Expected len:data, got %r' % hdr)\n" + " raise ProtocolError('Expected len:data, got %r' % hdr, hdr)\n" " try:\n" " length = int(hdr[:-1])\n" " except ValueError:\n" - " raise ProtocolError('Non-numeric len %r' % hdr[:-1])\n" + " raise ProtocolError('Non-numeric len %r' % hdr[:-1], hdr[:-1])\n" " parts = []\n" " received = 0\n" " while received < length:\n" @@ -124,9 +132,12 @@ namespace tut " assert len(data) == length\n" " try:\n" " return llsd.parse(data)\n" - " except llsd.LLSDParseError, e:\n" - " print >>sys.stderr, 'Bad received packet (%s), %s bytes:' % \\\n" - " (e, len(data))\n" + // Seems the old indra.base.llsd module didn't properly + // convert IndexError (from running off end of string) to + // LLSDParseError. + " except (IndexError, llsd.LLSDParseError), e:\n" + " msg = 'Bad received packet (%s)' % e\n" + " print >>sys.stderr, '%s, %s bytes:' % (msg, len(data))\n" " showmax = 40\n" // We've observed failures with very large packets; // dumping the entire packet wastes time and space. @@ -148,7 +159,7 @@ namespace tut " offset += showmax\n" " print >>sys.stderr, '%04d: %r%s' % \\\n" " (offset, data[offset:], ellipsis)\n" - " raise\n" + " raise ParseError(msg, data)\n" "\n" "# deal with initial stdin message\n" // this will throw if the initial write to stdin doesn't @@ -462,7 +473,33 @@ namespace tut // Pass 'large' as reqid because we know the API // will echo reqid, and we want to receive it back. "request('" << api.getName() << "', dict(reqid=large))\n" - "resp = get()\n" + "try:\n" + " resp = get()\n" + "except ParseError, e:\n" + " # try to find where e.data diverges from expectation\n" + // Normally we'd expect a 'pump' key in there, + // too, with value replypump(). But Python + // serializes keys in a different order than C++, + // so incoming data start with 'data'. + // Truthfully, though, if we get as far as 'pump' + // before we find a difference, something's very + // strange. + " expect = llsd.format_notation(dict(data=dict(reqid=large)))\n" + " chunk = 40\n" + " for offset in xrange(0, max(len(e.data), len(expect)), chunk):\n" + " if e.data[offset:offset+chunk] != \\\n" + " expect[offset:offset+chunk]:\n" + " print >>sys.stderr, 'Offset %06d: expect %r,\\n'\\\n" + " ' get %r' %\\\n" + " (offset,\n" + " expect[offset:offset+chunk],\n" + " e.data[offset:offset+chunk])\n" + " break\n" + " else:\n" + " print >>sys.stderr, 'incoming data matches expect?!'\n" + " send('" << result.getName() << "', '%s: %s' % (e.__class__.__name__, e))\n" + " sys.exit(1)\n" + "\n" "echoed = resp['data']['reqid']\n" "if echoed == large:\n" " send('" << result.getName() << "', '')\n" -- cgit v1.2.3 From e7ceb82e71ed88354758c6f16525aa051d47bdec Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 19:00:23 -0500 Subject: Further reduce the block size that LLProcess writes to child pipe. It seems that on Windows, even 32K is too big: one in three load-test runs fails with a duplicated block. Empirically, reducing it to 4K makes it much more stable -- at least we can run successfully 100 consecutive times, which is a step in the right direction. --- indra/llcommon/llprocess.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index d926791e9e..178ec064c0 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -181,8 +181,15 @@ public: { // Tackle the current buffer in discrete chunks. On // Windows, we've observed strange failures when trying to - // write big lengths (~1 MB) in a single operation. - std::size_t towrite((std::min)(remainlen, std::size_t(32*1024))); + // write big lengths (~1 MB) in a single operation. Even a + // 32K chunk seems too large. At some point along the way + // apr_file_write() returns 11 (Resource temporarily + // unavailable, i.e. EAGAIN) and says it wrote 0 bytes -- + // even though it did write the chunk! Our next write + // attempt retries with the same chunk, resulting in the + // chunk being duplicated at the child end. Using smaller + // chunks is empirically more reliable. + std::size_t towrite((std::min)(remainlen, std::size_t(4*1024))); apr_size_t written(towrite); apr_status_t err = apr_file_write(mPipe, remainptr, &written); // EAGAIN is exactly what we want from a nonblocking pipe. -- cgit v1.2.3 From 106bac8ed77339e7c986b3066bf96210d327898d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Mar 2012 21:21:29 -0500 Subject: Alphabetize cmd_line.xml. This separate commit is just to order the keys. Data are unchanged, as established by: $ hg cat -rtip cmd_line.xml >cmd_line.xml.tip $ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from llbase import llsd >>> tipdata = llsd.parse(open("cmd_line.xml.tip").read()) >>> newdata = llsd.parse(open("cmd_line.xml").read()) >>> tipdata == newdata True --- indra/newview/app_settings/cmd_line.xml | 373 ++++++++++++++++---------------- 1 file changed, 187 insertions(+), 186 deletions(-) diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 15434f2b8f..1a8b4560e6 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -1,45 +1,101 @@ - help + + analyzeperformance desc - display this help message + When used in conjunction with logperformance, analyzes result of log against baseline. + map-to + AnalyzePerformance + - short - h + autologin + + desc + log in as last saved user + map-to + AutoLogin - port + channel count 1 - map-to - UserConnectionPort + - drop + console count 1 map-to - PacketDropPercentage + ShowConsoleWindow - inbw + cooperative + desc + Yield some idle time to local host. count 1 map-to - InBandwidth + YieldTime - outbw + crashonstartup + + desc + Crashes on startup. For QA use. + map-to + CrashOnStartup + + + debugsession + + desc + Run as if RenderDebugGL is TRUE, but log errors until end of session. + map-to + DebugSession + + + debugviews + + map-to + DebugViews + + + disablecrashlogger + + desc + Disables the crash logger and lets the OS handle crashes + map-to + DisableCrashLogger + + + drop count 1 map-to - OutBandwidth + PacketDropPercentage + + + god + + desc + Log in a god if you have god access. + map-to + ConnectAsGod + + + graphicslevel + + desc + Set the detail level. +0 - low, 1 - medium, 2 - high, 3 - ultra + count + 1 grid @@ -52,16 +108,13 @@ CmdLineGridChoice - loginuri + help desc - login server and CGI script to use - count - 1 - compose - true - map-to - CmdLineLoginURI + display this help message + + short + h helperuri @@ -74,44 +127,60 @@ CmdLineHelperURI - debugviews + ignorepixeldepth + desc + Ignore pixel depth settings. map-to - DebugViews + IgnorePixelDepth - skin + inbw - desc - ui/branding skin folder to use count 1 map-to - SkinFolder + InBandwidth - autologin + logfile + + count + 1 + map-to + UserLogFile + + + login desc - log in as last saved user + 3 tokens: first, last and password + count + 3 map-to - AutoLogin + UserLoginInfo - quitafter + loginpage + desc + Login authentication page to use. count 1 map-to - QuitAfterSeconds + LoginPage - logperformance + loginuri desc - Log performance metrics for benchmarking + login server and CGI script to use + count + 1 + compose + true map-to - LogPerformance + CmdLineLoginURI logmetrics @@ -123,29 +192,35 @@ map-to LogMetrics
- - analyzeperformance + + logperformance desc - When used in conjunction with logperformance, analyzes result of log against baseline. + Log performance metrics for benchmarking map-to - AnalyzePerformance + LogPerformance - debugsession + multiple desc - Run as if RenderDebugGL is TRUE, but log errors until end of session. + Allow multiple viewers. map-to - DebugSession + AllowMultipleViewers - replaysession + noaudio + + map-to + NoAudio + + + noinvlib desc - After login, replay last recorded session and quit. + Do not request the inventory library. map-to - ReplaySession + NoInventoryLibrary nonotifications @@ -156,22 +231,10 @@ IgnoreAllNotifications
- rotate - - map-to - RotateRight - - - noaudio - - map-to - NoAudio - - - nosound + nopreload map-to - NoAudio + NoPreload noprobe @@ -186,151 +249,134 @@ NoQuickTime
- nopreload + nosound map-to - NoPreload + NoAudio - purge + no-verify-ssl-cert - desc - Delete files in the cache. map-to - PurgeCacheOnNextStartup + NoVerifySSLCert - noinvlib + novoice desc - Do not request the inventory library. + Disable voice. map-to - NoInventoryLibrary + CmdLineDisableVoice - logfile + outbw count 1 map-to - UserLogFile + OutBandwidth - graphicslevel + port - desc - Set the detail level. -0 - low, 1 - medium, 2 - high, 3 - ultra count 1 + map-to + UserConnectionPort - setdefault + purge desc - specify the value of a particular configuration variable which can be overridden by settings.xml. - count - 2 - + Delete files in the cache. + map-to + PurgeCacheOnNextStartup - set + qa desc - specify the value of a particular configuration variable that overrides all other settings. - count - 2 - compose - true - + Activated debugging menu in Advanced Settings. + map-to + QAMode - settings + quitafter - desc - Specify the filename of a configuration file. count 1 - + map-to + QuitAfterSeconds - - sessionsettings + + replaysession desc - Specify the filename of a configuration file that contains temporary per-session configuration overrides. - count - 1 - + After login, replay last recorded session and quit. + map-to + ReplaySession - usersessionsettings - - desc - Specify the filename of a configuration file that contains temporary per-session configuration user overrides. - count - 1 - - - - login + rotate - desc - 3 tokens: first, last and password - count - 3 map-to - UserLoginInfo + RotateRight - god + safe desc - Log in a god if you have god access. + Reset preferences, run in safe mode. map-to - ConnectAsGod + SafeMode - console + sessionsettings + desc + Specify the filename of a configuration file that contains temporary per-session configuration overrides. count 1 - map-to - ShowConsoleWindow + - safe + set desc - Reset preferences, run in safe mode. - map-to - SafeMode + specify the value of a particular configuration variable that overrides all other settings. + count + 2 + compose + true + - multiple + setdefault desc - Allow multiple viewers. - map-to - AllowMultipleViewers + specify the value of a particular configuration variable which can be overridden by settings.xml. + count + 2 + - novoice + settings desc - Disable voice. - map-to - CmdLineDisableVoice + Specify the filename of a configuration file. + count + 1 + - url + skin desc - Startup location + ui/branding skin folder to use count 1 - last_option - true - + map-to + SkinFolder slurl @@ -346,69 +392,24 @@
- ignorepixeldepth - - desc - Ignore pixel depth settings. - map-to - IgnorePixelDepth - - - cooperative + url desc - Yield some idle time to local host. - count - 1 - map-to - YieldTime - - - no-verify-ssl-cert - - map-to - NoVerifySSLCert - - - channel - + Startup location count 1 + last_option + true - loginpage + usersessionsettings desc - Login authentication page to use. + Specify the filename of a configuration file that contains temporary per-session configuration user overrides. count 1 - map-to - LoginPage - - - qa - - desc - Activated debugging menu in Advanced Settings. - map-to - QAMode - - - crashonstartup - - desc - Crashes on startup. For QA use. - map-to - CrashOnStartup - - - disablecrashlogger - - desc - Disables the crash logger and lets the OS handle crashes - map-to - DisableCrashLogger +
-- cgit v1.2.3 From 9ce394a484579a1a408e954d6f3817b23afc273e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Sun, 11 Mar 2012 08:06:37 -0400 Subject: Added tag DRTVWR-119, 3.3.0-beta1 for changeset d5f263687f43 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 577201a72d..0630018dc7 100644 --- a/.hgtags +++ b/.hgtags @@ -271,3 +271,5 @@ e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1 a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2 a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2 987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 +d5f263687f43f278107363365938f0a214920a4b DRTVWR-119 +d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1 -- cgit v1.2.3 From f0c8c4e8fbe240b2e4ba04d47c497b2049ca1313 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 12 Mar 2012 12:05:18 -0400 Subject: For a test program killed by signal, display signal name. --- indra/cmake/run_build_test.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index ce2d1e0386..a2ef61c8fd 100644 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -46,6 +46,7 @@ $/LicenseInfo$ import os import sys +import signal import subprocess def main(command, libpath=[], vars={}): @@ -113,6 +114,33 @@ def main(command, libpath=[], vars={}): sys.stdout.flush() return subprocess.call(command) +# swiped from vita, sigh, seems like a Bad Idea to introduce dependency +def translate_rc(rc): + """ + Accept an rc encoded as for subprocess.Popen.returncode: + None means still running + int >= 0 means terminated voluntarily with specified rc + int < 0 means terminated by signal (-rc) + + Return a string explaining the outcome. In case of a signal, try to + name the corresponding symbol from the 'signal' module. + """ + if rc is None: + return "still running" + + if rc >= 0: + return "terminated with rc %s" % rc + + # Negative rc means the child was terminated by signal -rc. + rc = -rc + for attr in dir(signal): + if attr.startswith('SIG') and getattr(signal, attr) == rc: + strc = attr + break + else: + strc = str(rc) + return "terminated by signal %s" % strc + if __name__ == "__main__": from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] command args...") @@ -140,5 +168,5 @@ if __name__ == "__main__": vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars])) if rc not in (None, 0): print >>sys.stderr, "Failure running: %s" % " ".join(args) - print >>sys.stderr, "Error: %s" % rc + print >>sys.stderr, "Error %s: %s" % (rc, translate_rc(rc)) sys.exit((rc < 0) and 255 or rc) -- cgit v1.2.3 From cf6aabff08d8bc4e38b2b271085978486451eda2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 12 Mar 2012 12:08:35 -0400 Subject: Normalize LLErrorThread::run() loop exit condition. --- indra/llcommon/llerrorthread.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index 902eaa3b72..950fcd6e83 100644 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp @@ -112,13 +112,8 @@ void LLErrorThread::run() #if !LL_WINDOWS U32 last_sig_child_count = 0; #endif - while (1) + while (! (LLApp::isError() || LLApp::isStopped())) { - if (LLApp::isError() || LLApp::isStopped()) - { - // The application has stopped running, time to take action (maybe) - break; - } #if !LL_WINDOWS // Check whether or not the main thread had a sig child we haven't handled. U32 current_sig_child_count = LLApp::getSigChildCount(); -- cgit v1.2.3 From 7d3cf544c7962ae6cc8e0e8b8e8db817e366a9cc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 13 Mar 2012 14:15:11 -0400 Subject: Add timeout functionality to waitfor() helper functions. Otherwise, a stuck child process could potentially hang the test, and thus the whole viewer build. --- indra/llcommon/tests/llprocess_test.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 6103764f24..99186ed434 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -101,20 +101,26 @@ void yield(int seconds=1) LLEventPumps::instance().obtain("mainloop").post(LLSD()); } -void waitfor(LLProcess& proc) +void waitfor(LLProcess& proc, int timeout=60) { - while (proc.isRunning()) + int i = 0; + for ( ; i < timeout && proc.isRunning(); ++i) { yield(); } + tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"), + i < timeout); } -void waitfor(LLProcess::handle h, const std::string& desc) +void waitfor(LLProcess::handle h, const std::string& desc, int timeout=60) { - while (LLProcess::isRunning(h, desc)) + int i = 0; + for ( ; i < timeout && LLProcess::isRunning(h, desc); ++i) { yield(); } + tut::ensure(STRINGIZE("process took longer than " << timeout << " seconds to terminate"), + i < timeout); } /** -- cgit v1.2.3 From 1bdc876b790d054400240e4a4bda6d56d026cf59 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 13 Mar 2012 14:28:19 -0400 Subject: Increase timeout for very-large-message test. Apparently, at least on Mac, there are circumstances in which the very-large- message test can take several times longer than normal, yet still complete successfully. This is always the problem with timeouts: does timeout expiration mean that the code in question is actually hung, or would it complete if given a bit longer? If very-large-message test fails, retry a few times with smaller sizes to try to find a size at which the test runs reliably. The default size, ca 1MB, is intended to be substantially larger than anything we'll encounter in the wild. Is that "unreasonably" large? Is there a "reasonable" size at which the test could consistently pass? Is that "reasonable" size still larger than what we expect to encounter in practice? Need more information, hence this code. --- indra/llcommon/tests/llleap_test.cpp | 72 ++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index f1309c5e32..aedb12a70b 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -60,12 +60,21 @@ void waitfor(const std::vector& instances, int timeout=60) // If we made it through all of 'instances' without finding one that's // still running, we're done. if (vli == vlend) + { +/*==========================================================================*| + std::cout << instances.size() << " LLLeap instances terminated in " + << i << " seconds, proceeding" << std::endl; +|*==========================================================================*/ return; + } // Found an instance that's still running. Wait and pump LLProcess. sleep(1); LLEventPumps::instance().obtain("mainloop").post(LLSD()); } - tut::ensure("timed out without terminating", i < timeout); + tut::ensure(STRINGIZE("at least 1 of " << instances.size() + << " LLLeap instances timed out (" + << timeout << " seconds) without terminating"), + i < timeout); } void waitfor(LLLeap* instance, int timeout=60) @@ -455,10 +464,11 @@ namespace tut result.ensure(); } - template<> template<> - void object::test<10>() + // This is the body of test<10>, extracted so we can run it over a number + // of large-message sizes. + void test_large_message(const std::string& PYTHON, const std::string& reader_module, + const std::string& test_name, size_t size) { - set_test_name("very large message"); ReqIDAPI api; Result result; NamedTempFile script("py", @@ -514,14 +524,62 @@ namespace tut " 'at offset %s, expected %r but got %r' %\n" " (start, large[start:end], echoed[start:end]))\n" "sys.exit(1)\n"); - waitfor(LLLeap::create(get_test_name(), + waitfor(LLLeap::create(test_name, sv(list_of (PYTHON) (script.getName()) - (stringize(BUFFERED_LENGTH))))); + (stringize(size)))), + 180); // try a longer timeout result.ensure(); } - // TODO: + // The point of this function is to try to find a size at which + // test_large_message() can succeed. We still want the overall test to + // fail; otherwise we won't get the coder's attention -- but if + // test_large_message() fails, try to find a plausible size at which it + // DOES work. + void test_or_split(const std::string& PYTHON, const std::string& reader_module, + const std::string& test_name, size_t size) + { + try + { + test_large_message(PYTHON, reader_module, test_name, size); + } + catch (const failure& e) + { + std::cout << "test_large_message(" << size << ") failed: " << e.what() << std::endl; + // If it still fails below 4K, give up: subdividing any further is + // pointless. + if (size >= 4096) + { + try + { + // Recur with half the size + size_t smaller(size/2); + test_or_split(PYTHON, reader_module, test_name, smaller); + // Recursive call will throw if test_large_message() + // failed, therefore we only reach the line below if it + // succeeded. + std::cout << "but test_large_message(" << smaller << ") succeeded" << std::endl; + } + catch (const failure&) + { + // The recursive test_or_split() call above has already + // handled the exception. We don't want our caller to see + // innermost exception; propagate outermost (below). + } + } + // In any case, because we reached here through failure of + // our original test_large_message(size) call, ensure failure + // propagates. + throw e; + } + } + template<> template<> + void object::test<10>() + { + set_test_name("very large message"); + test_or_split(PYTHON, reader_module, get_test_name(), BUFFERED_LENGTH); + } } // namespace tut -- cgit v1.2.3 From ab7fb5944a2c5d851944fec59a86c8b7e0df77d3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 13 Mar 2012 14:40:46 -0400 Subject: Protect LLProcess destructor when run after APR shutdown. A static LLProcessPtr variable won't be destroyed until after procedural code has shut down APR. The trouble is that LLProcess's destructor unregisters itself from APR -- and, for an autokill LLProcess, attempts to kill the child process. All that is ill-advised after APR shutdown. Disable use of apr_pool_note_subprocess() mechanism. This should be another viable way of coping with static autokill LLProcessPtr variables: when the designated APR pool is cleaned up, APR promises to kill the child process. But whether it's an APR bug or a calling error, the present (now disabled) call in LLProcess results in OUR process, the viewer, getting SIGTERM when it asks to clean up the global APR pool. --- indra/llcommon/llprocess.cpp | 62 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 178ec064c0..bd08c3ab51 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -47,6 +47,9 @@ #include #include +/***************************************************************************** +* Helpers +*****************************************************************************/ static const char* whichfile_[] = { "stdin", "stdout", "stderr" }; static std::string empty; static LLProcess::Status interpret_status(int status); @@ -127,6 +130,9 @@ private: }; static LLProcessListener sProcessListener; +/***************************************************************************** +* WritePipe and ReadPipe +*****************************************************************************/ LLProcess::BasePipe::~BasePipe() {} const LLProcess::BasePipe::size_type // use funky syntax to call max() to avoid blighted max() macros @@ -456,6 +462,9 @@ private: bool mEOF; }; +/***************************************************************************** +* LLProcess itself +*****************************************************************************/ /// Need an exception to avoid constructing an invalid LLProcess object, but /// internal use only struct LLProcessError: public std::runtime_error @@ -669,11 +678,23 @@ LLProcess::LLProcess(const LLSDOrParams& params): // that doesn't always work (e.g. VWR-21538). if (params.autokill) { +/*==========================================================================*| + // NO: There may be an APR bug, not sure -- but at least on Mac, when + // gAPRPoolp is destroyed, OUR process receives SIGTERM! Apparently + // either our own PID is getting into the list of processes to kill() + // (unlikely), or somehow one of those PIDs is getting zeroed first, + // so that kill() sends SIGTERM to the whole process group -- this + // process included. I'd have to build and link with a debug version + // of APR to know for sure. It's too bad: this mechanism would be just + // right for dealing with static autokill LLProcessPtr variables, + // which aren't destroyed until after APR is no longer available. + // Tie the lifespan of this child process to the lifespan of our APR // pool: on destruction of the pool, forcibly kill the process. Tell // APR to try SIGTERM and wait 3 seconds. If that didn't work, use // SIGKILL. apr_pool_note_subprocess(gAPRPoolp, &mProcess, APR_KILL_AFTER_TIMEOUT); +|*==========================================================================*/ // On Windows, associate the new child process with our Job Object. autokill(); @@ -732,6 +753,13 @@ std::string LLProcess::basename(const std::string& path) LLProcess::~LLProcess() { + // In the Linden viewer, there's at least one static LLProcessPtr. Its + // destructor will be called *after* ll_cleanup_apr(). In such a case, + // unregistering is pointless (and fatal!) -- and kill(), which also + // relies on APR, is impossible. + if (! gAPRPoolp) + return; + // Only in state RUNNING are we registered for callback. In UNSTARTED we // haven't yet registered. And since receiving the callback is the only // way we detect child termination, we only change from state RUNNING at @@ -1263,38 +1291,4 @@ static LLProcess::Status interpret_status(int status) return result; } -/*==========================================================================*| -static std::list sZombies; - -void LLProcess::orphan(void) -{ - // Disassociate the process from this object - if(mProcessID != 0) - { - // We may still need to reap the process's zombie eventually - sZombies.push_back(mProcessID); - - mProcessID = 0; - } -} - -// static -void LLProcess::reap(void) -{ - // Attempt to real all saved process ID's. - - std::list::iterator iter = sZombies.begin(); - while(iter != sZombies.end()) - { - if(reap_pid(*iter)) - { - iter = sZombies.erase(iter); - } - else - { - iter++; - } - } -} -|*==========================================================================*/ #endif // Posix -- cgit v1.2.3 From 77df887b657f2a38474b3e3699d54d2e020e88ba Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 13 Mar 2012 16:04:27 -0400 Subject: Added tag viewer-release-candidate for changeset 5e8d2662f38a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0630018dc7..0702c4ee14 100644 --- a/.hgtags +++ b/.hgtags @@ -273,3 +273,4 @@ a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2 987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2 d5f263687f43f278107363365938f0a214920a4b DRTVWR-119 d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1 +5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate -- cgit v1.2.3 From bdc27815cab6fb290c5d0a9bb6837a6451cc0c73 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 13 Mar 2012 17:17:20 -0400 Subject: If very-large-message test fails, search for a size that works. We want to write a robust test that consistently works. On Windows, that appears to require constraining the max message size. I, the coder, could try submitting test runs of varying sizes to TC until I found a size that works... but that could take quite a while. If I were clever, I might even use a manual binary search. But computers are good at binary searching; there are even prepackaged algorithms in the STL. If I were cleverer still, I could make the test program itself search for size that works. --- indra/llcommon/tests/llleap_test.cpp | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index aedb12a70b..1b71f7fb72 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -29,6 +29,7 @@ #include "llprocess.h" #include "stringize.h" #include "StringVec.h" +#include using boost::assign::list_of; @@ -533,6 +534,66 @@ namespace tut result.ensure(); } + struct TestLargeMessage: public std::binary_function + { + TestLargeMessage(const std::string& PYTHON_, const std::string& reader_module_, + const std::string& test_name_): + PYTHON(PYTHON_), + reader_module(reader_module_), + test_name(test_name_) + {} + + bool operator()(size_t left, size_t right) const + { + // We don't know whether upper_bound is going to pass the "sought + // value" as the left or the right operand. We pass 0 as the + // "sought value" so we can distinguish it. Of course that means + // the sequence we're searching must not itself contain 0! + size_t size; + bool success; + if (left) + { + size = left; + // Consider our return value carefully. Normal binary_search + // (or, in our case, upper_bound) expects a container sorted + // in ascending order, and defaults to the std::less + // comparator. Our container is in fact in ascending order, so + // return consistently with std::less. Here we were called as + // compare(item, sought). If std::less were called that way, + // 'true' would mean to move right (to higher numbers) within + // the sequence: the item being considered is less than the + // sought value. For us, that means that test_large_message() + // success should return 'true'. + success = true; + } + else + { + size = right; + // Here we were called as compare(sought, item). If std::less + // were called that way, 'true' would mean to move left (to + // lower numbers) within the sequence: the sought value is + // less than the item being considered. For us, that means + // test_large_message() FAILURE should return 'true', hence + // test_large_message() success should return 'false'. + success = false; + } + + try + { + test_large_message(PYTHON, reader_module, test_name, size); + std::cout << "test_large_message(" << size << ") succeeded" << std::endl; + return success; + } + catch (const failure& e) + { + std::cout << "test_large_message(" << size << ") failed: " << e.what() << std::endl; + return ! success; + } + } + + const std::string PYTHON, reader_module, test_name; + }; + // The point of this function is to try to find a size at which // test_large_message() can succeed. We still want the overall test to // fail; otherwise we won't get the coder's attention -- but if @@ -561,6 +622,35 @@ namespace tut // failed, therefore we only reach the line below if it // succeeded. std::cout << "but test_large_message(" << smaller << ") succeeded" << std::endl; + + // Binary search for largest size that works. But since + // std::binary_search() only returns bool, actually use + // std::upper_bound(), consistent with our desire to find + // the LARGEST size that works. First generate a sorted + // container of all the sizes we intend to try, from + // 'smaller' (known to work) to 'size' (known to fail). We + // could whomp up magic iterators to do this dynamically, + // without actually instantiating a vector, but for a test + // program this will do. At least preallocate the vector. + // Per TestLargeMessage comments, it's important that this + // vector not contain 0. + std::vector sizes; + sizes.reserve((size - smaller)/4096 + 1); + for (size_t sz(smaller), szend(size); sz < szend; sz += 4096) + sizes.push_back(sz); + // our comparator + TestLargeMessage tester(PYTHON, reader_module, test_name); + // Per TestLargeMessage comments, pass 0 as the sought value. + std::vector::const_iterator found = + std::upper_bound(sizes.begin(), sizes.end(), 0, tester); + if (found != sizes.end() && found != sizes.begin()) + { + std::cout << "test_large_message(" << *(found - 1) << ") is largest that succeeds" << std::endl; + } + else + { + std::cout << "cannot determine largest test_large_message(size) that succeeds" << std::endl; + } } catch (const failure&) { -- cgit v1.2.3 From b669b6262a131cef4b769f4c2c223d25c42cc1f2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 09:57:52 -0400 Subject: On Windows, try cutting down the size of a "very large message." Ideally we'd love to be able to nail the underlying bug, but log output suggests it may actually go all the way down to the OS level. To move forward, try to bypass it. --- indra/llcommon/tests/llleap_test.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 1b71f7fb72..e01aedd7ee 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -41,7 +41,30 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -const size_t BUFFERED_LENGTH = 1024*1023; // try wrangling just under a megabyte of data +#if ! LL_WINDOWS +const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte of data +#else +// "Then there's Windows... sigh." The "very large message" test is flaky in a +// way that seems to point to either the OS (nonblocking writes to pipes) or +// possibly the apr_file_write() function. Poring over log messages reveals +// that at some point along the way apr_file_write() returns 11 (Resource +// temporarily unavailable, i.e. EAGAIN) and says it wrote 0 bytes -- even +// though it did write the chunk! Our next write attempt retries the same +// chunk, resulting in the chunk being duplicated at the child end, corrupting +// the data stream. Much as I would love to be able to fix it for real, such a +// fix would appear to require distinguishing bogus EAGAIN returns from real +// ones -- how?? Empirically this behavior is only observed when writing a +// "very large message". To be able to move forward at all, try to bypass this +// particular failure by adjusting the size of a "very large message" on +// Windows. When the test fails at BUFFERED_LENGTH, the test_or_split() +// function performs a binary search to find the largest size that will work. +// Running several times on a couple different Windows machines produces a +// range of "largest successful size" results... suggesting that it may be a +// matter of available OS buffer space? In any case, pick something small +// enough to be optimistic, while hopefully remaining comfortably larger than +// real messages we'll encounter in the wild. +const size_t BUFFERED_LENGTH = 256*1024; +#endif // LL_WINDOWS void waitfor(const std::vector& instances, int timeout=60) { @@ -645,11 +668,13 @@ namespace tut std::upper_bound(sizes.begin(), sizes.end(), 0, tester); if (found != sizes.end() && found != sizes.begin()) { - std::cout << "test_large_message(" << *(found - 1) << ") is largest that succeeds" << std::endl; + std::cout << "test_large_message(" << *(found - 1) + << ") is largest that succeeds" << std::endl; } else { - std::cout << "cannot determine largest test_large_message(size) that succeeds" << std::endl; + std::cout << "cannot determine largest test_large_message(size) " + << "that succeeds" << std::endl; } } catch (const failure&) -- cgit v1.2.3 From caba4fe1132a8927c8ee7b5a1133ce854986373e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 13:02:37 -0400 Subject: Try new 20120314 APR build to verify Windows pipe write bug fix. --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 99fa201ee3..19913bf8de 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -90,9 +90,9 @@ archive hash - 15333927db9f249daefcaed70fc6683c + 02eb2d32f4013e23eb0bc2cd1b7f9b82 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120210.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/251231/arch/Darwin/installer/apr_suite-1.4.5-darwin-20120314.tar.bz2 name darwin @@ -102,9 +102,9 @@ archive hash - 297508ece8b0f334bae842fd147f2962 + 4ade1434e263cbb85a424e7dd35b8025 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/Linux/installer/apr_suite-1.4.5-linux-20120211.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/251231/arch/Linux/installer/apr_suite-1.4.5-linux-20120314.tar.bz2 name linux @@ -114,9 +114,9 @@ archive hash - 7ad1e767f4419a6d35a70abba1edbcdc + 6a2f05e8ddf01036aada46377295887f url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/249247/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120210.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-apr/rev/251231/arch/CYGWIN/installer/apr_suite-1.4.5-windows-20120314.tar.bz2 name windows -- cgit v1.2.3 From a16f2faa8d4252c7a979c3f2783b65852656e47d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 13:14:24 -0400 Subject: Backed out changeset 51205a909e2c (Windows APR pipe bug workaround) If in fact we've managed to fix the APR bug writing to a Windows named pipe, it should no longer be necessary to try to work around it by testing with a much smaller data volume on Windows! --- indra/llcommon/tests/llleap_test.cpp | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index e01aedd7ee..1b71f7fb72 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -41,30 +41,7 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -#if ! LL_WINDOWS -const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte of data -#else -// "Then there's Windows... sigh." The "very large message" test is flaky in a -// way that seems to point to either the OS (nonblocking writes to pipes) or -// possibly the apr_file_write() function. Poring over log messages reveals -// that at some point along the way apr_file_write() returns 11 (Resource -// temporarily unavailable, i.e. EAGAIN) and says it wrote 0 bytes -- even -// though it did write the chunk! Our next write attempt retries the same -// chunk, resulting in the chunk being duplicated at the child end, corrupting -// the data stream. Much as I would love to be able to fix it for real, such a -// fix would appear to require distinguishing bogus EAGAIN returns from real -// ones -- how?? Empirically this behavior is only observed when writing a -// "very large message". To be able to move forward at all, try to bypass this -// particular failure by adjusting the size of a "very large message" on -// Windows. When the test fails at BUFFERED_LENGTH, the test_or_split() -// function performs a binary search to find the largest size that will work. -// Running several times on a couple different Windows machines produces a -// range of "largest successful size" results... suggesting that it may be a -// matter of available OS buffer space? In any case, pick something small -// enough to be optimistic, while hopefully remaining comfortably larger than -// real messages we'll encounter in the wild. -const size_t BUFFERED_LENGTH = 256*1024; -#endif // LL_WINDOWS +const size_t BUFFERED_LENGTH = 1024*1023; // try wrangling just under a megabyte of data void waitfor(const std::vector& instances, int timeout=60) { @@ -668,13 +645,11 @@ namespace tut std::upper_bound(sizes.begin(), sizes.end(), 0, tester); if (found != sizes.end() && found != sizes.begin()) { - std::cout << "test_large_message(" << *(found - 1) - << ") is largest that succeeds" << std::endl; + std::cout << "test_large_message(" << *(found - 1) << ") is largest that succeeds" << std::endl; } else { - std::cout << "cannot determine largest test_large_message(size) " - << "that succeeds" << std::endl; + std::cout << "cannot determine largest test_large_message(size) that succeeds" << std::endl; } } catch (const failure&) -- cgit v1.2.3 From 4e889ee98e568328372a915252a3c7906819b018 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 14:38:47 -0400 Subject: Backed out changeset 22664c76b59e (reinstate Windows pipe workaround) Sigh, the rejoicing was premature. --- indra/llcommon/tests/llleap_test.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 1b71f7fb72..e01aedd7ee 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -41,7 +41,30 @@ StringVec sv(const StringVec& listof) { return listof; } #define sleep(secs) _sleep((secs) * 1000) #endif -const size_t BUFFERED_LENGTH = 1024*1023; // try wrangling just under a megabyte of data +#if ! LL_WINDOWS +const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte of data +#else +// "Then there's Windows... sigh." The "very large message" test is flaky in a +// way that seems to point to either the OS (nonblocking writes to pipes) or +// possibly the apr_file_write() function. Poring over log messages reveals +// that at some point along the way apr_file_write() returns 11 (Resource +// temporarily unavailable, i.e. EAGAIN) and says it wrote 0 bytes -- even +// though it did write the chunk! Our next write attempt retries the same +// chunk, resulting in the chunk being duplicated at the child end, corrupting +// the data stream. Much as I would love to be able to fix it for real, such a +// fix would appear to require distinguishing bogus EAGAIN returns from real +// ones -- how?? Empirically this behavior is only observed when writing a +// "very large message". To be able to move forward at all, try to bypass this +// particular failure by adjusting the size of a "very large message" on +// Windows. When the test fails at BUFFERED_LENGTH, the test_or_split() +// function performs a binary search to find the largest size that will work. +// Running several times on a couple different Windows machines produces a +// range of "largest successful size" results... suggesting that it may be a +// matter of available OS buffer space? In any case, pick something small +// enough to be optimistic, while hopefully remaining comfortably larger than +// real messages we'll encounter in the wild. +const size_t BUFFERED_LENGTH = 256*1024; +#endif // LL_WINDOWS void waitfor(const std::vector& instances, int timeout=60) { @@ -645,11 +668,13 @@ namespace tut std::upper_bound(sizes.begin(), sizes.end(), 0, tester); if (found != sizes.end() && found != sizes.begin()) { - std::cout << "test_large_message(" << *(found - 1) << ") is largest that succeeds" << std::endl; + std::cout << "test_large_message(" << *(found - 1) + << ") is largest that succeeds" << std::endl; } else { - std::cout << "cannot determine largest test_large_message(size) that succeeds" << std::endl; + std::cout << "cannot determine largest test_large_message(size) " + << "that succeeds" << std::endl; } } catch (const failure&) -- cgit v1.2.3 From cb38ceb89fc34105ad2ba2fdfa35faa2918d0346 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 15:42:22 -0400 Subject: Add --leap command-line switch to launch one or more LEAP plugins. You can specify one or more instances of --leap 'command line'. Each such command line is parsed using bash-like conventions, notably honoring double quotes, e.g. --leap '"c:/Program Files/Something/something.exe" arg1 arg2'. (Specifying such an argument in a Windows Command Prompt may be tricky.) Such a program should read its stdin and write to its stdout using LLSD Event API Plugin protocol: length:serialized_LLSD where 'length' is the decimal integer count of bytes in serialized_LLSD, ':' is a literal colon character, and 'serialized_LLSD' is notation-format LLSD. A typical LLSD object is a map containing 'pump' and 'data' keys, where 'pump' is the name of the LLEventPump on which to send 'data' (or on which 'data' was received). In particular, the initial LLSD object on stdin mentions the name of this plugin's reply LLEventPump: the LLEventPump that will send every subsequent received event to the plugin's stdin. Anything written to the plugin's stderr will be logged in the viewer log. In addition to being generally useful, this helps debug problems with particular plugins. --- indra/newview/app_settings/cmd_line.xml | 13 ++++ indra/newview/app_settings/settings.xml | 13 +++- indra/newview/llappviewer.cpp | 117 ++++++-------------------------- indra/newview/llappviewer.h | 6 -- 4 files changed, 46 insertions(+), 103 deletions(-) diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 1a8b4560e6..be79f91919 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -143,6 +143,19 @@ InBandwidth + leap + + desc + command line to run an LLSD Event API Plugin + count + 1 + + compose + true + map-to + LeapCommand + + logfile count diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0e26013152..e9dd405bc6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4579,6 +4579,17 @@ Value 0 + LeapCommand + + Comment + Zero or more command lines to run LLSD Event API Plugin programs. + Persist + 0 + Type + LLSD + Value + + LSLFindCaseInsensitivity Comment @@ -7142,7 +7153,7 @@ QAModeEventHostPort Comment - Port on which lleventhost should listen + DEPRECATED: Port on which lleventhost should listen Persist 0 Type diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1174d108d2..85bd836104 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -111,6 +111,8 @@ #include "llnotifications.h" #include "llnotificationsutil.h" +#include "llleap.h" + // Third party library includes #include #include @@ -124,7 +126,6 @@ #endif #include "llapr.h" -#include "apr_dso.h" #include #include "llviewerkeyboard.h" @@ -161,6 +162,7 @@ #include "llcontainerview.h" #include "lltooltip.h" +#include "llsdutil.h" #include "llsdserialize.h" #include "llworld.h" @@ -1038,11 +1040,27 @@ bool LLAppViewer::init() gGLActive = FALSE; + + // Iterate over --leap command-line options + BOOST_FOREACH(const std::string& leap, llsd::inArray(gSavedSettings.getLLSD("LeapCommand"))) + { + LL_DEBUGS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL; + // We don't have any better description of this plugin than the + // user-specified command line. Passing "" causes LLLeap to derive a + // description from the command line itself. + // Suppress LLLeap::Error exception: trust LLLeap's own logging. We + // don't consider any one --leap command mission-critical, so if one + // fails, log it, shrug and carry on. + LLLeap::create("", leap, false); // exception=false + } + if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0) { - loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort")); + LL_WARNS("InitInfo") << "QAModeEventHostPort DEPRECATED: " + << "lleventhost no longer supported as a dynamic library" + << LL_ENDL; } - + LLViewerMedia::initClass(); LL_INFOS("InitInfo") << "Viewer media initialized." << LL_ENDL ; @@ -1515,18 +1533,6 @@ bool LLAppViewer::cleanup() gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp"); } - // *TODO - generalize this and move DSO wrangling to a helper class -brad - std::set::const_iterator i; - for(i = mPlugins.begin(); i != mPlugins.end(); ++i) - { - int (*ll_plugin_stop_func)(void) = NULL; - apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, *i, "ll_plugin_stop"); - ll_plugin_stop_func(); - - rv = apr_dso_unload(*i); - } - mPlugins.clear(); - //flag all elements as needing to be destroyed immediately // to ensure shutdown order LLMortician::setZealous(TRUE); @@ -4958,87 +4964,6 @@ void LLAppViewer::handleLoginComplete() writeDebugInfo(); } -// *TODO - generalize this and move DSO wrangling to a helper class -brad -void LLAppViewer::loadEventHostModule(S32 listen_port) -{ - std::string dso_name = -#if LL_WINDOWS - "lleventhost.dll"; -#elif LL_DARWIN - "liblleventhost.dylib"; -#else - "liblleventhost.so"; -#endif - - std::string dso_path = gDirUtilp->findFile(dso_name, - gDirUtilp->getAppRODataDir(), - gDirUtilp->getExecutableDir()); - - if(dso_path == "") - { - llerrs << "QAModeEventHost requested but module \"" << dso_name << "\" not found!" << llendl; - return; - } - - LL_INFOS("eventhost") << "Found lleventhost at '" << dso_path << "'" << LL_ENDL; -#if ! defined(LL_WINDOWS) - { - std::string outfile("/tmp/lleventhost.file.out"); - std::string command("file '" + dso_path + "' > '" + outfile + "' 2>&1"); - int rc = system(command.c_str()); - if (rc != 0) - { - LL_WARNS("eventhost") << command << " ==> " << rc << ':' << LL_ENDL; - } - else - { - LL_INFOS("eventhost") << command << ':' << LL_ENDL; - } - { - std::ifstream reader(outfile.c_str()); - std::string line; - while (std::getline(reader, line)) - { - size_t len = line.length(); - if (len && line[len-1] == '\n') - line.erase(len-1); - LL_INFOS("eventhost") << line << LL_ENDL; - } - } - remove(outfile.c_str()); - } -#endif // LL_WINDOWS - - apr_dso_handle_t * eventhost_dso_handle = NULL; - apr_pool_t * eventhost_dso_memory_pool = NULL; - - //attempt to load the shared library - apr_pool_create(&eventhost_dso_memory_pool, NULL); - apr_status_t rv = apr_dso_load(&eventhost_dso_handle, - dso_path.c_str(), - eventhost_dso_memory_pool); - llassert_always(! ll_apr_warn_status(rv, eventhost_dso_handle)); - llassert_always(eventhost_dso_handle != NULL); - - int (*ll_plugin_start_func)(LLSD const &) = NULL; - rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_start_func, eventhost_dso_handle, "ll_plugin_start"); - - llassert_always(! ll_apr_warn_status(rv, eventhost_dso_handle)); - llassert_always(ll_plugin_start_func != NULL); - - LLSD args; - args["listen_port"] = listen_port; - - int status = ll_plugin_start_func(args); - - if(status != 0) - { - llerrs << "problem loading eventhost plugin, status: " << status << llendl; - } - - mPlugins.insert(eventhost_dso_handle); -} - void LLAppViewer::launchUpdater() { LLSD query_map = LLSD::emptyMap(); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 71a7868191..f7d019ccba 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -41,8 +41,6 @@ class LLTextureFetch; class LLWatchdogTimeout; class LLUpdaterService; -struct apr_dso_handle_t; - class LLAppViewer : public LLApp { public: @@ -220,8 +218,6 @@ private: void sendLogoutRequest(); void disconnectViewer(); - - void loadEventHostModule(S32 listen_port); // *FIX: the app viewer class should be some sort of singleton, no? // Perhaps its child class is the singleton and this should be an abstract base. @@ -270,8 +266,6 @@ private: LLAllocator mAlloc; - std::set mPlugins; - LLFrameTimer mMemCheckTimer; boost::scoped_ptr mUpdater; -- cgit v1.2.3 From 7de3161fa866bc415b4b87f26ca3f7fc3670af78 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 14 Mar 2012 23:59:57 -0400 Subject: Fix --leap assumption that LeapCommand setting is ALWAYS an array. Nuance of command-line processing: when there's exactly one --leap switch, the resulting LLSD is a scalar string rather than an array with one entry. Fix processing code to handle either case. --- indra/newview/llappviewer.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 85bd836104..7e0162d026 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1041,10 +1041,21 @@ bool LLAppViewer::init() gGLActive = FALSE; - // Iterate over --leap command-line options - BOOST_FOREACH(const std::string& leap, llsd::inArray(gSavedSettings.getLLSD("LeapCommand"))) + // Iterate over --leap command-line options. But this is a bit tricky: if + // there's only one, it won't be an array at all. + LLSD LeapCommand(gSavedSettings.getLLSD("LeapCommand")); + LL_DEBUGS("InitInfo") << "LeapCommand: " << LeapCommand << LL_ENDL; + if (LeapCommand.isDefined() && ! LeapCommand.isArray()) { - LL_DEBUGS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL; + // If LeapCommand is actually a scalar value, make an array of it. + // Have to do it in two steps because LeapCommand.append(LeapCommand) + // trashes content! :-P + LLSD item(LeapCommand); + LeapCommand.append(item); + } + BOOST_FOREACH(const std::string& leap, llsd::inArray(LeapCommand)) + { + LL_INFOS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL; // We don't have any better description of this plugin than the // user-specified command line. Passing "" causes LLLeap to derive a // description from the command line itself. -- cgit v1.2.3 From 2a6f919cdbe5c878444a722fe91768ccd4e46c98 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 15 Mar 2012 16:16:05 -0400 Subject: Explicitly clean up all LLLeap instances during viewer shutdown. This code replaces the previous cleanup of DLLs loaded by APR. --- indra/newview/llappviewer.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7e0162d026..f18e5d2c9e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1544,6 +1544,25 @@ bool LLAppViewer::cleanup() gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp"); } + { + // Kill off LLLeap objects. We can find them all because LLLeap is derived + // from LLInstanceTracker. But collect instances first: LLInstanceTracker + // specifically forbids adding/deleting instances while iterating. + std::vector leaps; + leaps.reserve(LLLeap::instanceCount()); + for (LLLeap::instance_iter li(LLLeap::beginInstances()), lend(LLLeap::endInstances()); + li != lend; ++li) + { + leaps.push_back(&*li); + } + // Okay, now trash them all. We don't have to NULL or erase the entry + // in 'leaps' because the whole vector is going away momentarily. + BOOST_FOREACH(LLLeap* leap, leaps) + { + delete leap; + } + } // destroy 'leaps' + //flag all elements as needing to be destroyed immediately // to ensure shutdown order LLMortician::setZealous(TRUE); -- cgit v1.2.3 From be669d4a1fe0e52ba8524ad851376cf653c822b6 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 15 Mar 2012 16:51:34 -0400 Subject: On Windows, make "very large message" test ridiculously small. This test must not be subject to spurious environmental failures, else some kind soul will disable it entirely. We observe that APR specifies a hard-coded buffer size of 64Kbytes for pipe creation -- use that and cross fingers. --- indra/llcommon/tests/llleap_test.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index e01aedd7ee..9b755e9ca5 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -56,14 +56,8 @@ const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte // ones -- how?? Empirically this behavior is only observed when writing a // "very large message". To be able to move forward at all, try to bypass this // particular failure by adjusting the size of a "very large message" on -// Windows. When the test fails at BUFFERED_LENGTH, the test_or_split() -// function performs a binary search to find the largest size that will work. -// Running several times on a couple different Windows machines produces a -// range of "largest successful size" results... suggesting that it may be a -// matter of available OS buffer space? In any case, pick something small -// enough to be optimistic, while hopefully remaining comfortably larger than -// real messages we'll encounter in the wild. -const size_t BUFFERED_LENGTH = 256*1024; +// Windows. +const size_t BUFFERED_LENGTH = 65336; #endif // LL_WINDOWS void waitfor(const std::vector& instances, int timeout=60) -- cgit v1.2.3 From 4edf34ed01611d75bdcd98aa065a2b286845ebd9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 15 Mar 2012 23:30:36 -0400 Subject: Promote LLProcess::ReadPipe::size() to BasePipe (hence WritePipe). Certain use cases need to know whether the WritePipe buffer has been flushed to the pipe, or is still pending. --- indra/llcommon/llprocess.cpp | 1 + indra/llcommon/llprocess.h | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index bd08c3ab51..d4786035ce 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -163,6 +163,7 @@ public: } virtual std::ostream& get_ostream() { return mStream; } + virtual size_type size() const { return mStreambuf.size(); } bool tick(const LLSD&) { diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 06ada83698..51010966f9 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -340,6 +340,20 @@ public: typedef std::size_t size_type; static const size_type npos; + + /** + * Get accumulated buffer length. + * + * For WritePipe, is there still pending data to send to child? + * + * For ReadPipe, we often need to refrain from actually reading the + * std::istream returned by get_istream() until we've accumulated + * enough data to make it worthwhile. For instance, if we're expecting + * a number from the child, but the child happens to flush "12" before + * emitting "3\n", get_istream() >> myint could return 12 rather than + * 123! + */ + virtual size_type size() const = 0; }; /// As returned by getWritePipe() or getOptWritePipe() @@ -387,16 +401,6 @@ public: */ virtual std::string read(size_type len) = 0; - /** - * Get accumulated buffer length. - * Often we need to refrain from actually reading the std::istream - * returned by get_istream() until we've accumulated enough data to - * make it worthwhile. For instance, if we're expecting a number from - * the child, but the child happens to flush "12" before emitting - * "3\n", get_istream() >> myint could return 12 rather than 123! - */ - virtual size_type size() const = 0; - /** * Peek at accumulated buffer data without consuming it. Optional * parameters give you substr() functionality. -- cgit v1.2.3 From cf39274b640e983a5fcc2d03e4c47947a2b36732 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 15 Mar 2012 23:35:19 -0400 Subject: Make LLLeap intercept LL_ERRS termination and notify LEAP plugin. Have to pump "mainloop" a few times to flush the buffer to the pipe, a potentially risky strategy: we have to trust that whatever condition led to the LL_ERRS fatal error didn't break anything that listens on "mainloop". But the worst that could happen is that the plugin won't be notified -- just as if we didn't try in the first place. In other words, no harm in trying. --- indra/llcommon/llleap.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 034c809330..07880bd818 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -29,12 +29,15 @@ #include "stringize.h" #include "llsdutil.h" #include "llsdserialize.h" +#include "llerrorcontrol.h" +#include "lltimer.h" LLLeap::LLLeap() {} LLLeap::~LLLeap() {} class LLLeapImpl: public LLLeap { + LOG_CLASS(LLLeap); public: // Called only by LLLeap::create() LLLeapImpl(const std::string& desc, const std::vector& plugin): @@ -48,7 +51,8 @@ public: // Try to make that more difficult by generating a UUID for the reply- // pump name -- so it should NOT need tweaking for uniqueness. mReplyPump(LLUUID::generateNewID().asString()), - mExpect(0) + mExpect(0), + mPrevFatalFunction(LLError::getFatalFunction()) { // Rule out empty vector if (plugin.empty()) @@ -135,6 +139,9 @@ public: mStderrConnection = childerr.getPump() .listen("LLLeap", boost::bind(&LLLeapImpl::rstderr, this, _1)); + // For our lifespan, intercept any LL_ERRS so we can notify plugin + LLError::setFatalFunction(boost::bind(&LLLeapImpl::fatalFunction, this, _1)); + // Send child a preliminary event reporting our own reply-pump name -- // which would otherwise be pretty tricky to guess! // TODO TODO inject name of command pump here. @@ -150,6 +157,8 @@ public: virtual ~LLLeapImpl() { LL_DEBUGS("LLLeap") << "destroying LLLeap(\"" << mDesc << "\")" << LL_ENDL; + // Restore original FatalFunction + LLError::setFatalFunction(mPrevFatalFunction); } // Listener for failed launch attempt @@ -363,6 +372,30 @@ public: return false; } + void fatalFunction(const std::string& error) + { + // Notify plugin + LLSD event; + event["type"] = "error"; + event["error"] = error; + mReplyPump.post(event); + + // All the above really accomplished was to buffer the serialized + // event in our WritePipe. Have to pump mainloop a couple times to + // really write it out there... but time out in case we can't write. + LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN)); + LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); + LLSD nop; + F64 until(LLTimer::getElapsedSeconds() + 2); + while (childin.size() && LLTimer::getElapsedSeconds() < until) + { + mainloop.post(nop); + } + + // forward the call to the previous FatalFunction + mPrevFatalFunction(error); + } + private: std::string mDesc; LLEventStream mDonePump; @@ -372,6 +405,7 @@ private: mStdinConnection, mStdoutConnection, mStdoutDataConnection, mStderrConnection; boost::scoped_ptr mBlocker; LLProcess::ReadPipe::size_type mExpect; + LLError::FatalFunction mPrevFatalFunction; }; // This must follow the declaration of LLLeapImpl, so it may as well be last. -- cgit v1.2.3 From 0c8fac147d2baed8d8ef0e8c9bdcc47cb3082854 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 16 Mar 2012 15:34:21 -0400 Subject: Introduce LLLeapListener, associating one with each LLLeap object. Every LEAP plugin gets its own LLLeapListener, managing its own collection of listeners to various LLEventPumps. LLLeapListener's command LLEventPump now has a UUID for a name, both for uniqueness and to make it tough for a plugin to mess with any other. --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llleap.cpp | 38 +++-- indra/llcommon/llleaplistener.cpp | 287 ++++++++++++++++++++++++++++++++++++++ indra/llcommon/llleaplistener.h | 73 ++++++++++ 4 files changed, 391 insertions(+), 9 deletions(-) create mode 100644 indra/llcommon/llleaplistener.cpp create mode 100644 indra/llcommon/llleaplistener.h diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 47a8aa96aa..eec5250a23 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -64,6 +64,7 @@ set(llcommon_SOURCE_FILES llinitparam.cpp llinstancetracker.cpp llleap.cpp + llleaplistener.cpp llliveappconfig.cpp lllivefile.cpp lllog.cpp @@ -182,6 +183,7 @@ set(llcommon_HEADER_FILES llkeythrottle.h lllazy.h llleap.h + llleaplistener.h lllistenerwrapper.h lllinkedqueue.h llliveappconfig.h diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 07880bd818..0a57ef1c48 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -31,6 +31,12 @@ #include "llsdserialize.h" #include "llerrorcontrol.h" #include "lltimer.h" +#include "lluuid.h" +#include "llleaplistener.h" + +#if LL_MSVC +#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally +#endif LLLeap::LLLeap() {} LLLeap::~LLLeap() {} @@ -52,7 +58,13 @@ public: // pump name -- so it should NOT need tweaking for uniqueness. mReplyPump(LLUUID::generateNewID().asString()), mExpect(0), - mPrevFatalFunction(LLError::getFatalFunction()) + mPrevFatalFunction(LLError::getFatalFunction()), + // Instantiate a distinct LLLeapListener for this plugin. (Every + // plugin will want its own collection of managed listeners, etc.) + // Pass it a callback to our connect() method, so it can send events + // from a particular LLEventPump to the plugin without having to know + // this class or method name. + mListener(new LLLeapListener(boost::bind(&LLLeapImpl::connect, this, _1, _2))) { // Rule out empty vector if (plugin.empty()) @@ -115,11 +127,8 @@ public: childout.setLimit(20); childerr.setLimit(20); - // Serialize any event received on mReplyPump to our child's stdin, - // suitably enriched with the pump name on which it was received. - mStdinConnection = mReplyPump - .listen("LLLeap", - boost::bind(&LLLeapImpl::wstdin, this, mReplyPump.getName(), _1)); + // Serialize any event received on mReplyPump to our child's stdin. + mStdinConnection = connect(mReplyPump, "LLLeap"); // Listening on stdout is stateful. In general, we're either waiting // for the length prefix or waiting for the specified length of data. @@ -144,13 +153,12 @@ public: // Send child a preliminary event reporting our own reply-pump name -- // which would otherwise be pretty tricky to guess! -// TODO TODO inject name of command pump here. wstdin(mReplyPump.getName(), LLSDMap - ("command", LLSD()) + ("command", mListener->getName()) // Include LLLeap features -- this may be important for child to // construct (or recognize) current protocol. - ("features", LLSD::emptyMap())); + ("features", LLLeapListener::getFeatures())); } // Normally we'd expect to arrive here only via done() @@ -397,6 +405,17 @@ public: } private: + /// We always want to listen on mReplyPump with wstdin(); under some + /// circumstances we'll also echo other LLEventPumps to the plugin. + LLBoundListener connect(LLEventPump& pump, const std::string& listener) + { + // Serialize any event received on the specified LLEventPump to our + // child's stdin, suitably enriched with the pump name on which it was + // received. + return pump.listen(listener, + boost::bind(&LLLeapImpl::wstdin, this, pump.getName(), _1)); + } + std::string mDesc; LLEventStream mDonePump; LLEventStream mReplyPump; @@ -406,6 +425,7 @@ private: boost::scoped_ptr mBlocker; LLProcess::ReadPipe::size_type mExpect; LLError::FatalFunction mPrevFatalFunction; + boost::scoped_ptr mListener; }; // This must follow the declaration of LLLeapImpl, so it may as well be last. diff --git a/indra/llcommon/llleaplistener.cpp b/indra/llcommon/llleaplistener.cpp new file mode 100644 index 0000000000..fa5730f112 --- /dev/null +++ b/indra/llcommon/llleaplistener.cpp @@ -0,0 +1,287 @@ +/** + * @file llleaplistener.cpp + * @author Nat Goodspeed + * @date 2012-03-16 + * @brief Implementation for llleaplistener. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llleaplistener.h" +// STL headers +// std headers +// external library headers +#include +// other Linden headers +#include "lluuid.h" +#include "llsdutil.h" +#include "stringize.h" + +/***************************************************************************** +* LEAP FEATURE STRINGS +*****************************************************************************/ +/** + * Implement "getFeatures" command. The LLSD map thus obtained is intended to + * be machine-readable (read: easily-parsed, if parsing be necessary) and to + * highlight the differences between this version of the LEAP protocol and + * the baseline version. A client may thus determine whether or not the + * running viewer supports some recent feature of interest. + * + * This method is defined at the top of this implementation file so it's easy + * to find, easy to spot, easy to update as we enhance the LEAP protocol. + */ +/*static*/ LLSD LLLeapListener::getFeatures() +{ + static LLSD features; + if (features.isUndefined()) + { + features = LLSD::emptyMap(); + + // This initial implementation IS the baseline LEAP protocol; thus the + // set of differences is empty; thus features is initially empty. +// features["featurename"] = "value"; + } + + return features; +} + +LLLeapListener::LLLeapListener(const ConnectFunc& connect): + // Each LEAP plugin has an instance of this listener. Make the command + // pump name difficult for other such plugins to guess. + LLEventAPI(LLUUID::generateNewID().asString(), + "Operations relating to the LLSD Event API Plugin (LEAP) protocol"), + mConnect(connect) +{ + LLSD need_name(LLSDMap("name", LLSD())); + add("newpump", + "Instantiate a new LLEventPump named like [\"name\"] and listen to it.\n" + "If [\"type\"] == \"LLEventQueue\", make LLEventQueue, else LLEventStream.\n" + "Events sent through new LLEventPump will be decorated with [\"pump\"]=name.\n" + "Returns actual name in [\"name\"] (may be different if collision).", + &LLLeapListener::newpump, + need_name); + add("killpump", + "Delete LLEventPump [\"name\"] created by \"newpump\".\n" + "Returns [\"status\"] boolean indicating whether such a pump existed.", + &LLLeapListener::killpump, + need_name); + LLSD need_source_listener(LLSDMap("source", LLSD())("listener", LLSD())); + add("listen", + "Listen to an existing LLEventPump named [\"source\"], with listener name\n" + "[\"listener\"].\n" + "By default, send events on [\"source\"] to the plugin, decorated\n" + "with [\"pump\"]=[\"source\"].\n" + "If [\"dest\"] specified, send undecorated events on [\"source\"] to the\n" + "LLEventPump named [\"dest\"].\n" + "Returns [\"status\"] boolean indicating whether the connection was made.", + &LLLeapListener::listen, + need_source_listener); + add("stoplistening", + "Disconnect a connection previously established by \"listen\".\n" + "Pass same [\"source\"] and [\"listener\"] arguments.\n" + "Returns [\"status\"] boolean indicating whether such a listener existed.", + &LLLeapListener::stoplistening, + need_source_listener); + add("ping", + "No arguments, just a round-trip sanity check.", + &LLLeapListener::ping); + add("getAPIs", + "Enumerate all LLEventAPI instances by name and description.", + &LLLeapListener::getAPIs); + add("getAPI", + "Get name, description, dispatch key and operations for LLEventAPI [\"api\"].", + &LLLeapListener::getAPI, + LLSD().with("api", LLSD())); + add("getFeatures", + "Return an LLSD map of feature strings (deltas from baseline LEAP protocol)", + static_cast(&LLLeapListener::getFeatures)); + add("getFeature", + "Return the feature value with key [\"feature\"]", + &LLLeapListener::getFeature, + LLSD().with("feature", LLSD())); +} + +LLLeapListener::~LLLeapListener() +{ + // We'd have stored a map of LLTempBoundListener instances, save that the + // operation of inserting into a std::map necessarily copies the + // value_type, and Bad Things would happen if you copied an + // LLTempBoundListener. (Destruction of the original would disconnect the + // listener, invalidating every stored connection.) + BOOST_FOREACH(ListenersMap::value_type& pair, mListeners) + { + pair.second.disconnect(); + } +} + +void LLLeapListener::newpump(const LLSD& request) +{ + Response reply(LLSD(), request); + + std::string name = request["name"]; + LLSD const & type = request["type"]; + + LLEventPump * new_pump = NULL; + if (type.asString() == "LLEventQueue") + { + new_pump = new LLEventQueue(name, true); // tweak name for uniqueness + } + else + { + if (! (type.isUndefined() || type.asString() == "LLEventStream")) + { + reply.warn(STRINGIZE("unknown 'type' " << type << ", using LLEventStream")); + } + new_pump = new LLEventStream(name, true); // tweak name for uniqueness + } + + name = new_pump->getName(); + + mEventPumps.insert(name, new_pump); + + // Now listen on this new pump with our plugin listener + std::string myname("llleap"); + saveListener(name, myname, mConnect(*new_pump, myname)); + + reply["name"] = name; +} + +void LLLeapListener::killpump(const LLSD& request) +{ + Response reply(LLSD(), request); + + std::string name = request["name"]; + // success == (nonzero number of entries were erased) + reply["status"] = bool(mEventPumps.erase(name)); +} + +void LLLeapListener::listen(const LLSD& request) +{ + Response reply(LLSD(), request); + + std::string source_name = request["source"]; + std::string dest_name = request["dest"]; + std::string listener_name = request["listener"]; + + LLEventPump & source = LLEventPumps::instance().obtain(source_name); + + reply["status"] = false; + if (mListeners.find(ListenersMap::key_type(source_name, listener_name)) == mListeners.end()) + { + try + { + if (request["dest"].isDefined()) + { + // If we're asked to connect the "source" pump to a + // specific "dest" pump, find dest pump and connect it. + LLEventPump & dest = LLEventPumps::instance().obtain(dest_name); + saveListener(source_name, listener_name, + source.listen(listener_name, + boost::bind(&LLEventPump::post, &dest, _1))); + } + else + { + // "dest" unspecified means to direct events on "source" + // to our plugin listener. + saveListener(source_name, listener_name, mConnect(source, listener_name)); + } + reply["status"] = true; + } + catch (const LLEventPump::DupListenerName &) + { + // pass - status already set to false + } + } +} + +void LLLeapListener::stoplistening(const LLSD& request) +{ + Response reply(LLSD(), request); + + std::string source_name = request["source"]; + std::string listener_name = request["listener"]; + + ListenersMap::iterator finder = + mListeners.find(ListenersMap::key_type(source_name, listener_name)); + + reply["status"] = false; + if(finder != mListeners.end()) + { + reply["status"] = true; + finder->second.disconnect(); + mListeners.erase(finder); + } +} + +void LLLeapListener::ping(const LLSD& request) const +{ + // do nothing, default reply suffices + Response(LLSD(), request); +} + +void LLLeapListener::getAPIs(const LLSD& request) const +{ + Response reply(LLSD(), request); + + for (LLEventAPI::instance_iter eai(LLEventAPI::beginInstances()), + eaend(LLEventAPI::endInstances()); + eai != eaend; ++eai) + { + LLSD info; + info["desc"] = eai->getDesc(); + reply[eai->getName()] = info; + } +} + +void LLLeapListener::getAPI(const LLSD& request) const +{ + Response reply(LLSD(), request); + + LLEventAPI* found = LLEventAPI::getInstance(request["api"]); + if (found) + { + reply["name"] = found->getName(); + reply["desc"] = found->getDesc(); + reply["key"] = found->getDispatchKey(); + LLSD ops; + for (LLEventAPI::const_iterator oi(found->begin()), oend(found->end()); + oi != oend; ++oi) + { + ops.append(found->getMetadata(oi->first)); + } + reply["ops"] = ops; + } +} + +void LLLeapListener::getFeatures(const LLSD& request) const +{ + // Merely constructing and destroying a Response object suffices here. + // Giving it a name would only produce fatal 'unreferenced variable' + // warnings. + Response(getFeatures(), request); +} + +void LLLeapListener::getFeature(const LLSD& request) const +{ + Response reply(LLSD(), request); + + LLSD::String feature_name(request["feature"]); + LLSD features(getFeatures()); + if (features[feature_name].isDefined()) + { + reply["feature"] = features[feature_name]; + } +} + +void LLLeapListener::saveListener(const std::string& pump_name, + const std::string& listener_name, + const LLBoundListener& listener) +{ + mListeners.insert(ListenersMap::value_type(ListenersMap::key_type(pump_name, listener_name), + listener)); +} diff --git a/indra/llcommon/llleaplistener.h b/indra/llcommon/llleaplistener.h new file mode 100644 index 0000000000..2193d81b9e --- /dev/null +++ b/indra/llcommon/llleaplistener.h @@ -0,0 +1,73 @@ +/** + * @file llleaplistener.h + * @author Nat Goodspeed + * @date 2012-03-16 + * @brief LLEventAPI supporting LEAP plugins + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLLEAPLISTENER_H) +#define LL_LLLEAPLISTENER_H + +#include "lleventapi.h" +#include +#include +#include +#include + +/// Listener class implementing LLLeap query/control operations. +/// See https://jira.lindenlab.com/jira/browse/DEV-31978. +class LLLeapListener: public LLEventAPI +{ +public: + /** + * Decouple LLLeap by dependency injection. Certain LLLeapListener + * operations must be able to cause LLLeap to listen on a specified + * LLEventPump with the LLLeap listener that wraps incoming events in an + * outer (pump=, data=) map and forwards them to the plugin. Very well, + * define the signature for a function that will perform that, and make + * our constructor accept such a function. + */ + typedef boost::function + ConnectFunc; + LLLeapListener(const ConnectFunc& connect); + ~LLLeapListener(); + + static LLSD getFeatures(); + +private: + void newpump(const LLSD&); + void killpump(const LLSD&); + void listen(const LLSD&); + void stoplistening(const LLSD&); + void ping(const LLSD&) const; + void getAPIs(const LLSD&) const; + void getAPI(const LLSD&) const; + void getFeatures(const LLSD&) const; + void getFeature(const LLSD&) const; + + void saveListener(const std::string& pump_name, const std::string& listener_name, + const LLBoundListener& listener); + + ConnectFunc mConnect; + + // In theory, listen() could simply call the relevant LLEventPump's + // listen() method, stoplistening() likewise. Lifespan issues make us + // capture the LLBoundListener objects: when this object goes away, all + // those listeners should be disconnected. But what if the client listens, + // stops, listens again on the same LLEventPump with the same listener + // name? Merely collecting LLBoundListeners wouldn't adequately track + // that. So capture the latest LLBoundListener for this LLEventPump name + // and listener name. + typedef std::map, LLBoundListener> ListenersMap; + ListenersMap mListeners; + // Similar lifespan reasoning applies to LLEventPumps instantiated by + // newpump() operations. + typedef boost::ptr_map EventPumpsMap; + EventPumpsMap mEventPumps; +}; + +#endif /* ! defined(LL_LLLEAPLISTENER_H) */ -- cgit v1.2.3 From 9d9ad9a876d6498a89f9aeefc9bf258e1674dae7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 20 Mar 2012 14:23:00 -0400 Subject: Tighten Linux treatment of command-line args to 'secondlife' script. New --leap switch takes a quoted command line likely to contain spaces. Sloppy handling of quoted arguments definitely gets us into trouble. Fix that. --- indra/newview/linux_tools/wrapper.sh | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 283a28a0aa..90771f1174 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -110,22 +110,22 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" # fi #fi -export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}"' -export SL_CMD='$LL_WRAPPER bin/do-not-directly-run-secondlife-bin' -export SL_OPT="`cat etc/gridargs.dat` $@" +export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}" -# Run the program -eval ${SL_ENV} ${SL_CMD} ${SL_OPT} || LL_RUN_ERR=runerr +# Run the program. +# Don't quote $LL_WRAPPER because, if empty, it should simply vanish from the +# command line. Similar remarks about the contents of gridargs.dat. But DO +# quote "$@": preserve separate args as individually quoted. +$LL_WRAPPER bin/do-not-directly-run-secondlife-bin $( Date: Wed, 21 Mar 2012 12:14:36 -0400 Subject: Added tag 3.3.0-release for changeset 5e8d2662f38a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0702c4ee14..af25a37191 100644 --- a/.hgtags +++ b/.hgtags @@ -274,3 +274,4 @@ a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2 d5f263687f43f278107363365938f0a214920a4b DRTVWR-119 d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1 5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate +5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release -- cgit v1.2.3 From 1e10e1c625035b4bd237dd1439491c39ef44e934 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 21 Mar 2012 15:14:43 -0400 Subject: Revert llversionviewer.h to current viewer-release. At various points along the way, before the process changed, we merged up to viewer-development. One of those must have picked up an llversionviewer.h change to viewer version 3.3.1.0. We have no intention of twiddling llversionviewer.h in this repo -- reset so merging into viewer-release doesn't bump its version number. --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 26ff1b5c55..a869c74189 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 3; -const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 8815cfa5c916ac454cfa5b6f22f9ce312b00a846 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 23 Mar 2012 15:53:44 -0400 Subject: Rename In[Esc]String helper-class data members, per code review. --- indra/llcommon/llstring.h | 92 +++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 5085d32f7f..09733e8e2a 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -745,23 +745,23 @@ struct InString typedef typename string_type::const_iterator const_iterator; InString(const_iterator b, const_iterator e): - iter(b), - end(e) + mIter(b), + mEnd(e) {} virtual ~InString() {} - bool done() const { return iter == end; } - /// Is the current character (*iter) escaped? This implementation can + bool done() const { return mIter == mEnd; } + /// Is the current character (*mIter) escaped? This implementation can /// answer trivially because it doesn't support escapes. virtual bool escaped() const { return false; } - /// Obtain the current character and advance @c iter. - virtual T next() { return *iter++; } + /// Obtain the current character and advance @c mIter. + virtual T next() { return *mIter++; } /// Does the current character match specified character? - virtual bool is(T ch) const { return (! done()) && *iter == ch; } + virtual bool is(T ch) const { return (! done()) && *mIter == ch; } /// Is the current character any one of the specified characters? virtual bool oneof(const string_type& delims) const { - return (! done()) && LLStringUtilBase::contains(delims, *iter); + return (! done()) && LLStringUtilBase::contains(delims, *mIter); } /** @@ -769,10 +769,10 @@ struct InString * useful for processing quoted substrings. * * If we do see @a delim, append everything from @from until (excluding) - * @a delim to @a into, advance @c iter to skip @a delim, and return @c + * @a delim to @a into, advance @c mIter to skip @a delim, and return @c * true. * - * If we do not see @a delim, do not alter @a into or @c iter and return + * If we do not see @a delim, do not alter @a into or @c mIter and return * @c false. Do not pass GO, do not collect $200. * * @note The @c false case described above implements normal getTokens() @@ -785,18 +785,18 @@ struct InString */ virtual bool collect_until(string_type& into, const_iterator from, T delim) { - const_iterator found = std::find(from, end, delim); + const_iterator found = std::find(from, mEnd, delim); // If we didn't find delim, change nothing, just tell caller. - if (found == end) + if (found == mEnd) return false; // Found delim! Append everything between from and found. into.append(from, found); // advance past delim in input - iter = found + 1; + mIter = found + 1; return true; } - const_iterator iter, end; + const_iterator mIter, mEnd; }; /// InString subclass that handles escape characters @@ -808,33 +808,33 @@ public: typedef typename super::string_type string_type; typedef typename super::const_iterator const_iterator; using super::done; - using super::iter; - using super::end; + using super::mIter; + using super::mEnd; - InEscString(const_iterator b, const_iterator e, const string_type& escapes_): + InEscString(const_iterator b, const_iterator e, const string_type& escapes): super(b, e), - escapes(escapes_) + mEscapes(escapes) { - // Even though we've already initialized 'iter' via our base-class + // Even though we've already initialized 'mIter' via our base-class // constructor, set it again to check for initial escape char. setiter(b); } /// This implementation uses the answer cached by setiter(). - virtual bool escaped() const { return isesc; } + virtual bool escaped() const { return mIsEsc; } virtual T next() { // If we're looking at the escape character of an escape sequence, - // skip that character. This is the one time we can modify 'iter' + // skip that character. This is the one time we can modify 'mIter' // without using setiter: for this one case we DO NOT CARE if the // escaped character is itself an escape. - if (isesc) - ++iter; + if (mIsEsc) + ++mIter; // If we were looking at an escape character, this is the escaped // character; otherwise it's just the next character. - T result(*iter); - // Advance iter, checking for escape sequence. - setiter(iter + 1); + T result(*mIter); + // Advance mIter, checking for escape sequence. + setiter(mIter + 1); return result; } @@ -842,14 +842,14 @@ public: { // Like base-class is(), except that an escaped character matches // nothing. - return (! done()) && (! isesc) && *iter == ch; + return (! done()) && (! mIsEsc) && *mIter == ch; } virtual bool oneof(const string_type& delims) const { // Like base-class oneof(), except that an escaped character matches // nothing. - return (! done()) && (! isesc) && LLStringUtilBase::contains(delims, *iter); + return (! done()) && (! mIsEsc) && LLStringUtilBase::contains(delims, *mIter); } virtual bool collect_until(string_type& into, const_iterator from, T delim) @@ -860,27 +860,27 @@ public: // directly appending to 'into' in case we do not find delim, in which // case we're supposed to leave 'into' unmodified. string_type collected; - // For scanning purposes, we're going to work directly with 'iter'. + // For scanning purposes, we're going to work directly with 'mIter'. // Save its current value in case we fail to see delim. - const_iterator save_iter(iter); - // Okay, set 'iter', checking for escape. + const_iterator save_iter(mIter); + // Okay, set 'mIter', checking for escape. setiter(from); while (! done()) { // If we see an unescaped delim, stop and report success. - if ((! isesc) && *iter == delim) + if ((! mIsEsc) && *mIter == delim) { // Append collected chars to 'into'. into.append(collected); - // Don't forget to advance 'iter' past delim. - setiter(iter + 1); + // Don't forget to advance 'mIter' past delim. + setiter(mIter + 1); return true; } // We're not at end, and either we're not looking at delim or it's // escaped. Collect this character and keep going. collected.push_back(next()); } - // Here we hit 'end' without ever seeing delim. Restore iter and tell + // Here we hit 'mEnd' without ever seeing delim. Restore mIter and tell // caller. setiter(save_iter); return false; @@ -889,24 +889,24 @@ public: private: void setiter(const_iterator i) { - iter = i; + mIter = i; - // Every time we change 'iter', set 'isesc' to be able to repetitively - // answer escaped() without having to rescan 'escapes'. isesc caches - // contains(escapes, *iter). + // Every time we change 'mIter', set 'mIsEsc' to be able to repetitively + // answer escaped() without having to rescan 'mEscapes'. mIsEsc caches + // contains(mEscapes, *mIter). // We're looking at an escaped char if we're not already at end (that - // is, *iter is even meaningful); if *iter is in fact one of the + // is, *mIter is even meaningful); if *mIter is in fact one of the // specified escape characters; and if there's one more character // following it. That is, if an escape character is the very last // character of the input string, it loses its special meaning. - isesc = (! done()) && - LLStringUtilBase::contains(escapes, *iter) && - (iter+1) != end; + mIsEsc = (! done()) && + LLStringUtilBase::contains(mEscapes, *mIter) && + (mIter+1) != mEnd; } - const string_type escapes; - bool isesc; + const string_type mEscapes; + bool mIsEsc; }; /// getTokens() implementation based on InString concept @@ -957,7 +957,7 @@ void getTokens(INSTRING& instr, std::vector& tokens, // If we're looking at an open quote, search forward for // a close quote, collecting characters along the way. if (instr.oneof(quotes) && - instr.collect_until(tokens.back(), instr.iter+1, *instr.iter)) + instr.collect_until(tokens.back(), instr.mIter+1, *instr.mIter)) { // collect_until is cleverly designed to do exactly what we // need here. No further action needed if it returns true. -- cgit v1.2.3 From 51018f38a25bb9d43775ccd8702525a6f16186fa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 29 Mar 2012 09:53:53 -0400 Subject: IQA-463: fix Linux wrapper.sh (aka secondlife) gridargs.dat handling. Previous change to wrapper.sh naively read $( Date: Wed, 11 Apr 2012 11:01:00 -0400 Subject: Fix Linux UI issues introduced by moving llinitparam to llcommon. In a number of places, the viewer uses a lookup based on std::type_info*. We used to use std::map. But on Linux, &typeid(SomeType) can produce different pointer values, depending on the dynamic load module in which the code is executed. Introduce LLTypeInfoLookup, with an API that deliberately mimics std::map. LLTypeInfoLookup::find() first tries an efficient search for the specified std::type_info*. But if that fails, it scans the underlying container for a match on the std::type_info::name() string. If found, it caches the new std::type_info* to optimize subsequent lookups with the same pointer. Use LLTypeInfoLookup instead of std::map in llinitparam.h and llregistry.h. Introduce LLSortedVector, a std::vector> maintained in sorted order with binary-search lookup. It presents a subset of the std::map API. --- indra/linux_updater/CMakeLists.txt | 6 +- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llinitparam.h | 7 +- indra/llcommon/llregistry.h | 21 ++++- indra/llcommon/llsortedvector.h | 152 +++++++++++++++++++++++++++++++++++++ indra/llcommon/lltypeinfolookup.h | 112 +++++++++++++++++++++++++++ 6 files changed, 293 insertions(+), 7 deletions(-) create mode 100644 indra/llcommon/llsortedvector.h create mode 100644 indra/llcommon/lltypeinfolookup.h diff --git a/indra/linux_updater/CMakeLists.txt b/indra/linux_updater/CMakeLists.txt index 00a78b2a8f..4377a6333c 100644 --- a/indra/linux_updater/CMakeLists.txt +++ b/indra/linux_updater/CMakeLists.txt @@ -10,14 +10,14 @@ include(UI) include(LLCommon) include(LLVFS) include(LLXML) -include(LLXUIXML) +include(LLUI) include(Linking) include_directories( ${LLCOMMON_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} - ${LLXUIXML_INCLUDE_DIRS} + ${LLUI_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${CARES_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} @@ -42,7 +42,7 @@ target_link_libraries(linux-updater ${CRYPTO_LIBRARIES} ${UI_LIBRARIES} ${LLXML_LIBRARIES} - ${LLXUIXML_LIBRARIES} + ${LLUI_LIBRARIES} ${LLVFS_LIBRARIES} ${LLCOMMON_LIBRARIES} ) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index a1aa887d3a..f9bc22e98a 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -221,6 +221,7 @@ set(llcommon_HEADER_FILES llsingleton.h llskiplist.h llskipmap.h + llsortedvector.h llstack.h llstacktrace.h llstat.h @@ -235,6 +236,7 @@ set(llcommon_HEADER_FILES llthreadsafequeue.h lltimer.h lltreeiterators.h + lltypeinfolookup.h lluri.h lluuid.h lluuidhashmap.h diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index beaf07e56b..ef6c6335d1 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -35,6 +35,7 @@ #include #include "llerror.h" +#include "lltypeinfolookup.h" namespace LLInitParam { @@ -227,9 +228,9 @@ namespace LLInitParam typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); typedef boost::function parser_inspect_func_t; - typedef std::map parser_read_func_map_t; - typedef std::map parser_write_func_map_t; - typedef std::map parser_inspect_func_map_t; + typedef LLTypeInfoLookup parser_read_func_map_t; + typedef LLTypeInfoLookup parser_write_func_map_t; + typedef LLTypeInfoLookup parser_inspect_func_map_t; Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index 36ce6a97b7..36d7f7a44c 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -31,6 +31,7 @@ #include #include "llsingleton.h" +#include "lltypeinfolookup.h" template class LLRegistryDefaultComparator @@ -38,6 +39,24 @@ class LLRegistryDefaultComparator bool operator()(const T& lhs, const T& rhs) { return lhs < rhs; } }; +template +struct LLRegistryMapSelector +{ + typedef std::map type; +}; + +template +struct LLRegistryMapSelector +{ + typedef LLTypeInfoLookup type; +}; + +template +struct LLRegistryMapSelector +{ + typedef LLTypeInfoLookup type; +}; + template > class LLRegistry { @@ -53,7 +72,7 @@ public: { friend class LLRegistry; public: - typedef typename std::map registry_map_t; + typedef typename LLRegistryMapSelector::type registry_map_t; bool add(ref_const_key_t key, ref_const_value_t value) { diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h new file mode 100644 index 0000000000..391b82ee44 --- /dev/null +++ b/indra/llcommon/llsortedvector.h @@ -0,0 +1,152 @@ +/** + * @file llsortedvector.h + * @author Nat Goodspeed + * @date 2012-04-08 + * @brief LLSortedVector class wraps a vector that we maintain in sorted + * order so we can perform binary-search lookups. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLSORTEDVECTOR_H) +#define LL_LLSORTEDVECTOR_H + +#include +#include + +/** + * LLSortedVector contains a std::vector that we keep sorted on the + * first of the pair. This makes insertion somewhat more expensive than simple + * std::vector::push_back(), but allows us to use binary search for lookups. + * It's intended for small aggregates where lookup is far more performance- + * critical than insertion; in such cases a binary search on a small, sorted + * std::vector can be more performant than a std::map lookup. + */ +template +class LLSortedVector +{ +public: + typedef LLSortedVector self; + typedef KEY key_type; + typedef VALUE mapped_type; + typedef std::pair value_type; + typedef std::vector PairVector; + typedef typename PairVector::iterator iterator; + typedef typename PairVector::const_iterator const_iterator; + + /// Empty + LLSortedVector() {} + + /// Fixed initial size + LLSortedVector(std::size_t size): + mVector(size) + {} + + /// Bulk load + template + LLSortedVector(ITER begin, ITER end): + mVector(begin, end) + { + // Allow caller to dump in a bunch of (pairs convertible to) + // value_type if desired, but make sure we sort afterwards. + std::sort(mVector.begin(), mVector.end()); + } + + /// insert(key, value) + std::pair insert(const key_type& key, const mapped_type& value) + { + return insert(value_type(key, value)); + } + + /// insert(value_type) + std::pair insert(const value_type& pair) + { + typedef std::pair iterbool; + iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair, + less()); + // have to check for end() before it's even valid to dereference + if (found == mVector.end()) + { + std::size_t index(mVector.size()); + mVector.push_back(pair); + // don't forget that push_back() invalidates 'found' + return iterbool(mVector.begin() + index, true); + } + if (found->first == pair.first) + { + return iterbool(found, false); + } + // remember that insert() invalidates 'found' -- save index + std::size_t index(found - mVector.begin()); + mVector.insert(found, pair); + // okay, convert from index back to iterator + return iterbool(mVector.begin() + index, true); + } + + iterator begin() { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator begin() const { return mVector.begin(); } + const_iterator end() const { return mVector.end(); } + + bool empty() const { return mVector.empty(); } + std::size_t size() const { return mVector.size(); } + + /// find + iterator find(const key_type& key) + { + iterator found = std::lower_bound(mVector.begin(), mVector.end(), + value_type(key, mapped_type()), + less()); + if (found == mVector.end() || found->first != key) + return mVector.end(); + return found; + } + + const_iterator find(const key_type& key) const + { + return const_cast(this)->find(key); + } + +private: + // Define our own 'less' comparator so we can specialize without messing + // with std::less. + template + struct less: public std::less {}; + + // Specialize 'less' for an LLSortedVector::value_type involving + // std::type_info*. This is one of LLSortedVector's foremost use cases. We + // specialize 'less' rather than just defining a specific comparator + // because LLSortedVector should be usable for other key_types as well. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + // Same as above, but with const std::type_info*. + template + struct less< std::pair >: + public std::binary_function, + std::pair, + bool> + { + bool operator()(const std::pair& lhs, + const std::pair& rhs) const + { + return lhs.first->before(*rhs.first); + } + }; + + PairVector mVector; +}; + +#endif /* ! defined(LL_LLSORTEDVECTOR_H) */ diff --git a/indra/llcommon/lltypeinfolookup.h b/indra/llcommon/lltypeinfolookup.h new file mode 100644 index 0000000000..fc99f7ff33 --- /dev/null +++ b/indra/llcommon/lltypeinfolookup.h @@ -0,0 +1,112 @@ +/** + * @file lltypeinfolookup.h + * @author Nat Goodspeed + * @date 2012-04-08 + * @brief Template data structure like std::map + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLTYPEINFOLOOKUP_H) +#define LL_LLTYPEINFOLOOKUP_H + +#include "llsortedvector.h" +#include + +/** + * LLTypeInfoLookup is specifically designed for use cases for which you might + * consider std::map. We have several such data + * structures in the viewer. The trouble with them is that at least on Linux, + * you can't rely on always getting the same std::type_info* for a given type: + * different load modules will produce different std::type_info*. + * LLTypeInfoLookup contains a workaround to address this issue. + * + * Specifically, when we don't find the passed std::type_info*, + * LLTypeInfoLookup performs a linear search over registered entries to + * compare name() strings. Presuming that this succeeds, we cache the new + * (previously unrecognized) std::type_info* to speed future lookups. + * + * This worst-case fallback search (linear search with string comparison) + * should only happen the first time we look up a given type from a particular + * load module other than the one from which we initially registered types. + * (However, a lookup which wouldn't succeed anyway will always have + * worst-case performance.) This class is probably best used with less than a + * few dozen different types. + */ +template +class LLTypeInfoLookup +{ +public: + typedef LLTypeInfoLookup self; + typedef LLSortedVector vector_type; + typedef typename vector_type::key_type key_type; + typedef typename vector_type::mapped_type mapped_type; + typedef typename vector_type::value_type value_type; + typedef typename vector_type::iterator iterator; + typedef typename vector_type::const_iterator const_iterator; + + LLTypeInfoLookup() {} + + iterator begin() { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator begin() const { return mVector.begin(); } + const_iterator end() const { return mVector.end(); } + bool empty() const { return mVector.empty(); } + std::size_t size() const { return mVector.size(); } + + std::pair insert(const std::type_info* key, const VALUE& value) + { + return insert(value_type(key, value)); + } + + std::pair insert(const value_type& pair) + { + return mVector.insert(pair); + } + + const_iterator find(const std::type_info* key) const + { + return const_cast(this)->find(key); + } + + iterator find(const std::type_info* key) + { + iterator found = mVector.find(key); + if (found != mVector.end()) + { + // If LLSortedVector::find() found, great, we're done. + return found; + } + // Here we didn't find the passed type_info*. On Linux, though, even + // for the same type, typeid(sametype) produces a different type_info* + // when used in different load modules. So the fact that we didn't + // find the type_info* we seek doesn't mean this type isn't + // registered. Scan for matching name() string. + for (typename vector_type::iterator ti(mVector.begin()), tend(mVector.end()); + ti != tend; ++ti) + { + if (std::string(ti->first->name()) == key->name()) + { + // This unrecognized 'key' is for the same type as ti->first. + // To speed future lookups, insert a new entry that lets us + // look up ti->second using this same 'key'. + return insert(key, ti->second).first; + } + } + // We simply have never seen a type with this type_info* from any load + // module. + return mVector.end(); + } + +private: + /// Our LLSortedVector is mutable so that if we're passed an unrecognized + /// std::type_info* for a registered type (which we can identify by + /// searching for the name() string), we can cache the new std::type_info* + /// to speed future lookups -- even when the containing LLTypeInfoLookup + /// is const. + vector_type mVector; +}; + +#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */ -- cgit v1.2.3