From 39cc7084559db78377b28cafa05462b97e3593f9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 15 Apr 2020 19:36:37 +0300 Subject: SL-13040 Fixed crash at EnvironmentPersistAcrossLogin --- indra/newview/llenvironment.cpp | 8 ++++---- indra/newview/llsettingsvo.h | 3 +++ indra/newview/llstartup.cpp | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 0e1c4f9434..342ee3ccf5 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -2800,7 +2800,7 @@ void LLEnvironment::loadSkyWaterFromSettings(const LLSD &env_data, bool &valid, } else if (env_data.has("sky_llsd")) { - LLSettingsSky::ptr_t sky = std::make_shared(env_data["sky_llsd"]); + LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildSky(env_data["sky_llsd"]); setEnvironment(ENV_LOCAL, sky); valid = true; } @@ -2814,7 +2814,7 @@ void LLEnvironment::loadSkyWaterFromSettings(const LLSD &env_data, bool &valid, } else if (env_data.has("water_llsd")) { - LLSettingsWater::ptr_t sky = std::make_shared(env_data["water_llsd"]); + LLSettingsWater::ptr_t sky = LLSettingsVOWater::buildWater(env_data["water_llsd"]); setEnvironment(ENV_LOCAL, sky); valid = true; } @@ -2899,8 +2899,8 @@ bool LLEnvironment::loadFromSettings() { S32 length = env_data["day_length"].asInteger(); S32 offset = env_data["day_offset"].asInteger(); - LLSettingsDay::ptr_t day = std::make_shared(env_data["day_llsd"]); - setEnvironment(ENV_LOCAL, day, LLSettingsDay::Seconds(length), LLSettingsDay::Seconds(offset)); + LLSettingsDay::ptr_t pday = LLSettingsVODay::buildDay(env_data["day_llsd"]); + setEnvironment(ENV_LOCAL, pday, LLSettingsDay::Seconds(length), LLSettingsDay::Seconds(offset)); valid = true; } diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 1f29013ecf..65136ad2f5 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -158,6 +158,9 @@ class LLSettingsVODay : public LLSettingsDay public: typedef std::function asset_built_fn; + // Todo: find a way to make this cnstructor private + // It shouldn't be used outside shared_prt and LLSettingsVODay + // outside of settings only use buildDay(settings) LLSettingsVODay(const LLSD &data); static ptr_t buildDay(LLSD settings); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index a1d1e85492..7673bae725 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1879,8 +1879,7 @@ bool idle_startup() display_startup(); - // Load stored local environment if needed. Only should be done once at least - // initial region data got loaded to avoid race condition with region's environment + // Load stored local environment if needed. LLEnvironment::instance().loadFromSettings(); // *TODO : Uncomment that line once the whole grid migrated to SLM and suppress it from LLAgent::handleTeleportFinished() (llagent.cpp) -- cgit v1.2.3 From a387b38d20bdbf1039c36cd7811e9cfb93809a2e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Apr 2020 09:26:29 -0700 Subject: Cleanup to coding standard --- indra/llrender/llglslshader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 384e5bf99f..8cc3c50ec2 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -485,7 +485,8 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, return success; } -BOOL LLGLSLShader::attachVertexObject(std::string object_path) { +BOOL LLGLSLShader::attachVertexObject(std::string object_path) +{ if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); -- cgit v1.2.3 From d43b8d8551518d95086f32f03aaee969a4b69916 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Apr 2020 15:38:46 -0700 Subject: SL-13019: Add debug logging of shaders used to track down macOSX / OSX GLSL linker errors --- indra/llrender/llglslshader.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 8cc3c50ec2..74cfa60b27 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -37,6 +37,10 @@ #include "OpenGL/OpenGL.h" #endif +// Print-print list of shader included source files that are linked together via glAttachObjectARB() +// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state. +#define DEBUG_SHADER_INCLUDES 0 + // Lots of STL stuff in here, using namespace std to keep things more readable using std::vector; using std::pair; @@ -402,6 +406,10 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, mDefines["OLD_SELECT"] = "1"; #endif +#if DEBUG_SHADER_INCLUDES + fprintf(stderr, "--- %s ---\n", mName.c_str()); +#endif // DEBUG_SHADER_INCLUDES + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -485,12 +493,36 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, return success; } +#if DEBUG_SHADER_INCLUDES +void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path ) +{ + GLcharARB* info_log; + GLint info_len_expect = 0; + GLint info_len_actual = 0; + + glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect); + fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str()); + + if (info_len_expect > 0) + { + fprintf(stderr, " ========== %s() ========== \n", func_name); + info_log = new GLcharARB [ info_len_expect ]; + glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log); + fprintf(stderr, "%s\n", info_log); + delete [] info_log; + } +} +#endif // DEBUG_SHADER_INCLUDES + BOOL LLGLSLShader::attachVertexObject(std::string object_path) { if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES + dumpAttachObject("attachVertexObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); return TRUE; } @@ -507,6 +539,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) { stop_glerror(); glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES + dumpAttachObject("attachFragmentObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); return TRUE; } @@ -523,6 +558,10 @@ void LLGLSLShader::attachObject(GLhandleARB object) { stop_glerror(); glAttachObjectARB(mProgramObject, object); +#if DEBUG_SHADER_INCLUDES + std::string object_path("???"); + dumpAttachObject("attachObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); } else -- cgit v1.2.3 From 11e9fbefeb11f4ed90e22e7f0a0558442317875e Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 2 Apr 2020 10:55:31 -0700 Subject: Fixed -Wstring-plus-int related errors for compatibility with Xcode-11.4 --- indra/llcommon/llsdutil.cpp | 2 +- indra/newview/llcommandhandler.cpp | 2 +- indra/newview/llxmlrpclistener.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 6a23c443a0..1f8384f415 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -506,7 +506,7 @@ struct Data const char* name; } typedata[] = { -#define def(type) { LLSD::type, #type + 4 } +#define def(type) { LLSD::type, &#type[4] } def(TypeUndefined), def(TypeBoolean), def(TypeInteger), diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp index 76d965b1f1..23e2271eae 100644 --- a/indra/newview/llcommandhandler.cpp +++ b/indra/newview/llcommandhandler.cpp @@ -222,7 +222,7 @@ struct symbol_info #define ent(SYMBOL) \ { \ - #SYMBOL + 28, /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \ + &#SYMBOL[28], /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \ SYMBOL \ } diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index 0693d08dfb..0daf3e761d 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -100,7 +100,7 @@ public: { // from curl.h // skip the "CURLE_" prefix for each of these strings -#define def(sym) (mMap[sym] = #sym + 6) +#define def(sym) (mMap[sym] = &#sym[6]) def(CURLE_OK); def(CURLE_UNSUPPORTED_PROTOCOL); /* 1 */ def(CURLE_FAILED_INIT); /* 2 */ -- cgit v1.2.3 From 224a4e09922a5ae425bdfcc0d1d9e34d82ca4ba7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 21 Feb 2020 23:38:39 +0200 Subject: SL-12678 Remove automatic retry of login Cherry-pick the retry disable into DRTVWR-510 --- indra/newview/lllogininstance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 8a69acb8dc..873531ef22 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -62,7 +62,7 @@ #include #include -const S32 LOGIN_MAX_RETRIES = 3; +const S32 LOGIN_MAX_RETRIES = 0; // Viewer should not autmatically retry login const F32 LOGIN_SRV_TIMEOUT_MIN = 10; const F32 LOGIN_SRV_TIMEOUT_MAX = 120; const F32 LOGIN_DNS_TIMEOUT_FACTOR = 0.9; // make DNS wait shorter then retry time -- cgit v1.2.3 From ba6004d69e6cc88066cdd6554c5015c855dd01ab Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 24 Apr 2020 15:31:51 -0700 Subject: DRTVWR-510 Cleanup: Fix copy-pasta typo of camera matrices --- indra/newview/llviewerwindow.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ae1eec81e0..d686aa7df9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -709,32 +709,32 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); -- cgit v1.2.3 From 1062efd059874ddce380bfa9d2305bcd85127a16 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 27 Apr 2020 15:27:31 -0700 Subject: DRTVWR-510 Cleanup: Remove (redundant) last columns from Debug Camera matrices as they are static. --- indra/newview/llviewerwindow.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d686aa7df9..bce742e513 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -709,32 +709,33 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); + // Projection last column is always <0,0,-1,0> + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2])); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); + // View last column is always <0,0,0,1> + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); -- cgit v1.2.3 From 88eca95208b7510196bcbc8a9fdcf11653aa3506 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 27 Apr 2020 15:30:54 -0700 Subject: SL-12971: Add logging of Display Devices -- useful on dual GPU machines --- indra/llwindow/llwindowwin32.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 3c69aa98c4..4a13c73c8c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -676,6 +676,37 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // TrackMouseEvent( &track_mouse_event ); // } + // SL-12971 dual GPU display + DISPLAY_DEVICEA display_device; + int display_index = -1; + DWORD display_flags = 0; // EDD_GET_DEVICE_INTERFACE_NAME ? + const size_t display_bytes = sizeof(display_device); + + do + { + if (display_index >= 0) + { + // CHAR DeviceName [ 32] Adapter name + // CHAR DeviceString[128] + CHAR text[256]; + + size_t name_len = strlen(display_device.DeviceName ); + size_t desc_len = strlen(display_device.DeviceString); + + CHAR *name = name_len ? display_device.DeviceName : "???"; + CHAR *desc = desc_len ? display_device.DeviceString : "???"; + + sprintf(text, "Display Device %d: %s, %s", display_index, name, desc); + LL_INFOS("Window") << text << LL_ENDL; + } + + ::ZeroMemory(&display_device,display_bytes); + display_device.cb = display_bytes; + + display_index++; + } while( EnumDisplayDevicesA(NULL, display_index, &display_device, display_flags )); + + LL_INFOS("Window") << "Total Display Devices: " << display_index << LL_ENDL; //----------------------------------------------------------------------- // Create GL drawing context -- cgit v1.2.3 From c21d3621ec0431ae943b7952a0c207bac8ac413a Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 09:12:32 -0700 Subject: DRTVWR-510: Cleanup: Add link for Optimus global variable for nVidia driver. --- indra/llrender/llgl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index c01c15391d..757f71cb65 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2632,6 +2632,7 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w #if LL_WINDOWS // Expose desired use of high-performance graphics processor to Optimus driver +// https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; -- cgit v1.2.3 From 7e107328216556ed5085a050f0aaa1487b183896 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:19:59 -0700 Subject: DRTVWR-510 Cleanup: Align camera matrices columns for consistent placement to improve readability --- indra/newview/llviewerwindow.cpp | 97 ++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index bce742e513..6a92e35ab6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -311,6 +311,66 @@ RecordToChatConsole::RecordToChatConsole(): mRecorder->showMultiline(true); } +//////////////////////////////////////////////////////////////////////////// +// +// Print Utility +// + +// Convert a normalized float (-1.0 <= x <= +1.0) to a fixed 1.4 format string: +// +// s#.#### +// +// Where: +// s sign character; space if x is positiv, minus if negative +// # decimal digits +// +// This is similar to printf("%+.4f") except positive numbers are NOT cluttered with a leading '+' sign. +void normalized_float_to_string(const float x, char *out_str) +{ + static const unsigned char DECIMAL_BCD2[] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 + }; + + int neg = (x < 0); + int rem = neg + ? (int)(x * -10000.) + : (int)(x * 10000.); + + int d10 = rem % 100; rem /= 100; + int d32 = rem % 100; rem /= 100; + + out_str[7] = 0; + out_str[6] = '0' + ((DECIMAL_BCD2[ d10 ] >> 0) & 0xF); + out_str[5] = '0' + ((DECIMAL_BCD2[ d10 ] >> 4) & 0xF); + out_str[4] = '0' + ((DECIMAL_BCD2[ d32 ] >> 0) & 0xF); + out_str[3] = '0' + ((DECIMAL_BCD2[ d32 ] >> 4) & 0xF); + out_str[2] = '.'; + out_str[1] = '0' + (rem & 1); + out_str[0] = " -"[neg]; // Could always show '+' for positive but this clutters up the common case +} + +// normalized float +#define MATRIX_ROW_N32_TO_STR( matrix_row, i ) \ + normalized_float_to_string( matrix_row[i+0], x_str ); \ + normalized_float_to_string( matrix_row[i+1], y_str ); \ + normalized_float_to_string( matrix_row[i+2], z_str ); + +// regular float +#define MATRIX_ROW_F32_TO_STR( matrix_row, i ) \ + sprintf(x_str, "%-9.2f", matrix_row[i+0] ); \ + sprintf(y_str, "%-9.2f", matrix_row[i+1] ); \ + sprintf(z_str, "%-9.2f", matrix_row[i+2] ); + //////////////////////////////////////////////////////////////////////////// // // LLDebugText @@ -709,34 +769,25 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - // Projection last column is always <0,0,-1,0> - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14])); - ypos += y_inc; + char x_str[16]; + char y_str[16]; + char z_str[16]; - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2])); - ypos += y_inc; + // Projection last column is always <0,0,-1,0> + // Projection last row is <0,0,x> + MATRIX_ROW_N32_TO_STR(gGLProjection, 12); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - // View last column is always <0,0,0,1> - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2])); - ypos += y_inc; + // View last column is always <0,0,0,1> + MATRIX_ROW_F32_TO_STR(gGLModelView, 12); addText(xpos, ypos, llformat("%s ""%s ""%s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "View Matrix"); ypos += y_inc; -- cgit v1.2.3 From 2054fed4ceada9620d476897500450c27c58db82 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:21:16 -0700 Subject: DRTVWR-510 Cleanup: Add dark background under camera matrice for contrast when against a white background --- indra/newview/llviewerwindow.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6a92e35ab6..73ce481e7b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -393,7 +393,11 @@ private: typedef std::vector line_list_t; line_list_t mLineList; LLColor4 mTextColor; - + + LLColor4 mBackColor; + LLRect mBackRectCamera1; + LLRect mBackRectCamera2; + void addText(S32 x, S32 y, const std::string &text) { mLineList.push_back(Line(text, x, y)); @@ -429,11 +433,22 @@ public: mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); // Draw stuff growing up from right lower corner of screen - S32 xpos = mWindow->getWorldViewWidthScaled() - 400; + S32 x_right = mWindow->getWorldViewWidthScaled(); + S32 xpos = x_right - 400; xpos = llmax(xpos, 0); S32 ypos = 64; const S32 y_inc = 20; + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + mBackRectCamera1.mLeft = xpos; + mBackRectCamera1.mRight = x_right; + mBackRectCamera1.mTop = -1; + mBackRectCamera1.mBottom = -1; + mBackRectCamera2 = mBackRectCamera1; + + mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + clearText(); if (gSavedSettings.getBOOL("DebugShowTime")) @@ -775,10 +790,11 @@ public: // Projection last column is always <0,0,-1,0> // Projection last row is <0,0,x> + mBackRectCamera1.mBottom = ypos - y_inc; MATRIX_ROW_N32_TO_STR(gGLProjection, 12); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; MATRIX_ROW_N32_TO_STR(gGLProjection, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera1.mTop = ypos; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mBottom = ypos; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; @@ -786,7 +802,7 @@ public: // View last column is always <0,0,0,1> MATRIX_ROW_F32_TO_STR(gGLModelView, 12); addText(xpos, ypos, llformat("%s ""%s ""%s", x_str, y_str, z_str)); ypos += y_inc; MATRIX_ROW_N32_TO_STR(gGLModelView, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mTop = ypos; MATRIX_ROW_N32_TO_STR(gGLModelView, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "View Matrix"); @@ -929,6 +945,18 @@ public: void draw() { LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); + + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + if (mBackRectCamera1.mTop >= 0) + { + mBackColor.setAlpha( 0.75f ); + gl_rect_2d(mBackRectCamera1, mBackColor, true); + + mBackColor.setAlpha( 0.66f ); + gl_rect_2d(mBackRectCamera2, mBackColor, true); + } + for (line_list_t::iterator iter = mLineList.begin(); iter != mLineList.end(); ++iter) { -- cgit v1.2.3 From 494d59a2616ce8a120884331a62d754c76864410 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:23:09 -0700 Subject: DRTVWR-510 Cleanup: Remove useless redundant debug lines clear; updateDebugText() is always called before drawDebugText() which already clears the debug text lines --- indra/newview/llviewerwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 73ce481e7b..1add8767b9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -965,7 +965,6 @@ public: LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } - mLineList.clear(); } }; -- cgit v1.2.3 From a3d0e3f14de4ae99128424ce0f495f40bb638202 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Apr 2020 09:26:29 -0700 Subject: Cleanup to coding standard --- indra/llrender/llglslshader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 384e5bf99f..8cc3c50ec2 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -485,7 +485,8 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, return success; } -BOOL LLGLSLShader::attachVertexObject(std::string object_path) { +BOOL LLGLSLShader::attachVertexObject(std::string object_path) +{ if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); -- cgit v1.2.3 From 2df08951e102c05335ce4143fe436b40cc34d22a Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Apr 2020 15:38:46 -0700 Subject: SL-13019: Add debug logging of shaders used to track down macOSX / OSX GLSL linker errors --- indra/llrender/llglslshader.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 8cc3c50ec2..74cfa60b27 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -37,6 +37,10 @@ #include "OpenGL/OpenGL.h" #endif +// Print-print list of shader included source files that are linked together via glAttachObjectARB() +// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state. +#define DEBUG_SHADER_INCLUDES 0 + // Lots of STL stuff in here, using namespace std to keep things more readable using std::vector; using std::pair; @@ -402,6 +406,10 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, mDefines["OLD_SELECT"] = "1"; #endif +#if DEBUG_SHADER_INCLUDES + fprintf(stderr, "--- %s ---\n", mName.c_str()); +#endif // DEBUG_SHADER_INCLUDES + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -485,12 +493,36 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, return success; } +#if DEBUG_SHADER_INCLUDES +void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path ) +{ + GLcharARB* info_log; + GLint info_len_expect = 0; + GLint info_len_actual = 0; + + glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect); + fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str()); + + if (info_len_expect > 0) + { + fprintf(stderr, " ========== %s() ========== \n", func_name); + info_log = new GLcharARB [ info_len_expect ]; + glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log); + fprintf(stderr, "%s\n", info_log); + delete [] info_log; + } +} +#endif // DEBUG_SHADER_INCLUDES + BOOL LLGLSLShader::attachVertexObject(std::string object_path) { if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES + dumpAttachObject("attachVertexObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); return TRUE; } @@ -507,6 +539,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) { stop_glerror(); glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); +#if DEBUG_SHADER_INCLUDES + dumpAttachObject("attachFragmentObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); return TRUE; } @@ -523,6 +558,10 @@ void LLGLSLShader::attachObject(GLhandleARB object) { stop_glerror(); glAttachObjectARB(mProgramObject, object); +#if DEBUG_SHADER_INCLUDES + std::string object_path("???"); + dumpAttachObject("attachObject", mProgramObject, object_path); +#endif // DEBUG_SHADER_INCLUDES stop_glerror(); } else -- cgit v1.2.3 From 2c651f3e21c5eeb0cc361e7b03dcb507c96593d8 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 2 Apr 2020 10:55:31 -0700 Subject: Fixed -Wstring-plus-int related errors for compatibility with Xcode-11.4 --- indra/llcommon/llsdutil.cpp | 2 +- indra/newview/llcommandhandler.cpp | 2 +- indra/newview/llxmlrpclistener.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 6a23c443a0..1f8384f415 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -506,7 +506,7 @@ struct Data const char* name; } typedata[] = { -#define def(type) { LLSD::type, #type + 4 } +#define def(type) { LLSD::type, &#type[4] } def(TypeUndefined), def(TypeBoolean), def(TypeInteger), diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp index 76d965b1f1..23e2271eae 100644 --- a/indra/newview/llcommandhandler.cpp +++ b/indra/newview/llcommandhandler.cpp @@ -222,7 +222,7 @@ struct symbol_info #define ent(SYMBOL) \ { \ - #SYMBOL + 28, /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \ + &#SYMBOL[28], /* skip "LLCommandHandler::UNTRUSTED_" prefix */ \ SYMBOL \ } diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index 0693d08dfb..0daf3e761d 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -100,7 +100,7 @@ public: { // from curl.h // skip the "CURLE_" prefix for each of these strings -#define def(sym) (mMap[sym] = #sym + 6) +#define def(sym) (mMap[sym] = &#sym[6]) def(CURLE_OK); def(CURLE_UNSUPPORTED_PROTOCOL); /* 1 */ def(CURLE_FAILED_INIT); /* 2 */ -- cgit v1.2.3 From fd2f138ec75c092ae2a4b29127fa4c6aca50cf0e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 24 Apr 2020 15:31:51 -0700 Subject: DRTVWR-510 Cleanup: Fix copy-pasta typo of camera matrices --- indra/newview/llviewerwindow.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index f64dfcf0d4..aaba8dfa5c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -709,32 +709,32 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); -- cgit v1.2.3 From f4da8cd3738b8dafecad3ab4f8c1d03fafdfd37e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 27 Apr 2020 15:27:31 -0700 Subject: DRTVWR-510 Cleanup: Remove (redundant) last columns from Debug Camera matrices as they are static. --- indra/newview/llviewerwindow.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index aaba8dfa5c..7364454b45 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -709,32 +709,33 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); + // Projection last column is always <0,0,-1,0> + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2])); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); + // View last column is always <0,0,0,1> + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f %.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); + addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); -- cgit v1.2.3 From 3313f382bd872ccb68509afbbdbc51c3a96b816f Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 27 Apr 2020 15:30:54 -0700 Subject: SL-12971: Add logging of Display Devices -- useful on dual GPU machines --- indra/llwindow/llwindowwin32.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 0b3936f8a5..de83efb8a3 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -676,6 +676,37 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // TrackMouseEvent( &track_mouse_event ); // } + // SL-12971 dual GPU display + DISPLAY_DEVICEA display_device; + int display_index = -1; + DWORD display_flags = 0; // EDD_GET_DEVICE_INTERFACE_NAME ? + const size_t display_bytes = sizeof(display_device); + + do + { + if (display_index >= 0) + { + // CHAR DeviceName [ 32] Adapter name + // CHAR DeviceString[128] + CHAR text[256]; + + size_t name_len = strlen(display_device.DeviceName ); + size_t desc_len = strlen(display_device.DeviceString); + + CHAR *name = name_len ? display_device.DeviceName : "???"; + CHAR *desc = desc_len ? display_device.DeviceString : "???"; + + sprintf(text, "Display Device %d: %s, %s", display_index, name, desc); + LL_INFOS("Window") << text << LL_ENDL; + } + + ::ZeroMemory(&display_device,display_bytes); + display_device.cb = display_bytes; + + display_index++; + } while( EnumDisplayDevicesA(NULL, display_index, &display_device, display_flags )); + + LL_INFOS("Window") << "Total Display Devices: " << display_index << LL_ENDL; //----------------------------------------------------------------------- // Create GL drawing context -- cgit v1.2.3 From 05ddffb6bab6da2e2bcaaa215824b4c09d6928e7 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 09:12:32 -0700 Subject: DRTVWR-510: Cleanup: Add link for Optimus global variable for nVidia driver. --- indra/llrender/llgl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 4c56b8eace..7560fe9505 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2703,6 +2703,7 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w #if LL_WINDOWS // Expose desired use of high-performance graphics processor to Optimus driver +// https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; -- cgit v1.2.3 From c2c11a67ff594d0163f9fed9d178b1fbb6f8f25b Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:19:59 -0700 Subject: DRTVWR-510 Cleanup: Align camera matrices columns for consistent placement to improve readability --- indra/newview/llviewerwindow.cpp | 97 ++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7364454b45..77cccf1c3b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -311,6 +311,66 @@ RecordToChatConsole::RecordToChatConsole(): mRecorder->showMultiline(true); } +//////////////////////////////////////////////////////////////////////////// +// +// Print Utility +// + +// Convert a normalized float (-1.0 <= x <= +1.0) to a fixed 1.4 format string: +// +// s#.#### +// +// Where: +// s sign character; space if x is positiv, minus if negative +// # decimal digits +// +// This is similar to printf("%+.4f") except positive numbers are NOT cluttered with a leading '+' sign. +void normalized_float_to_string(const float x, char *out_str) +{ + static const unsigned char DECIMAL_BCD2[] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 + }; + + int neg = (x < 0); + int rem = neg + ? (int)(x * -10000.) + : (int)(x * 10000.); + + int d10 = rem % 100; rem /= 100; + int d32 = rem % 100; rem /= 100; + + out_str[7] = 0; + out_str[6] = '0' + ((DECIMAL_BCD2[ d10 ] >> 0) & 0xF); + out_str[5] = '0' + ((DECIMAL_BCD2[ d10 ] >> 4) & 0xF); + out_str[4] = '0' + ((DECIMAL_BCD2[ d32 ] >> 0) & 0xF); + out_str[3] = '0' + ((DECIMAL_BCD2[ d32 ] >> 4) & 0xF); + out_str[2] = '.'; + out_str[1] = '0' + (rem & 1); + out_str[0] = " -"[neg]; // Could always show '+' for positive but this clutters up the common case +} + +// normalized float +#define MATRIX_ROW_N32_TO_STR( matrix_row, i ) \ + normalized_float_to_string( matrix_row[i+0], x_str ); \ + normalized_float_to_string( matrix_row[i+1], y_str ); \ + normalized_float_to_string( matrix_row[i+2], z_str ); + +// regular float +#define MATRIX_ROW_F32_TO_STR( matrix_row, i ) \ + sprintf(x_str, "%-9.2f", matrix_row[i+0] ); \ + sprintf(y_str, "%-9.2f", matrix_row[i+1] ); \ + sprintf(z_str, "%-9.2f", matrix_row[i+2] ); + //////////////////////////////////////////////////////////////////////////// // // LLDebugText @@ -709,34 +769,25 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - // Projection last column is always <0,0,-1,0> - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14])); - ypos += y_inc; + char x_str[16]; + char y_str[16]; + char z_str[16]; - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2])); - ypos += y_inc; + // Projection last column is always <0,0,-1,0> + // Projection last row is <0,0,x> + MATRIX_ROW_N32_TO_STR(gGLProjection, 12); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - // View last column is always <0,0,0,1> - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2])); - ypos += y_inc; + // View last column is always <0,0,0,1> + MATRIX_ROW_F32_TO_STR(gGLModelView, 12); addText(xpos, ypos, llformat("%s ""%s ""%s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "View Matrix"); ypos += y_inc; -- cgit v1.2.3 From 2665cd65dd7f04db432002b0d5e1d83ba9cde222 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:21:16 -0700 Subject: DRTVWR-510 Cleanup: Add dark background under camera matrice for contrast when against a white background --- indra/newview/llviewerwindow.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 77cccf1c3b..fb4db23c26 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -393,7 +393,11 @@ private: typedef std::vector line_list_t; line_list_t mLineList; LLColor4 mTextColor; - + + LLColor4 mBackColor; + LLRect mBackRectCamera1; + LLRect mBackRectCamera2; + void addText(S32 x, S32 y, const std::string &text) { mLineList.push_back(Line(text, x, y)); @@ -429,11 +433,22 @@ public: mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); // Draw stuff growing up from right lower corner of screen - S32 xpos = mWindow->getWorldViewWidthScaled() - 400; + S32 x_right = mWindow->getWorldViewWidthScaled(); + S32 xpos = x_right - 400; xpos = llmax(xpos, 0); S32 ypos = 64; const S32 y_inc = 20; + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + mBackRectCamera1.mLeft = xpos; + mBackRectCamera1.mRight = x_right; + mBackRectCamera1.mTop = -1; + mBackRectCamera1.mBottom = -1; + mBackRectCamera2 = mBackRectCamera1; + + mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + clearText(); if (gSavedSettings.getBOOL("DebugShowTime")) @@ -775,10 +790,11 @@ public: // Projection last column is always <0,0,-1,0> // Projection last row is <0,0,x> + mBackRectCamera1.mBottom = ypos - y_inc; MATRIX_ROW_N32_TO_STR(gGLProjection, 12); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; MATRIX_ROW_N32_TO_STR(gGLProjection, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera1.mTop = ypos; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mBottom = ypos; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; @@ -786,7 +802,7 @@ public: // View last column is always <0,0,0,1> MATRIX_ROW_F32_TO_STR(gGLModelView, 12); addText(xpos, ypos, llformat("%s ""%s ""%s", x_str, y_str, z_str)); ypos += y_inc; MATRIX_ROW_N32_TO_STR(gGLModelView, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mTop = ypos; MATRIX_ROW_N32_TO_STR(gGLModelView, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; addText(xpos, ypos, "View Matrix"); @@ -929,6 +945,18 @@ public: void draw() { LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); + + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + if (mBackRectCamera1.mTop >= 0) + { + mBackColor.setAlpha( 0.75f ); + gl_rect_2d(mBackRectCamera1, mBackColor, true); + + mBackColor.setAlpha( 0.66f ); + gl_rect_2d(mBackRectCamera2, mBackColor, true); + } + for (line_list_t::iterator iter = mLineList.begin(); iter != mLineList.end(); ++iter) { -- cgit v1.2.3 From 7449f4b6d770be9d56ee5fa3d20b6b59d816719c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 28 Apr 2020 17:23:09 -0700 Subject: DRTVWR-510 Cleanup: Remove useless redundant debug lines clear; updateDebugText() is always called before drawDebugText() which already clears the debug text lines --- indra/newview/llviewerwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index fb4db23c26..e4b5c02a56 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -965,7 +965,6 @@ public: LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } - mLineList.clear(); } }; -- cgit v1.2.3 From 39c0505412fe6cf2f9aa9681991d4a21da03319c Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 5 May 2020 12:23:59 -0600 Subject: DRTVWR-510 add code to report Vulkan capability in stats (Windows-only) --- indra/newview/llviewerstats.cpp | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 85d87a43af..eccbefcd3e 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -55,7 +55,6 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llvoavatarself.h" -#include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" #include "llfeaturemanager.h" #include "llviewernetwork.h" @@ -582,21 +581,32 @@ void send_stats() // If the current revision is recent, ping the previous author before overriding LLSD &misc = body["stats"]["misc"]; - // Screen size so the UI team can figure out how big the widgets - // appear and use a "typical" size for end user tests. - - S32 window_width = gViewerWindow->getWindowWidthRaw(); - S32 window_height = gViewerWindow->getWindowHeightRaw(); - S32 window_size = (window_width * window_height) / 1024; - misc["string_1"] = llformat("%d", window_size); - misc["string_2"] = llformat("Texture Time: %.2f, Total Time: %.2f", gTextureTimer.getElapsedTimeF32(), gFrameTimeSeconds.value()); - - F32 unbaked_time = LLVOAvatar::sUnbakedTime * 1000.f / gFrameTimeSeconds; - misc["int_1"] = LLSD::Integer(unbaked_time); // Steve: 1.22 - F32 grey_time = LLVOAvatar::sGreyTime * 1000.f / gFrameTimeSeconds; - misc["int_2"] = LLSD::Integer(grey_time); // Steve: 1.22 - - LL_INFOS() << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << LL_ENDL; +#ifdef LL_WINDOWS + // Probe for Vulkan capability (Dave Houlton 05/2020) + // + // Check for presense of a Vulkan loader dll, as a proxy for a Vulkan-capable gpu. + // False-positives and false-negatives are possible, but unlikely. We'll get a good + // approximation of Vulkan capability within current user systems from this. More + // detailed information on versions and extensions can come later. + HMODULE vulkanDll = LoadLibraryExA("vulkan-1.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); + if (NULL == vulkanDll) + { + misc["string_1"] = llformat("No Vulkan driver detected"); + } + else + { + misc["string_1"] = llformat("Vulkan driver is detected"); + FreeLibrary(vulkanDll); + } +#else + misc["string_1"] = llformat("Unused"); +#endif // LL_WINDOWS + + misc["string_2"] = llformat("Unused"); + misc["int_1"] = LLSD::Integer(0); + misc["int_2"] = LLSD::Integer(0); + + LL_INFOS() << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << LL_ENDL; LL_INFOS() << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << LL_ENDL; body["DisplayNamesEnabled"] = gSavedSettings.getBOOL("UseDisplayNames"); -- cgit v1.2.3 From 7bf2a1f5fef557e4531731c608c8dd924c97bc39 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 6 May 2020 09:37:16 -0700 Subject: DRTVWR-510: Add clarifaction on last rows, add pretty printing for > +/-99K, more cleanup --- indra/newview/llviewerwindow.cpp | 80 ++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1add8767b9..c1e4d1be90 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -325,6 +325,7 @@ RecordToChatConsole::RecordToChatConsole(): // # decimal digits // // This is similar to printf("%+.4f") except positive numbers are NOT cluttered with a leading '+' sign. +// NOTE: This does NOT null terminate the output void normalized_float_to_string(const float x, char *out_str) { static const unsigned char DECIMAL_BCD2[] = @@ -349,7 +350,6 @@ void normalized_float_to_string(const float x, char *out_str) int d10 = rem % 100; rem /= 100; int d32 = rem % 100; rem /= 100; - out_str[7] = 0; out_str[6] = '0' + ((DECIMAL_BCD2[ d10 ] >> 0) & 0xF); out_str[5] = '0' + ((DECIMAL_BCD2[ d10 ] >> 4) & 0xF); out_str[4] = '0' + ((DECIMAL_BCD2[ d32 ] >> 0) & 0xF); @@ -360,16 +360,49 @@ void normalized_float_to_string(const float x, char *out_str) } // normalized float -#define MATRIX_ROW_N32_TO_STR( matrix_row, i ) \ - normalized_float_to_string( matrix_row[i+0], x_str ); \ - normalized_float_to_string( matrix_row[i+1], y_str ); \ - normalized_float_to_string( matrix_row[i+2], z_str ); +// printf("%-.4f %-.4f %-.4f") +// Params: +// float &matrix_row[4] +// int matrix_cell_index +// string out_buffer (size 32) +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_N32_TO_STR(matrix_row, i, out_buffer) \ + normalized_float_to_string(matrix_row[i+0], out_buffer + 0); \ + normalized_float_to_string(matrix_row[i+1], out_buffer + 11); \ + normalized_float_to_string(matrix_row[i+2], out_buffer + 22); \ + out_buffer[31] = 0; + // regular float -#define MATRIX_ROW_F32_TO_STR( matrix_row, i ) \ - sprintf(x_str, "%-9.2f", matrix_row[i+0] ); \ - sprintf(y_str, "%-9.2f", matrix_row[i+1] ); \ - sprintf(z_str, "%-9.2f", matrix_row[i+2] ); +// sprintf(buffer, "%-8.2f %-8.2f %-8.2f", matrix_row[i+0], matrix_row[i+1], matrix_row[i+2]); +// Params: +// float &matrix_row[4] +// int matrix_cell_index +// char out_buffer[32] +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_F32_TO_STR(matrix_row, i, out_buffer) { \ + static const char *format[3] = { \ + "%-8.2f" , /* 0 */ \ + "> 99K ", /* 1 */ \ + "< -99K " /* 2 */ \ + }; \ + \ + F32 temp_0 = matrix_row[i+0]; \ + F32 temp_1 = matrix_row[i+1]; \ + F32 temp_2 = matrix_row[i+2]; \ + \ + U8 flag_0 = (((U8)(temp_0 < -99999.99)) << 1) | ((U8)(temp_0 > 99999.99)); \ + U8 flag_1 = (((U8)(temp_1 < -99999.99)) << 1) | ((U8)(temp_1 > 99999.99)); \ + U8 flag_2 = (((U8)(temp_2 < -99999.99)) << 1) | ((U8)(temp_2 > 99999.99)); \ + \ + if (temp_0 < 0.f) out_buffer[ 0] = '-'; \ + if (temp_1 < 0.f) out_buffer[11] = '-'; \ + if (temp_2 < 0.f) out_buffer[22] = '-'; \ + \ + sprintf(out_buffer+ 1,format[flag_0],fabsf(temp_0)); out_buffer[ 1+8] = ' '; \ + sprintf(out_buffer+12,format[flag_1],fabsf(temp_1)); out_buffer[12+8] = ' '; \ + sprintf(out_buffer+23,format[flag_2],fabsf(temp_2)); out_buffer[23+8] = 0 ; \ +} //////////////////////////////////////////////////////////////////////////// // @@ -784,26 +817,25 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - char x_str[16]; - char y_str[16]; - char z_str[16]; - - // Projection last column is always <0,0,-1,0> - // Projection last row is <0,0,x> - mBackRectCamera1.mBottom = ypos - y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 12); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLProjection, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera1.mTop = ypos; - MATRIX_ROW_N32_TO_STR(gGLProjection, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mBottom = ypos; + char camera_lines[8][32]; + memset(camera_lines, ' ', sizeof(camera_lines)); + + // Projection last column is always <0,0,-1.0001,0> + // Projection last row is always <0,0,-0.2> + mBackRectCamera1.mBottom = ypos - y_inc + 2; + MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 8,camera_lines[6]); addText(xpos, ypos, std::string(camera_lines[6])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4,camera_lines[5]); addText(xpos, ypos, std::string(camera_lines[5])); ypos += y_inc; mBackRectCamera1.mTop = ypos + 2; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0,camera_lines[4]); addText(xpos, ypos, std::string(camera_lines[4])); ypos += y_inc; mBackRectCamera2.mBottom = ypos + 2; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; // View last column is always <0,0,0,1> - MATRIX_ROW_F32_TO_STR(gGLModelView, 12); addText(xpos, ypos, llformat("%s ""%s ""%s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLModelView, 8); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; - MATRIX_ROW_N32_TO_STR(gGLModelView, 4); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; mBackRectCamera2.mTop = ypos; - MATRIX_ROW_N32_TO_STR(gGLModelView, 0); addText(xpos, ypos, llformat("%s %s %s", x_str, y_str, z_str)); ypos += y_inc; + MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 8,camera_lines[2]); addText(xpos, ypos, std::string(camera_lines[2])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4,camera_lines[1]); addText(xpos, ypos, std::string(camera_lines[1])); ypos += y_inc; mBackRectCamera2.mTop = ypos + 2; + MATRIX_ROW_N32_TO_STR(gGLModelView, 0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); ypos += y_inc; -- cgit v1.2.3 From 0a071f94c9863f88f960f3b09b8b177e17a0be20 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 6 May 2020 11:55:02 -0600 Subject: DRTVWR-510 cache vulkan-detect result --- indra/newview/llviewerstats.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index eccbefcd3e..04172adde9 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -588,16 +588,22 @@ void send_stats() // False-positives and false-negatives are possible, but unlikely. We'll get a good // approximation of Vulkan capability within current user systems from this. More // detailed information on versions and extensions can come later. - HMODULE vulkanDll = LoadLibraryExA("vulkan-1.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); - if (NULL == vulkanDll) - { - misc["string_1"] = llformat("No Vulkan driver detected"); - } - else + static bool vulkan_oneshot = false; + static bool vulkan_detected = false; + + if (!vulkan_oneshot) { - misc["string_1"] = llformat("Vulkan driver is detected"); - FreeLibrary(vulkanDll); + HMODULE vulkan_loader = LoadLibraryExA("vulkan-1.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); + if (NULL != vulkan_loader) + { + vulkan_detected = true; + FreeLibrary(vulkan_loader); + } + vulkan_oneshot = true; } + + misc["string_1"] = vulkan_detected ? llformat("Vulkan driver is detected") : llformat("No Vulkan driver detected"); + #else misc["string_1"] = llformat("Unused"); #endif // LL_WINDOWS -- cgit v1.2.3 From abbd55db30d455710092f58053c66d8c931af60b Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 20 May 2020 14:43:27 -0600 Subject: DRTVWR-510: Fix coord error in 'Show Color Under Cursor' --- indra/newview/llviewerwindow.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0b5ca0b79c..09f86ae391 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -841,16 +841,21 @@ public: ypos += y_inc; } // disable use of glReadPixels which messes up nVidia nSight graphics debugging - if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) - { - U8 color[4]; - LLCoordGL coord = gViewerWindow->getCurrentMouse(); - glReadPixels(coord.mX, coord.mY, 1,1,GL_RGBA, GL_UNSIGNED_BYTE, color); - addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3])); - ypos += y_inc; - } + if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) + { + U8 color[4]; + LLCoordGL coord = gViewerWindow->getCurrentMouse(); + + // Convert x,y to raw pixel coords + S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled()); + S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled()); + + glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color); + addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3])); + ypos += y_inc; + } - // only display these messages if we are actually rendering beacons at this moment + // only display these messages if we are actually rendering beacons at this moment if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons")) { if (LLPipeline::getRenderMOAPBeacons()) -- cgit v1.2.3 From 3c4a1b3fd80fd8e174919e685166e819e311f0ef Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 21 May 2020 17:24:21 -0600 Subject: SL-13163 - Fix (revert) EEP specular contribution calculation for deferred --- .../shaders/class2/deferred/softenLightF.glsl | 34 +++------------------- 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index b0dff0c628..40f0f0448a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -127,42 +127,16 @@ void main() if (spec.a > 0.0) // specular reflection { - -#if 1 //EEP - vec3 npos = -normalize(pos.xyz); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(light_dir.xyz+npos); - float nh = dot(norm.xyz, h); - float nv = dot(norm.xyz, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 sp = sun_contrib*scontrib / 6.0; - sp = clamp(sp, vec3(0), vec3(1)); - bloom += dot(sp, sp) / 4.0; - color += sp * spec.rgb; - } -#else //PRODUCTION float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); - + vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r); + // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; bloom = dot(spec_contrib, spec_contrib) / 6; color.rgb += spec_contrib; -#endif - } - - color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); + + color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); if (envIntensity > 0.0) { //add environmentmap -- cgit v1.2.3 From d1ed4deba0a8d895a78c871b551b47c353d54ab8 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 29 May 2020 22:37:14 +0000 Subject: edit-me-to-trigger-new-build.txt edited online with Bitbucket --- indra/edit-me-to-trigger-new-build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index fd40910d9e..c76e18f480 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1,4 +1,4 @@ - +euclid 5/29/2020 -- cgit v1.2.3 From 534d326c48271b63c4cc173f1d2382846b028021 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 4 Jun 2020 11:47:55 -0700 Subject: SL-13084: Fix clouds flipped along East/West axis to match texture preview Cloud Image and direction to match Cloud Scroll --- .../newview/app_settings/shaders/class1/deferred/cloudsV.glsl | 8 +++++++- .../app_settings/shaders/class2/windlight/cloudsV.glsl | 7 ++++++- indra/newview/llsettingsvo.cpp | 11 ++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index caa4fe1f65..7ea807804a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -78,7 +78,13 @@ void main() gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); // Texture coords - vary_texcoord0 = texcoord0; + // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll + // Keep in Sync! + // * indra\newview\llsettingsvo.cpp + // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl + // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl + vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); + vary_texcoord0.xy -= 0.5; vary_texcoord0.xy /= cloud_scale; vary_texcoord0.xy += 0.5; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 2c1475d547..fdd90eb004 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -72,7 +72,12 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = texcoord0; + // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll + // Keep in Sync! + // * indra\newview\llsettingsvo.cpp + // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl + // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl + vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index c72a0706cd..5a4427a7b7 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -678,8 +678,17 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) { shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + // Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate") LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); - vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); + LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() ); + + // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll + // Keep in Sync! + // * indra\newview\llsettingsvo.cpp + // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl + // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl + cloud_scroll[0] = -cloud_scroll[0]; + vect_c_p_d1 += cloud_scroll; shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); -- cgit v1.2.3 From e541d5962604b7938b957ce9e7867723d54b0489 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 4 Jun 2020 11:47:55 -0700 Subject: SL-13804: Fix clouds flipped along East/West axis to match texture preview Cloud Image and direction to match Cloud Scroll --- indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 7ea807804a..62edf82cb3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -70,7 +70,9 @@ uniform float cloud_scale; // NOTE: Keep these in sync! // indra\newview\app_settings\shaders\class1\deferred\skyV.glsl // indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl +// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl // indra\newview\lllegacyatmospherics.cpp +// indra\newview\llsettingsvo.cpp void main() { @@ -79,11 +81,7 @@ void main() // Texture coords // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll - // Keep in Sync! - // * indra\newview\llsettingsvo.cpp - // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl - // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl - vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); + vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); // See: LLSettingsVOSky::applySpecial vary_texcoord0.xy -= 0.5; vary_texcoord0.xy /= cloud_scale; -- cgit v1.2.3 From b6941de16a24d65d73370f51c07815ef56c81c4c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 5 Jun 2020 08:44:44 -0700 Subject: SL-13084: Fix inverted cloud scroll with ALM is off --- indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index fdd90eb004..b55555ad23 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -181,7 +181,6 @@ void main() // Texture coords - vary_texcoord0 = texcoord0; vary_texcoord0.xy -= 0.5; vary_texcoord0.xy /= cloud_scale; vary_texcoord0.xy += 0.5; -- cgit v1.2.3 From 4a92f1787090009b8f11c85b6c267b099eda7dd8 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 5 Jun 2020 08:50:59 -0700 Subject: SL-13084: Move texture coords section to top in class2/windlight/cloudsV to match class1/deffered/cloudsV --- .../shaders/class2/windlight/cloudsV.glsl | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index b55555ad23..7d560b0363 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -72,6 +72,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + // Texture coords // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll // Keep in Sync! // * indra\newview\llsettingsvo.cpp @@ -79,6 +80,17 @@ void main() // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale; + vary_texcoord0.xy += 0.5; + + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; + + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; + // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); @@ -180,18 +192,6 @@ void main() vary_CloudDensity = 2. * (cloud_shadow - 0.25); - // Texture coords - vary_texcoord0.xy -= 0.5; - vary_texcoord0.xy /= cloud_scale; - vary_texcoord0.xy += 0.5; - - vary_texcoord1 = vary_texcoord0; - vary_texcoord1.x += lightnorm.x * 0.0125; - vary_texcoord1.y += lightnorm.z * 0.0125; - - vary_texcoord2 = vary_texcoord0 * 16.; - vary_texcoord3 = vary_texcoord1 * 16.; - // Combine these to minimize register use vary_CloudColorAmbient += oHazeColorBelowCloud; -- cgit v1.2.3 From 8925e821e86b6067e86f5aa65fc232fb9920c1b7 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 5 Jun 2020 09:27:13 -0700 Subject: SL-13084: Add references to other common files --- .../app_settings/shaders/class1/deferred/cloudsV.glsl | 1 - .../app_settings/shaders/class2/windlight/cloudsV.glsl | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 62edf82cb3..495daa2db6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -75,7 +75,6 @@ uniform float cloud_scale; // indra\newview\llsettingsvo.cpp void main() { - // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 7d560b0363..a4389f62dc 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -36,6 +36,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vary_CloudColorSun; VARYING vec4 vary_CloudColorAmbient; VARYING float vary_CloudDensity; + VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord1; VARYING vec2 vary_texcoord2; @@ -66,19 +67,20 @@ uniform vec4 cloud_color; uniform float cloud_scale; +// NOTE: Keep these in sync! +// indra\newview\app_settings\shaders\class1\deferred\skyV.glsl +// indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl +// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl +// indra\newview\lllegacyatmospherics.cpp +// indra\newview\llsettingsvo.cpp void main() { - // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); // Texture coords // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll - // Keep in Sync! - // * indra\newview\llsettingsvo.cpp - // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl - // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl - vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); + vary_texcoord0 = vec2( -texcoord0.x, texcoord0.y ); // See: LLSettingsVOSky::applySpecial vary_texcoord0.xy -= 0.5; vary_texcoord0.xy /= cloud_scale; -- cgit v1.2.3 From 3d872fb21f089ce06da576ee08660a0245262cc5 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 8 Jun 2020 15:47:41 -0600 Subject: SL-13281, add missing srgb->linear conversion for specular --- indra/llrender/llimagegl.cpp | 80 +++++++++++++--------- indra/llrender/llrender.cpp | 22 +++--- indra/llrender/llrendertarget.cpp | 10 +-- .../shaders/class1/deferred/multiPointLightF.glsl | 1 + 4 files changed, 69 insertions(+), 44 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index ff74380217..3b6a49735e 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -985,38 +985,56 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) return FALSE; } - if( !mHasExplicitFormat ) - { - switch (mComponents) - { - case 1: - // Use luminance alpha (for fonts) - mFormatInternal = GL_LUMINANCE8; - mFormatPrimary = GL_LUMINANCE; - mFormatType = GL_UNSIGNED_BYTE; - break; - case 2: - // Use luminance alpha (for fonts) - mFormatInternal = GL_LUMINANCE8_ALPHA8; - mFormatPrimary = GL_LUMINANCE_ALPHA; - mFormatType = GL_UNSIGNED_BYTE; - break; - case 3: - mFormatInternal = GL_RGB8; - mFormatPrimary = GL_RGB; - mFormatType = GL_UNSIGNED_BYTE; - break; - case 4: - mFormatInternal = GL_RGBA8; - mFormatPrimary = GL_RGBA; - mFormatType = GL_UNSIGNED_BYTE; - break; - default: - LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; - } - } + if (!mHasExplicitFormat) + { + switch (mComponents) + { + case 1: + // Use luminance alpha (for fonts) + mFormatInternal = GL_LUMINANCE8; + mFormatPrimary = GL_LUMINANCE; + mFormatType = GL_UNSIGNED_BYTE; + break; + case 2: + // Use luminance alpha (for fonts) + mFormatInternal = GL_LUMINANCE8_ALPHA8; + mFormatPrimary = GL_LUMINANCE_ALPHA; + mFormatType = GL_UNSIGNED_BYTE; + break; + case 3: +#if USE_SRGB_DECODE + if (gGLManager.mHasTexturesRGBDecode) + { + mFormatInternal = GL_SRGB8; + } + else +#endif + { + mFormatInternal = GL_RGB8; + } + mFormatPrimary = GL_RGB; + mFormatType = GL_UNSIGNED_BYTE; + break; + case 4: +#if USE_SRGB_DECODE + if (gGLManager.mHasTexturesRGBDecode) + { + mFormatInternal = GL_SRGB8_ALPHA8; + } + else +#endif + { + mFormatInternal = GL_RGBA8; + } + mFormatPrimary = GL_RGBA; + mFormatType = GL_UNSIGNED_BYTE; + break; + default: + LL_ERRS() << "Bad number of components for texture: " << (U32) getComponents() << LL_ENDL; + } + } - mCurrentDiscardLevel = discard_level; + mCurrentDiscardLevel = discard_level; mDiscardLevelInAtlas = discard_level; mTexelsInAtlas = raw_image->getWidth() * raw_image->getHeight() ; mLastBindTime = sLastFrameTime; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index ebc4659bcf..eb9da34ca8 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -849,26 +849,32 @@ void LLTexUnit::debugTextureUnit(void) } } -void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) { +void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) +{ mTexColorSpace = space; #if USE_SRGB_DECODE - if (gGLManager.mHasTexturesRGBDecode) { - - if (space == TCS_SRGB) { + if (gGLManager.mHasTexturesRGBDecode) + { + if (space == TCS_SRGB) + { glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT); } - else { + else + { glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); } - if (gDebugGL) { + if (gDebugGL) + { assert_glerror(); } } + else #endif - glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); - + { + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); + } } LLLightState::LLLightState(S32 index) diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 9fb4f7f2b0..e3c0255290 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -501,23 +501,23 @@ U32 LLRenderTarget::getNumTextures() const return mTex.size(); } - void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) { - gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index)); + gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index)); bool isSRGB = false; llassert(mInternalFormat.size() > index); switch (mInternalFormat[index]) { - case GL_SRGB_ALPHA: case GL_SRGB: + case GL_SRGB8: + case GL_SRGB_ALPHA: case GL_SRGB8_ALPHA8: isSRGB = true; - break; + break; default: - break; + break; } gGL.getTexUnit(channel)->setTextureFilteringOption(filter_options); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 0d1cc81786..c6afda375c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -77,6 +77,7 @@ void main() vec3 norm = getNorm(frag.xy); vec4 spec = texture2DRect(specularRect, frag.xy); + spec.rgb = srgb_to_linear(spec.rgb); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; diff.rgb = srgb_to_linear(diff.rgb); -- cgit v1.2.3 From e19e628b0875a87468851825d516113534b4262f Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 8 Jun 2020 16:42:34 -0600 Subject: SL-13821 shader clean up and format --- .../shaders/class1/deferred/multiPointLightF.glsl | 204 ++++++++++----------- 1 file changed, 98 insertions(+), 106 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index c6afda375c..8c402fcb54 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -1,24 +1,24 @@ -/** - * @file multiPointLightF.glsl +/** + * @file class1/deferred/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$ */ @@ -36,120 +36,112 @@ out vec4 frag_color; uniform sampler2DRect depthMap; uniform sampler2DRect diffuseRect; uniform sampler2DRect specularRect; -uniform samplerCube environmentMap; -uniform sampler2D noiseMap; -uniform sampler2D lightFunc; +uniform samplerCube environmentMap; +uniform sampler2D noiseMap; +uniform sampler2D lightFunc; - -uniform vec3 env_mat[3]; +uniform vec3 env_mat[3]; uniform float sun_wash; +uniform int light_count; +uniform vec4 light[LIGHT_COUNT]; +uniform vec4 light_col[LIGHT_COUNT]; -uniform int light_count; - -uniform vec4 light[LIGHT_COUNT]; -uniform vec4 light_col[LIGHT_COUNT]; - -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - +uniform vec2 screen_res; uniform float far_z; +uniform mat4 inv_proj; -uniform mat4 inv_proj; +VARYING vec4 vary_fragcoord; vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 c); -void main() +void main() { - vec3 out_col = vec3(0,0,0); - #if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; - vec3 pos = getPosition(frag.xy).xyz; - if (pos.z < far_z) - { - discard; - } - - vec3 norm = getNorm(frag.xy); - - vec4 spec = texture2DRect(specularRect, frag.xy); - spec.rgb = srgb_to_linear(spec.rgb); - vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; - diff.rgb = srgb_to_linear(diff.rgb); - - float noise = texture2D(noiseMap, frag.xy/128.0).b; - 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 < LIGHT_COUNT; ++i) - { - vec3 lv = light[i].xyz-pos; - float dist = length(lv); - dist /= light[i].w; - if (dist <= 1.0) - { - float da = dot(norm, lv); - if (da > 0.0) - { - lv = normalize(lv); - da = dot(norm, lv); - - float fa = light_col[i].a+1.0; - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= dist_atten; - - // Tweak falloff slightly to match pre-EEP attenuation - // NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit - dist_atten *= 2.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) - { - lit = min(da*6.0, 1.0) * dist_atten; - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += lit*scol*light_col[i].rgb*spec.rgb; - //col += spec.rgb; - } - } - - out_col += col; - } - } - } + discard; // Bail immediately #endif - - frag_color.rgb = out_col; - frag_color.a = 0.0; + + vec3 out_col = vec3(0, 0, 0); + vec2 frag = (vary_fragcoord.xy * 0.5 + 0.5) * screen_res; + vec3 pos = getPosition(frag.xy).xyz; + if (pos.z < far_z) + { + discard; + } + + vec3 norm = getNorm(frag.xy); + + vec4 spec = texture2DRect(specularRect, frag.xy); + spec.rgb = srgb_to_linear(spec.rgb); + vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; + diff.rgb = srgb_to_linear(diff.rgb); + + float noise = texture2D(noiseMap, frag.xy / 128.0).b; + 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 < LIGHT_COUNT; ++i) + { + vec3 lv = light[i].xyz - pos; + float dist = length(lv); + dist /= light[i].w; + if (dist <= 1.0) + { + float da = dot(norm, lv); + if (da > 0.0) + { + lv = normalize(lv); + da = dot(norm, lv); + + float fa = light_col[i].a + 1.0; + float dist_atten = clamp(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 0.0, 1.0); + dist_atten *= dist_atten; + + // Tweak falloff slightly to match pre-EEP attenuation + // NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit + dist_atten *= 2.0; + + dist_atten *= noise; + + float lit = da * dist_atten; + + vec3 col = light_col[i].rgb * lit * diff; + + if (spec.a > 0.0) + { + lit = min(da * 6.0, 1.0) * dist_atten; + vec3 h = normalize(lv + npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5) * 0.4 + 0.5; + + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); + + if (nh > 0.0) + { + float scol = fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt / (nh * da); + col += lit * scol * light_col[i].rgb * spec.rgb; + } + } + + out_col += col; + } + } + } + + frag_color.rgb = out_col; + frag_color.a = 0.0; #ifdef IS_AMD_CARD - // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. - vec4 dummy1 = light[0]; - vec4 dummy2 = light_col[0]; - vec4 dummy3 = light[LIGHT_COUNT-1]; - vec4 dummy4 = light_col[LIGHT_COUNT-1]; + // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage + // awawy which leads to unfun crashes and artifacts. + vec4 dummy1 = light[0]; + vec4 dummy2 = light_col[0]; + vec4 dummy3 = light[LIGHT_COUNT - 1]; + vec4 dummy4 = light_col[LIGHT_COUNT - 1]; #endif } -- cgit v1.2.3 From c5f00ab478416cd847836dfaf6553f6f601259a2 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 16 Jun 2020 18:22:35 -0600 Subject: SL-13449, fix link errors for class1 soften shaders --- .../class1/windlight/atmosphericsVarsF.glsl | 27 +++++++++------ .../class1/windlight/atmosphericsVarsV.glsl | 40 ++++++++++++++++------ .../class1/windlight/atmosphericsVarsWaterF.glsl | 25 ++++++++------ .../class1/windlight/atmosphericsVarsWaterV.glsl | 40 +++++++++++++++------- .../class2/windlight/atmosphericsVarsF.glsl | 2 +- 5 files changed, 90 insertions(+), 44 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index a0699affbf..3b4d358cfa 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -1,30 +1,37 @@ -/** +/** * @file class1\windlight\atmosphericVarsF.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$ */ - -vec3 getPositionEye() -{ - return vec3(0,0,0); -} +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } + +vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); } + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getPositionEye() { 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 bd1d150fc8..1fea2c3628 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -1,36 +1,56 @@ -/** +/** * @file class1\windlight\atmosphericVarsV.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_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -vec3 getPositionEye() +vec3 additive_color; +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAdditiveColor() { return additive_color; } +void setAdditiveColor(vec3 v) { - return vec3(0,0,0); + additive_color = v; + vary_AdditiveColor = v; } -void setPositionEye(vec3 v) +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v) { - + atmos_attenuation = v; + vary_AtmosAttenuation = v; } + +vec3 getPositionEye() { return position_eye; } +void setPositionEye(vec3 v) { position_eye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl index 5dc086ab1e..f83434b7ec 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl @@ -1,33 +1,38 @@ -/** +/** * @file class1\windlight\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_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } -vec3 getPositionEye() -{ - return vary_PositionEye; -} +vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; } +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 index e59eca265a..65d1176777 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl @@ -1,37 +1,51 @@ -/** +/** * @file class1\windlight\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 vec3 vary_AtmosAttenuation; -vec3 getPositionEye() -{ - return vary_PositionEye; -} +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } -void setPositionEye(vec3 v) +vec3 getAdditiveColor() { return vary_AdditiveColor; } +void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v) { - vary_PositionEye = v; + atmos_attenuation = v; + vary_AtmosAttenuation = v; } + +vec3 getPositionEye() { return vary_PositionEye; } +void setPositionEye(vec3 v) { vary_PositionEye = v; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index d758f85d71..07733bda18 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -1,5 +1,5 @@ /** - * @file class2\wl\atmosphericVars.glsl + * @file class2\wl\atmosphericVarsF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code -- cgit v1.2.3 From aa5bd5d6f530f576556c9256714f01f2a35854bf Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 17 Jun 2020 18:53:05 -0600 Subject: SL-13163 revert 2 more instances of 'new EEP' specular calculation --- .../shaders/class1/deferred/materialF.glsl | 882 +++++++++++---------- .../shaders/class1/deferred/softenLightF.glsl | 34 +- 2 files changed, 447 insertions(+), 469 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 0afd1a9672..80d19102b6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -1,439 +1,443 @@ -/** -* @file materialF.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$ -*/ - -/*[EXTRA_CODE_HERE]*/ - -//class1/deferred/materialF.glsl - -// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass. - -#define DIFFUSE_ALPHA_MODE_NONE 0 -#define DIFFUSE_ALPHA_MODE_BLEND 1 -#define DIFFUSE_ALPHA_MODE_MASK 2 -#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 - -uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise -uniform int sun_up_factor; - -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 color); -#endif - -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); - -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); - -vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cs); - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -#ifdef HAS_SUN_SHADOW -float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); -#endif - -uniform samplerCube environmentMap; -uniform sampler2D lightFunc; - -// Inputs -uniform vec4 morphFactor; -uniform vec3 camPosLocal; -uniform mat3 env_mat; - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -VARYING vec2 vary_fragcoord; - -VARYING vec3 vary_position; - -uniform mat4 proj_mat; -uniform mat4 inv_proj; -uniform vec2 screen_res; - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec4 light_attenuation[8]; -uniform vec3 light_diffuse[8]; - -float getAmbientClamp(); - -vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance) -{ - vec3 col = vec3(0); - - //get light vector - vec3 lv = lp.xyz - v; - - //get distance - float dist = length(lv); - float da = 1.0; - - dist /= la; - - if (dist > 0.0 && la > 0.0) - { - //normalize light vector - lv = normalize(lv); - - //distance attenuation - float dist_atten = clamp(1.0 - (dist - 1.0*(1.0 - fa)) / fa, 0.0, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0f; - - if (dist_atten <= 0.0) - { - return col; - } - - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 - - //angular attenuation - da *= dot(n, lv); - - float lit = 0.0f; - - float amb_da = ambiance; - if (da >= 0) - { - lit = max(da * dist_atten, 0.0); - col = lit * light_col * diffuse; - amb_da += (da*0.5 + 0.5) * ambiance; - } - amb_da += (da*da*0.5 + 0.5) * ambiance; - amb_da *= dist_atten; - amb_da = min(amb_da, 1.0f - lit); - - // SL-10969 need to see why these are blown out - //col.rgb += amb_da * light_col * diffuse; - - if (spec.a > 0.0) - { - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv + npos); - float nh = dot(n, h); - float nv = dot(n, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); - vec3 speccol = lit*scol*light_col.rgb*spec.rgb; - speccol = clamp(speccol, vec3(0), vec3(1)); - col += speccol; - - float cur_glare = max(speccol.r, speccol.g); - cur_glare = max(cur_glare, speccol.b); - glare = max(glare, speccol.r); - glare += max(cur_glare, 0.0); - } - } - } - - return max(col, vec3(0.0, 0.0, 0.0)); -} - -#else -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif -#endif - -uniform sampler2D diffuseMap; //always in sRGB space - -#ifdef HAS_NORMAL_MAP -uniform sampler2D bumpMap; -#endif - -#ifdef HAS_SPECULAR_MAP -uniform sampler2D specularMap; - -VARYING vec2 vary_texcoord2; -#endif - -uniform float env_intensity; -uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) -uniform float minimum_alpha; -#endif - -#ifdef HAS_NORMAL_MAP -VARYING vec3 vary_mat0; -VARYING vec3 vary_mat1; -VARYING vec3 vary_mat2; -VARYING vec2 vary_texcoord1; -#else -VARYING vec3 vary_normal; -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -vec2 encode_normal(vec3 n); - -void main() -{ - vec2 pos_screen = vary_texcoord0.xy; - - vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy); - diffcol.rgb *= vertex_color.rgb; - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) - - // Comparing floats cast from 8-bit values, produces acne right at the 8-bit transition points - float bias = 0.001953125; // 1/512, or half an 8-bit quantization - if (diffcol.a < minimum_alpha-bias) - { - discard; - } -#endif - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - vec3 gamma_diff = diffcol.rgb; - diffcol.rgb = srgb_to_linear(diffcol.rgb); -#endif - -#ifdef HAS_SPECULAR_MAP - vec4 spec = texture2D(specularMap, vary_texcoord2.xy); - spec.rgb *= specular_color.rgb; -#else - vec4 spec = vec4(specular_color.rgb, 1.0); -#endif - -#ifdef HAS_NORMAL_MAP - vec4 norm = texture2D(bumpMap, vary_texcoord1.xy); - - norm.xyz = norm.xyz * 2 - 1; - - vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), - dot(norm.xyz,vary_mat1), - dot(norm.xyz,vary_mat2)); -#else - vec4 norm = vec4(0,0,0,1.0); - vec3 tnorm = vary_normal; -#endif - - norm.xyz = normalize(tnorm.xyz); - - vec2 abnormal = encode_normal(norm.xyz); - - vec4 final_color = diffcol; - -#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) - final_color.a = emissive_brightness; -#else - final_color.a = max(final_color.a, emissive_brightness); -#endif - - vec4 final_specular = spec; - -#ifdef HAS_SPECULAR_MAP - vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity * spec.a, 0.0); - final_specular.a = specular_color.a * norm.a; -#else - vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0); - final_specular.a = specular_color.a; -#endif - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - - //forward rendering, output just lit sRGBA - vec3 pos = vary_position; - - float shadow = 1.0f; - -#ifdef HAS_SUN_SHADOW - shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen); -#endif - - spec = final_specular; - vec4 diffuse = final_color; - float envIntensity = final_normal.z; - - vec3 color = vec3(0,0,0); - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - - float bloom = 0.0; - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - - calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); - - // This call breaks the Mac GLSL compiler/linker for unknown reasons (17Mar2020) - // The call is either a no-op or a pure (pow) gamma adjustment, depending on GPU level - // TODO: determine if we want to re-apply the gamma adjustment, and if so understand & fix Mac breakage - //color = fullbrightScaleSoftClip(color); - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - //we're in sRGB space, so gamma correct this dot product so - // lighting from the sun stays sharp - float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); - da = pow(da, 1.0 / 1.3); - - color = amblit; - - //darken ambient for normals perpendicular to light vector so surfaces in shadow - // and facing away from light still have some definition to them. - // do NOT gamma correct this dot product so ambient lighting stays soft - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - vec3 sun_contrib = min(da, shadow) * sunlit; - - color *= ambient; - - color += sun_contrib; - - color *= gamma_diff.rgb; - - float glare = 0.0; - - if (spec.a > 0.0) // specular reflection - { -#if 1 //EEP - - vec3 npos = -normalize(pos.xyz); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(light_dir.xyz + npos); - float nh = dot(norm.xyz, h); - float nv = dot(norm.xyz, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); - vec3 sp = sun_contrib*scol / 6.0f; - sp = clamp(sp, vec3(0), vec3(1)); - bloom = dot(sp, sp) / 4.0; - color += sp * spec.rgb; - } -#else // PRODUCTION - float sa = dot(refnormpersp, sun_dir.xyz); - vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - - glare = max(spec_contrib.r, spec_contrib.g); - glare = max(glare, spec_contrib.b); - - color += spec_contrib; -#endif - } - - color = mix(color.rgb, diffcol.rgb, diffuse.a); - - if (envIntensity > 0.0) - { - //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - - color = mix(color, reflected_color, envIntensity); - - float cur_glare = max(reflected_color.r, reflected_color.g); - cur_glare = max(cur_glare, reflected_color.b); - cur_glare *= envIntensity*4.0; - glare += cur_glare; - } - - color = atmosFragLighting(color, additive, atten); - color = scaleSoftClipFrag(color); - - //convert to linear before adding local lights - color = srgb_to_linear(color); - - vec3 npos = normalize(-pos.xyz); - - vec3 light = vec3(0, 0, 0); - -#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); - - LIGHT_LOOP(1) - LIGHT_LOOP(2) - LIGHT_LOOP(3) - LIGHT_LOOP(4) - LIGHT_LOOP(5) - LIGHT_LOOP(6) - LIGHT_LOOP(7) - - color += light; - - glare = min(glare, 1.0); - float al = max(diffcol.a, glare)*vertex_color.a; - - //convert to srgb as this color is being written post gamma correction - color = linear_to_srgb(color); - -#ifdef WATER_FOG - vec4 temp = applyWaterFogView(pos, vec4(color, al)); - color = temp.rgb; - al = temp.a; -#endif - - frag_color = vec4(color, al); - -#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer - - // deferred path - frag_data[0] = final_color; //gbuffer is sRGB - frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. - frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. -#endif -} - +/** +* @file materialF.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$ +*/ + +/*[EXTRA_CODE_HERE]*/ + +//class1/deferred/materialF.glsl + +// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass. + +#define DIFFUSE_ALPHA_MODE_NONE 0 +#define DIFFUSE_ALPHA_MODE_BLEND 1 +#define DIFFUSE_ALPHA_MODE_MASK 2 +#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 + +uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise +uniform int sun_up_factor; + +#ifdef WATER_FOG +vec4 applyWaterFogView(vec3 pos, vec4 color); +#endif + +vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); +vec3 scaleSoftClipFrag(vec3 l); + +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); +vec3 fullbrightScaleSoftClip(vec3 light); + +void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); + +vec3 srgb_to_linear(vec3 cs); +vec3 linear_to_srgb(vec3 cs); + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +#ifdef HAS_SUN_SHADOW +float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); +#endif + +uniform samplerCube environmentMap; +uniform sampler2D lightFunc; + +// Inputs +uniform vec4 morphFactor; +uniform vec3 camPosLocal; +uniform mat3 env_mat; + +uniform vec3 sun_dir; +uniform vec3 moon_dir; +VARYING vec2 vary_fragcoord; + +VARYING vec3 vary_position; + +uniform mat4 proj_mat; +uniform mat4 inv_proj; +uniform vec2 screen_res; + +uniform vec4 light_position[8]; +uniform vec3 light_direction[8]; +uniform vec4 light_attenuation[8]; +uniform vec3 light_diffuse[8]; + +float getAmbientClamp(); + +vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance) +{ + vec3 col = vec3(0); + + //get light vector + vec3 lv = lp.xyz - v; + + //get distance + float dist = length(lv); + float da = 1.0; + + dist /= la; + + if (dist > 0.0 && la > 0.0) + { + //normalize light vector + lv = normalize(lv); + + //distance attenuation + float dist_atten = clamp(1.0 - (dist - 1.0*(1.0 - fa)) / fa, 0.0, 1.0); + dist_atten *= dist_atten; + dist_atten *= 2.0f; + + if (dist_atten <= 0.0) + { + return col; + } + + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 + + //angular attenuation + da *= dot(n, lv); + + float lit = 0.0f; + + float amb_da = ambiance; + if (da >= 0) + { + lit = max(da * dist_atten, 0.0); + col = lit * light_col * diffuse; + amb_da += (da*0.5 + 0.5) * ambiance; + } + amb_da += (da*da*0.5 + 0.5) * ambiance; + amb_da *= dist_atten; + amb_da = min(amb_da, 1.0f - lit); + + // SL-10969 need to see why these are blown out + //col.rgb += amb_da * light_col * diffuse; + + if (spec.a > 0.0) + { + //vec3 ref = dot(pos+lv, norm); + vec3 h = normalize(lv + npos); + float nh = dot(n, h); + float nv = dot(n, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; + + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); + + if (nh > 0.0) + { + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); + vec3 speccol = lit*scol*light_col.rgb*spec.rgb; + speccol = clamp(speccol, vec3(0), vec3(1)); + col += speccol; + + float cur_glare = max(speccol.r, speccol.g); + cur_glare = max(cur_glare, speccol.b); + glare = max(glare, speccol.r); + glare += max(cur_glare, 0.0); + } + } + } + + return max(col, vec3(0.0, 0.0, 0.0)); +} + +#else +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData +#endif +#endif + +uniform sampler2D diffuseMap; //always in sRGB space + +#ifdef HAS_NORMAL_MAP +uniform sampler2D bumpMap; +#endif + +#ifdef HAS_SPECULAR_MAP +uniform sampler2D specularMap; + +VARYING vec2 vary_texcoord2; +#endif + +uniform float env_intensity; +uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) +uniform float minimum_alpha; +#endif + +#ifdef HAS_NORMAL_MAP +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; +VARYING vec2 vary_texcoord1; +#else +VARYING vec3 vary_normal; +#endif + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + +vec2 encode_normal(vec3 n); + +void main() +{ + vec2 pos_screen = vary_texcoord0.xy; + + vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy); + diffcol.rgb *= vertex_color.rgb; + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) + + // Comparing floats cast from 8-bit values, produces acne right at the 8-bit transition points + float bias = 0.001953125; // 1/512, or half an 8-bit quantization + if (diffcol.a < minimum_alpha-bias) + { + discard; + } +#endif + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + vec3 gamma_diff = diffcol.rgb; + diffcol.rgb = srgb_to_linear(diffcol.rgb); +#endif + +#ifdef HAS_SPECULAR_MAP + vec4 spec = texture2D(specularMap, vary_texcoord2.xy); + spec.rgb *= specular_color.rgb; +#else + vec4 spec = vec4(specular_color.rgb, 1.0); +#endif + +#ifdef HAS_NORMAL_MAP + vec4 norm = texture2D(bumpMap, vary_texcoord1.xy); + + norm.xyz = norm.xyz * 2 - 1; + + vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), + dot(norm.xyz,vary_mat1), + dot(norm.xyz,vary_mat2)); +#else + vec4 norm = vec4(0,0,0,1.0); + vec3 tnorm = vary_normal; +#endif + + norm.xyz = normalize(tnorm.xyz); + + vec2 abnormal = encode_normal(norm.xyz); + + vec4 final_color = diffcol; + +#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) + final_color.a = emissive_brightness; +#else + final_color.a = max(final_color.a, emissive_brightness); +#endif + + vec4 final_specular = spec; + +#ifdef HAS_SPECULAR_MAP + vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity * spec.a, 0.0); + final_specular.a = specular_color.a * norm.a; +#else + vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0); + final_specular.a = specular_color.a; +#endif + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + + //forward rendering, output just lit sRGBA + vec3 pos = vary_position; + + float shadow = 1.0f; + +#ifdef HAS_SUN_SHADOW + shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen); +#endif + + spec = final_specular; + vec4 diffuse = final_color; + float envIntensity = final_normal.z; + + vec3 color = vec3(0,0,0); + + vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + + float bloom = 0.0; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + + calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false); + + // This call breaks the Mac GLSL compiler/linker for unknown reasons (17Mar2020) + // The call is either a no-op or a pure (pow) gamma adjustment, depending on GPU level + // TODO: determine if we want to re-apply the gamma adjustment, and if so understand & fix Mac breakage + //color = fullbrightScaleSoftClip(color); + + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); + + //we're in sRGB space, so gamma correct this dot product so + // lighting from the sun stays sharp + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); + da = pow(da, 1.0 / 1.3); + + color = amblit; + + //darken ambient for normals perpendicular to light vector so surfaces in shadow + // and facing away from light still have some definition to them. + // do NOT gamma correct this dot product so ambient lighting stays soft + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + + vec3 sun_contrib = min(da, shadow) * sunlit; + + color *= ambient; + + color += sun_contrib; + + color *= gamma_diff.rgb; + + float glare = 0.0; + + if (spec.a > 0.0) // specular reflection + { + /* // Reverting this specular calculation to previous 'dumbshiny' version - DJH 6/17/2020 + // Preserving the refactored version as a comment for potential reconsideration, + // overriding the general rule to avoid pollutiong the source with commented code. + // + // If you're reading this in 2021+, feel free to obliterate. + + vec3 npos = -normalize(pos.xyz); + + //vec3 ref = dot(pos+lv, norm); + vec3 h = normalize(light_dir.xyz + npos); + float nh = dot(norm.xyz, h); + float nv = dot(norm.xyz, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5; + + float gtdenom = 2 * nh; + float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); + + if (nh > 0.0) + { + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); + vec3 sp = sun_contrib*scol / 6.0f; + sp = clamp(sp, vec3(0), vec3(1)); + bloom = dot(sp, sp) / 4.0; + color += sp * spec.rgb; + } + */ + + float sa = dot(refnormpersp, sun_dir.xyz); + vec3 dumbshiny = sunlit * shadow * (texture2D(lightFunc, vec2(sa, spec.a)).r); + + // add the two types of shiny together + vec3 spec_contrib = dumbshiny * spec.rgb; + bloom = dot(spec_contrib, spec_contrib) / 6; + + glare = max(spec_contrib.r, spec_contrib.g); + glare = max(glare, spec_contrib.b); + + color += spec_contrib; + } + + color = mix(color.rgb, diffcol.rgb, diffuse.a); + + if (envIntensity > 0.0) + { + //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + + vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; + + color = mix(color, reflected_color, envIntensity); + + float cur_glare = max(reflected_color.r, reflected_color.g); + cur_glare = max(cur_glare, reflected_color.b); + cur_glare *= envIntensity*4.0; + glare += cur_glare; + } + + color = atmosFragLighting(color, additive, atten); + color = scaleSoftClipFrag(color); + + //convert to linear before adding local lights + color = srgb_to_linear(color); + + vec3 npos = normalize(-pos.xyz); + + vec3 light = vec3(0, 0, 0); + +#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + + color += light; + + glare = min(glare, 1.0); + float al = max(diffcol.a, glare)*vertex_color.a; + + //convert to srgb as this color is being written post gamma correction + color = linear_to_srgb(color); + +#ifdef WATER_FOG + vec4 temp = applyWaterFogView(pos, vec4(color, al)); + color = temp.rgb; + al = temp.a; +#endif + + frag_color = vec4(color, al); + +#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer + + // deferred path + frag_data[0] = final_color; //gbuffer is sRGB + frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. + frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. +#endif +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index a5804220bc..f80f1a985a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -124,41 +124,15 @@ void main() if (spec.a > 0.0) // specular reflection { + float sa = dot(refnormpersp, light_dir.xyz); + vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r); -#if 1 //EEP - vec3 npos = -normalize(pos.xyz); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(light_dir.xyz+npos); - float nh = dot(norm.xyz, h); - float nv = dot(norm.xyz, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - vec3 sp = sun_contrib*scontrib / 6.0; - sp = clamp(sp, vec3(0), vec3(1)); - bloom += dot(sp, sp) / 4.0; - color += sp * spec.rgb; - } -#else //PRODUCTION - float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); - // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; + bloom = dot(spec_contrib, spec_contrib) / 6; color.rgb += spec_contrib; -#endif - } - + color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); if (envIntensity > 0.0) -- cgit v1.2.3 From b490a59ce245202fa7cc186694d5ae1ca100b9e9 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 18 Jun 2020 10:39:49 -0700 Subject: SL-9632: Fix most HUD objects incorrectly being effected by the environment lighting --- .../shaders/class1/objects/simpleV.glsl | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index a59bd9c0a6..575a641b7a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -1,4 +1,4 @@ -/** +/** * @file simpleV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ @@ -28,6 +28,9 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; +// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() +uniform int no_atmo; + ATTRIBUTE vec3 position; void passTextureIndex(); ATTRIBUTE vec2 texcoord0; @@ -46,19 +49,22 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); - vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + + passTextureIndex(); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - - - vec3 norm = normalize(normal_matrix * normal); + if (no_atmo == 1) + { + vertex_color = diffuse_color; + } + else + { + vec4 pos = (modelview_matrix * vert); + vec3 norm = normalize(normal_matrix * normal); - calcAtmospherics(pos.xyz); + calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, diffuse_color); - vertex_color = color; - - + vertex_color = calcLighting(pos.xyz, norm, diffuse_color); + } } -- cgit v1.2.3 From 7f9765a41cb62102c9cbde0d44151ca9f487adac Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 18 Jun 2020 15:15:54 -0700 Subject: SL-9632 Fix HUD objects to not use environment lighting --- .../shaders/class1/deferred/fullbrightShinyF.glsl | 38 +++++++++++++--------- .../class1/lighting/lightFullbrightShinyF.glsl | 20 +++++++++--- .../shaders/class1/objects/simpleV.glsl | 3 +- 3 files changed, 40 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index bd0ad3bce8..2d40e63eff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -42,6 +42,9 @@ VARYING vec4 vary_position; uniform samplerCube environmentMap; +// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() +uniform int no_atmo; + vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); vec3 fullbrightScaleSoftClip(vec3 light); @@ -51,7 +54,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 linear_to_srgb(vec3 c); vec3 srgb_to_linear(vec3 c); - +// See: +// class1\deferred\fullbrightShinyF.glsl +// class1\lighting\lightFullbrightShinyF.glsl void main() { #ifdef HAS_DIFFUSE_LOOKUP @@ -59,25 +64,28 @@ void main() #else vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); #endif - + color.rgb *= vertex_color.rgb; - vec3 pos = vary_position.xyz/vary_position.w; - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; + // SL-9632 HUDs are affected by Atmosphere + if (no_atmo == 0) + { + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + vec3 pos = vary_position.xyz/vary_position.w; + + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + float env_intensity = vertex_color.a; //color.rgb = srgb_to_linear(color.rgb); - - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); + color.rgb = mix(color.rgb, envColor.rgb, env_intensity); + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = fullbrightScaleSoftClip(color.rgb); + } color.a = 1.0; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 567811cd75..3eaaa41866 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -35,20 +35,30 @@ VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; +// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() +uniform int no_atmo; + vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); +// See: +// class1\deferred\fullbrightShinyF.glsl +// class1\lighting\lightFullbrightShinyF.glsl void fullbright_shiny_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy); color.rgb *= vertex_color.rgb; - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low - color.rgb = fullbrightShinyAtmosTransport(color.rgb); + // SL-9632 HUDs are affected by Atmosphere + if (no_atmo == 0) + { + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low + + color.rgb = fullbrightShinyAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); + color.rgb = fullbrightScaleSoftClip(color.rgb); + } color.a = 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 575a641b7a..9ef7704b70 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -53,7 +53,8 @@ void main() passTextureIndex(); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; - + + // SL-9632 HUDs are affected by Atmosphere if (no_atmo == 1) { vertex_color = diffuse_color; -- cgit v1.2.3 From 0e3e3db40ea3778f65b36df781f1aacb5b9bd59c Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 19 Jun 2020 16:41:19 -0600 Subject: SL-13416 eliminate sun/moon specular on shadowed surfaces --- .../shaders/class2/deferred/softenLightF.glsl | 169 +++++++++------------ 1 file changed, 76 insertions(+), 93 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 40f0f0448a..f4db53e0b7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class2/deferred/softenLightF.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$ */ @@ -39,7 +39,7 @@ uniform sampler2DRect specularRect; uniform sampler2DRect normalMap; uniform sampler2DRect lightMap; uniform sampler2DRect depthMap; -uniform samplerCube environmentMap; +uniform samplerCube environmentMap; uniform sampler2D lightFunc; uniform float blur_size; @@ -50,7 +50,7 @@ uniform mat3 env_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; -uniform int sun_up_factor; +uniform int sun_up_factor; VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; @@ -61,10 +61,10 @@ vec4 getPositionWithDepth(vec2 pos_screen, float depth); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); float getAmbientClamp(); -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); +vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); +vec3 scaleSoftClipFrag(vec3 l); +vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); +vec3 fullbrightScaleSoftClip(vec3 light); vec3 linear_to_srgb(vec3 c); vec3 srgb_to_linear(vec3 c); @@ -73,102 +73,85 @@ vec3 srgb_to_linear(vec3 c); vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -void main() +void main() { - vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2DRect(normalMap, tc); + vec2 tc = vary_fragcoord.xy; + float depth = texture2DRect(depthMap, tc.xy).r; + vec4 pos = getPositionWithDepth(tc, depth); + vec4 norm = texture2DRect(normalMap, tc); float envIntensity = norm.z; - norm.xyz = getNorm(tc); - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); - float light_gamma = 1.0/1.3; - da = pow(da, light_gamma); - + norm.xyz = getNorm(tc); + + vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); + float light_gamma = 1.0 / 1.3; + da = pow(da, light_gamma); + vec4 diffuse = texture2DRect(diffuseRect, tc); - - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; - scol_ambocc = pow(scol_ambocc, vec2(light_gamma)); + scol_ambocc = pow(scol_ambocc, vec2(light_gamma)); + float scol = max(scol_ambocc.r, diffuse.a); + float ambocc = scol_ambocc.g; - float scol = max(scol_ambocc.r, diffuse.a); + vec3 color = vec3(0); + float bloom = 0.0; - float ambocc = scol_ambocc.g; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - vec3 color = vec3(0); - float bloom = 0.0; + color.rgb = amblit; + + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + color.rgb *= ambient; + + vec3 sun_contrib = min(da, scol) * sunlit; + color.rgb += sun_contrib; + color.rgb *= diffuse.rgb; + + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); + + if (spec.a > 0.0) // specular reflection { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - - calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - - color.rgb = amblit; - - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - color.rgb *= ambient; - - vec3 sun_contrib = min(da, scol) * sunlit; - - color.rgb += sun_contrib; - - color.rgb *= diffuse.rgb; - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - if (spec.a > 0.0) // specular reflection - { - float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - color.rgb += spec_contrib; - } - - color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); - - if (envIntensity > 0.0) - { //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - color = mix(color.rgb, reflected_color, envIntensity); - } - - if (norm.w < 0.5) - { - color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a); - color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a); - } - - #ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz,vec4(color, bloom)); - color = fogged.rgb; - bloom = fogged.a; - #endif + float sa = dot(refnormpersp, light_dir.xyz); + vec3 dumbshiny = sunlit * scol * (texture2D(lightFunc, vec2(sa, spec.a)).r); + + // add the two types of shiny together + vec3 spec_contrib = dumbshiny * spec.rgb; + bloom = dot(spec_contrib, spec_contrib) / 6; + color.rgb += spec_contrib; + } + + color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); + + if (envIntensity > 0.0) + { // add environmentmap + vec3 env_vec = env_mat * refnormpersp; + vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; + color = mix(color.rgb, reflected_color, envIntensity); + } + if (norm.w < 0.5) + { + color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a); + color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a); } -// linear debuggables -//color.rgb = vec3(final_da); -//color.rgb = vec3(ambient); -//color.rgb = vec3(scol); -//color.rgb = diffuse_srgb.rgb; +#ifdef WATER_FOG + vec4 fogged = applyWaterFogView(pos.xyz, vec4(color, bloom)); + color = fogged.rgb; + bloom = fogged.a; +#endif // convert to linear as fullscreen lights need to sum in linear colorspace // and will be gamma (re)corrected downstream... - frag_color.rgb = srgb_to_linear(color.rgb); - frag_color.a = bloom; + frag_color.a = bloom; } - -- cgit v1.2.3 From 38e585f5be6a1604aefd183d498070eae73dac0b Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 23 Jul 2020 11:22:10 -0600 Subject: DRTVWR-510, trigger new build --- indra/edit-me-to-trigger-new-build.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index c76e18f480..0cad6370a9 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1,4 +1,2 @@ euclid 5/29/2020 - - - +euclid 7/23/2020 -- cgit v1.2.3 From 88e7c15c2b38f1917d1939b8af39dbf499db11dd Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 24 Sep 2020 11:20:09 -0700 Subject: SL-13888 Restore back face culling being accidently removed in SL-12781 --- indra/newview/llfloatermodelpreview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index bc44e37c5a..842edd565b 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3646,6 +3646,7 @@ BOOL LLModelPreview::render() LLGLSUIDefault def; // GL_BLEND, GL_ALPHA_TEST, GL_CULL_FACE, depth test LLGLDisable no_blend(GL_BLEND); + LLGLEnable cull(GL_CULL_FACE); LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color LLGLDisable fog(GL_FOG); -- cgit v1.2.3 From 4c44366c0ba6dc8e464fb887d0bf1eb6661e9f1f Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 24 Sep 2020 11:26:46 -0700 Subject: SL-13888 Coding Standard: be consistent; use TAB indent --- indra/newview/llfloatermodelpreview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 842edd565b..5016dc3e3e 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3646,7 +3646,7 @@ BOOL LLModelPreview::render() LLGLSUIDefault def; // GL_BLEND, GL_ALPHA_TEST, GL_CULL_FACE, depth test LLGLDisable no_blend(GL_BLEND); - LLGLEnable cull(GL_CULL_FACE); + LLGLEnable cull(GL_CULL_FACE); LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color LLGLDisable fog(GL_FOG); -- cgit v1.2.3 From 7cd076c796126692c308df5416b42b24a96609fb Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 8 Oct 2020 16:48:25 -0600 Subject: DRTVWR-510 remove all LL_SOLARIS conditionals --- indra/llcommon/llapr.h | 2 +- indra/llcommon/llfasttimer.cpp | 8 +- indra/llcommon/llfasttimer.h | 10 +- indra/llcommon/llmemory.cpp | 31 +---- indra/llcommon/llpreprocessor.h | 11 +- indra/llcommon/llsdutil.cpp | 2 +- indra/llcommon/llstring.h | 10 +- indra/llcommon/llsys.cpp | 63 --------- indra/llcommon/llthread.cpp | 2 +- indra/llcommon/lltimer.cpp | 6 +- indra/llcommon/lltimer.h | 2 +- indra/llcommon/lluuid.cpp | 4 +- indra/llcommon/stdtypes.h | 2 +- indra/llmath/llmath.h | 3 - indra/llmath/llsdutil_math.cpp | 2 +- indra/llmessage/message.h | 4 - indra/llrender/llgl.cpp | 18 +-- indra/llrender/llglheaders.h | 237 +------------------------------- indra/llui/llresmgr.cpp | 3 - indra/llvfs/lldir.cpp | 3 - indra/llvfs/lldir.h | 5 - indra/llvfs/lldir_solaris.cpp | 266 ------------------------------------ indra/llvfs/lldir_solaris.h | 61 --------- indra/llvfs/llvfs.cpp | 24 ---- indra/llwindow/llwindowsdl.cpp | 48 +------ indra/newview/llappviewer.cpp | 4 +- indra/newview/llappviewerlinux.cpp | 10 -- indra/newview/lldirpicker.cpp | 4 +- indra/newview/lldirpicker.h | 2 +- indra/newview/llfeaturemanager.cpp | 5 - indra/newview/llfilepicker.cpp | 6 +- indra/newview/llfloaterreporter.cpp | 3 - indra/newview/llviewerjointmesh.cpp | 2 +- indra/newview/llviewerwindow.cpp | 4 +- indra/newview/llvoicevivox.cpp | 2 +- 35 files changed, 51 insertions(+), 818 deletions(-) delete mode 100644 indra/llvfs/lldir_solaris.cpp delete mode 100644 indra/llvfs/lldir_solaris.h (limited to 'indra') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 255b50c8d0..565d7cfb63 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -29,7 +29,7 @@ #ifndef LL_LLAPR_H #define LL_LLAPR_H -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include // Need PATH_MAX in APR headers... #endif diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 08ea668964..5b6a7b82f8 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -43,7 +43,7 @@ #if LL_WINDOWS #include "lltimer.h" -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX #include #include #include "lltimer.h" @@ -64,7 +64,7 @@ bool BlockTimer::sLog = false; std::string BlockTimer::sLogName = ""; bool BlockTimer::sMetricLog = false; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution #else U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution @@ -151,12 +151,12 @@ void BlockTimer::setLogLock(LLMutex* lock) //static -#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_DARWIN || LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) U64 BlockTimer::countsPerSecond() { return sClockResolution; } -#else // windows or x86-mac or x86-linux or x86-solaris +#else // windows or x86-mac or x86-linux U64 BlockTimer::countsPerSecond() { #if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 5628a05b00..dfc63d08a2 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -125,9 +125,9 @@ public: #endif -#if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) // - // Linux and Solaris implementation of CPU clock - non-x86. + // Linux implementation of CPU clock - non-x86. // This is accurate but SLOW! Only use out of desperation. // // Try to use the MONOTONIC clock if available, this is a constant time counter @@ -153,12 +153,12 @@ public: return (U32)(getCPUClockCount64() >> 8); } -#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) // - // Mac+Linux+Solaris FAST x86 implementation of CPU clock + // Mac+Linux FAST x86 implementation of CPU clock static U32 getCPUClockCount32() { U32 low(0),high(0); diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 1884d6f04f..7cf4bc0706 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -35,7 +35,7 @@ # include # include # include -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #endif @@ -309,35 +309,6 @@ U64 LLMemory::getCurrentRSS() return rss; } -#elif LL_SOLARIS -#include -#include -#include -#define _STRUCTURED_PROC 1 -#include - -U64 LLMemory::getCurrentRSS() -{ - char path [LL_MAX_PATH]; /* Flawfinder: ignore */ - - sprintf(path, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(path, O_RDONLY)) == -1){ - LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - return((U64)proc_psinfo.pr_rssize * 1024); -} - #else U64 LLMemory::getCurrentRSS() diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index bae402110a..b17a8e761a 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -34,16 +34,7 @@ #include #endif // LL_LINUX -#if LL_SOLARIS -# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported. -# define LL_BIG_ENDIAN 1 -# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed -# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API -# endif -# include // ensure we know which end is up -#endif // LL_SOLARIS - -#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__))) #define LL_LITTLE_ENDIAN 1 #else #define LL_BIG_ENDIAN 1 diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 3f3edb661f..eb3a96b133 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -33,7 +33,7 @@ #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include // for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #elif LL_DARWIN # include diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6b1a1e0a03..4263122f36 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -37,7 +37,7 @@ #include #include "llformat.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #include #endif @@ -45,16 +45,10 @@ #include #include -#if LL_SOLARIS -// stricmp and strnicmp do not exist on Solaris: -#define stricmp strcasecmp -#define strnicmp strncasecmp -#endif - const char LL_UNKNOWN_CHAR = '?'; class LLSD; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) #include diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1f8d558fbe..084546fba6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -87,17 +87,6 @@ using namespace llsd; # include const char MEMINFO_FILE[] = "/proc/meminfo"; # include -#elif LL_SOLARIS -# include -# include -# include -# define _STRUCTURED_PROC 1 -# include -# include -# include -# include -# include -extern int errno; #endif LLCPUInfo gSysCPU; @@ -543,8 +532,6 @@ const std::string& LLOSInfo::getOSVersionString() const U32 LLOSInfo::getProcessVirtualSizeKB() { U32 virtual_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX # define STATUS_SIZE 2048 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); @@ -564,24 +551,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - virtual_size = proc_psinfo.pr_size; #endif return virtual_size; } @@ -590,8 +559,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() U32 LLOSInfo::getProcessResidentSizeKB() { U32 resident_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); if (status_filep != NULL) @@ -610,24 +577,6 @@ U32 LLOSInfo::getProcessResidentSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - resident_size = proc_psinfo.pr_rssize; #endif return resident_size; } @@ -772,11 +721,6 @@ U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const phys = (U64)(getpagesize()) * (U64)(get_phys_pages()); return U64Bytes(phys); -#elif LL_SOLARIS - U64 phys = 0; - phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES)); - return U64Bytes(phys); - #else return 0; @@ -1074,13 +1018,6 @@ LLSD LLMemoryInfo::loadStatsMap() } } -#elif LL_SOLARIS - U64 phys = 0; - - phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - - stats.add("Total Physical KB", phys); - #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); if (meminfo.is_open()) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 0b9dec969c..98905f3b71 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -36,7 +36,7 @@ #include "lltracethreadrecorder.h" #include "llexception.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #endif diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 76e892212a..aaa6df325c 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -32,7 +32,7 @@ #if LL_WINDOWS # include "llwin32headerslean.h" -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN # include # include #else @@ -74,7 +74,7 @@ U32 micro_sleep(U64 us, U32 max_yields) ms_sleep((U32)(us / 1000)); return 0; } -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN static void _sleep_loop(struct timespec& thiswait) { struct timespec nextwait; @@ -187,7 +187,7 @@ F64 calc_clock_frequency() #endif // LL_WINDOWS -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN // Both Linux and Mac use gettimeofday for accurate time F64 calc_clock_frequency() { diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index ec70213447..010f290b24 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -27,7 +27,7 @@ #ifndef LL_TIMER_H #define LL_TIMER_H -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN #include #endif #include diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index b05630c6b5..e3b293e465 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -601,9 +601,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id) #define HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H #include -#if LL_SOLARIS -#include -#elif !LL_DARWIN +#if !LL_DARWIN #include #endif #endif diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index 6c9871e76c..887f6ab733 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -57,7 +57,7 @@ typedef unsigned __int64 U64; #else typedef long long int S64; typedef long long unsigned int U64; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX #define S64L(a) (a##LL) #define U64L(a) (a##ULL) #endif diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 8f01ad6c1c..e4ccd81faf 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -47,9 +47,6 @@ #elif (LL_LINUX && __GNUC__ <= 2) #define llisnan(val) isnan(val) #define llfinite(val) isfinite(val) -#elif LL_SOLARIS -#define llisnan(val) isnan(val) -#define llfinite(val) (val <= std::numeric_limits::max()) #else #define llisnan(val) std::isnan(val) #define llfinite(val) std::isfinite(val) diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp index 591f7fde36..51e5e3764f 100644 --- a/indra/llmath/llsdutil_math.cpp +++ b/indra/llmath/llsdutil_math.cpp @@ -40,7 +40,7 @@ #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include // for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #elif LL_DARWIN # include diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 52dbf871db..e25a9ea7ef 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -35,10 +35,6 @@ #include #endif -#if LL_SOLARIS -#include -#endif - #if LL_WINDOWS #include "winsock2.h" // htons etc. #endif diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 372ab4a5e3..ada5371c1a 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -151,7 +151,7 @@ LLMatrix4 gGLObliqueProjectionInverse; std::list LLGLUpdate::sGLQ; -#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS // ATI prototypes #if LL_WINDOWS @@ -328,7 +328,7 @@ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; #endif // vertex shader prototypes -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; @@ -347,7 +347,7 @@ PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL; PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB = NULL; PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB = NULL; PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB = NULL; @@ -355,7 +355,7 @@ PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB = NULL; PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB = NULL; PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB = NULL; PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB = NULL; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; @@ -393,7 +393,7 @@ PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL; PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; @@ -1093,7 +1093,7 @@ void LLGLManager::initExtensions() mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts)); #endif -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL; // Our extension support for the Linux Client is very young with some // potential driver gotchas, so offer a semi-secret way to turn it off. @@ -1163,7 +1163,7 @@ void LLGLManager::initExtensions() if (strchr(blacklist,'u')) mHasDepthClamp = FALSE; } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX if (!mHasMultitexture) { @@ -1241,7 +1241,7 @@ void LLGLManager::initExtensions() glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize); -#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS +#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; if (mHasVertexBufferObject) { @@ -1340,7 +1340,7 @@ void LLGLManager::initExtensions() glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB"); glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB"); } -#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS +#if (!LL_LINUX) || LL_LINUX_NV_GL_HEADERS // This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements"); if (!glDrawRangeElements) diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 36fbb381bb..6bca3623e0 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -27,242 +27,7 @@ #ifndef LL_LLGLHEADERS_H #define LL_LLGLHEADERS_H -#if LL_SOLARIS -# if defined(__sparc) -# define I_NEED_OS2_H // avoiding BOOL conflicts -# endif -# include "GL/gl.h" -# if defined(__sparc) -# undef I_NEED_OS2_H -# ifdef BOOL -# undef BOOL // now get rid of Xmd.h crap -# endif -# endif -# include "GL/glx.h" -# define GL_GLEXT_PROTOTYPES 1 -# include "GL/glext.h" -# include "GL/glu.h" -# include "GL/glx.h" -# define GLX_GLXEXT_PROTOTYPES 1 -# include "GL/glxext.h" -//# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB((const GLubyte*)(p)) -# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddress((const GLubyte*)(p)) - -// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly -// This header is distributed with SL. You'll find it in linden/libraries/include/GL/ -# define __APPLE__ -# include "GL/glh_extensions.h" -# undef __APPLE__ - - -// GL_ARB_vertex_buffer_object -extern PFNGLBINDBUFFERARBPROC glBindBufferARB; -extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; -extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; -extern PFNGLISBUFFERARBPROC glIsBufferARB; -extern PFNGLBUFFERDATAARBPROC glBufferDataARB; -extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; -extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB; -extern PFNGLMAPBUFFERARBPROC glMapBufferARB; -extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB; -extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB; -extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB; - -// GL_ARB_vertex_array_object -extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray; -extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; -extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; -extern PFNGLISVERTEXARRAYPROC glIsVertexArray; - -// GL_ARB_sync -extern PFNGLFENCESYNCPROC glFenceSync; -extern PFNGLISSYNCPROC glIsSync; -extern PFNGLDELETESYNCPROC glDeleteSync; -extern PFNGLCLIENTWAITSYNCPROC glClientWaitSync; -extern PFNGLWAITSYNCPROC glWaitSync; -extern PFNGLGETINTEGER64VPROC glGetInteger64v; -extern PFNGLGETSYNCIVPROC glGetSynciv; - -// GL_APPLE_flush_buffer_range -extern PFNGLBUFFERPARAMETERIAPPLEPROC glBufferParameteriAPPLE; -extern PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE; - -// GL_ARB_map_buffer_range -extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange; -extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; - -// GL_ATI_vertex_array_object -extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI; -extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI; -extern PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI; -extern PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI; -extern PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI; -extern PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI; -extern PFNGLARRAYOBJECTATIPROC glArrayObjectATI; -extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI; -extern PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI; -extern PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI; -extern PFNGLVARIANTARRAYOBJECTATIPROC glVariantObjectArrayATI; -extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI; -extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI; - -// GL_ARB_occlusion_query -extern PFNGLGENQUERIESARBPROC glGenQueriesARB; -extern PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB; -extern PFNGLISQUERYARBPROC glIsQueryARB; -extern PFNGLBEGINQUERYARBPROC glBeginQueryARB; -extern PFNGLENDQUERYARBPROC glEndQueryARB; -extern PFNGLGETQUERYIVARBPROC glGetQueryivARB; -extern PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB; -extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB; - -// GL_ARB_timer_query -extern PFNGLQUERYCOUNTERPROC glQueryCounter; -extern PFNGLGETQUERYOBJECTI64VPROC glGetQueryObjecti64v; -extern PFNGLGETQUERYOBJECTUI64VPROC glGetQueryObjectui64v; - -// GL_ARB_point_parameters -extern PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; -extern PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; - -// GL_ARB_shader_objects -extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; -extern PFNGLGETHANDLEARBPROC glGetHandleARB; -extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; -extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; -extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; -extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; -extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; -extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; -extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; -extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; -extern PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB; -extern PFNGLUNIFORM1FARBPROC glUniform1fARB; -extern PFNGLUNIFORM2FARBPROC glUniform2fARB; -extern PFNGLUNIFORM3FARBPROC glUniform3fARB; -extern PFNGLUNIFORM4FARBPROC glUniform4fARB; -extern PFNGLUNIFORM1IARBPROC glUniform1iARB; -extern PFNGLUNIFORM2IARBPROC glUniform2iARB; -extern PFNGLUNIFORM3IARBPROC glUniform3iARB; -extern PFNGLUNIFORM4IARBPROC glUniform4iARB; -extern PFNGLUNIFORM1FVARBPROC glUniform1fvARB; -extern PFNGLUNIFORM2FVARBPROC glUniform2fvARB; -extern PFNGLUNIFORM3FVARBPROC glUniform3fvARB; -extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB; -extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB; -extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB; -extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB; -extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB; -extern PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB; -extern PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB; -extern PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv; -extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB; -extern PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB; -extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; -extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; -extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; -extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; -extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB; -extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; -extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; -extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; - -// GL_ARB_vertex_shader -extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; -extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; -extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; -extern PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB; -extern PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB; -extern PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB; -extern PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB; -extern PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB; -extern PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB; -extern PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB; -extern PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB; -extern PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB; -extern PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB; -extern PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB; -extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; -extern PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB; -extern PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB; -extern PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB; -extern PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4nbvARB; -extern PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4nivARB; -extern PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4nsvARB; -extern PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4nubARB; -extern PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4nubvARB; -extern PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4nuivARB; -extern PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4nusvARB; -extern PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB; -extern PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB; -extern PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB; -extern PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB; -extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB; -extern PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB; -extern PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB; -extern PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB; -extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB; -extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB; -extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB; -extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; -extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; -extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; -extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; -extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; -extern PFNGLBINDPROGRAMARBPROC glBindProgramARB; -extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB; -extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB; -extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB; -extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB; -extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; -extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB; -extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB; -extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB; -extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB; -extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB; -extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB; -extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB; -extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB; -extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB; -extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB; -extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB; -extern PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB; -extern PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB; -extern PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB; -extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB; -extern PFNGLISPROGRAMARBPROC glIsProgramARB; -extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; -extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; -extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; - -extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; -extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; - -extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; - -//GL_EXT_blend_func_separate -extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT; - -//GL_EXT_framebuffer_object -extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; -extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; -extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; -extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; -extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; -extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; -extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; -extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; -extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; -extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; -extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; -extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; -extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; -extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; -extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; -extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; -extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; - -#elif LL_MESA +#if LL_MESA //---------------------------------------------------------------------------- // MESA headers // quotes so we get libraries/.../GL/ version diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 6e924c1f19..d65c220974 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -295,9 +295,6 @@ const std::string LLLocale::SYSTEM_LOCALE("English_United States.1252"); #elif LL_DARWIN const std::string LLLocale::USER_LOCALE("en_US.iso8859-1");// = LLStringUtil::null; const std::string LLLocale::SYSTEM_LOCALE("en_US.iso8859-1"); -#elif LL_SOLARIS -const std::string LLLocale::USER_LOCALE("en_US.ISO8859-1"); -const std::string LLLocale::SYSTEM_LOCALE("C"); #else // LL_LINUX likes this const std::string LLLocale::USER_LOCALE("en_US.utf8"); const std::string LLLocale::SYSTEM_LOCALE("C"); diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 10fbc06c61..9e9abbadff 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -61,9 +61,6 @@ LLDir_Win32 gDirUtil; #elif LL_DARWIN #include "lldir_mac.h" LLDir_Mac gDirUtil; -#elif LL_SOLARIS -#include "lldir_solaris.h" -LLDir_Solaris gDirUtil; #else #include "lldir_linux.h" LLDir_Linux gDirUtil; diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 38e204ef04..4988b9c6e3 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -27,11 +27,6 @@ #ifndef LL_LLDIR_H #define LL_LLDIR_H -#if LL_SOLARIS -#include -#define MAX_PATH MAXPATHLEN -#endif - // these numbers are read from settings_files.xml, so we need to be explicit typedef enum ELLPath { diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp deleted file mode 100644 index f18560ff20..0000000000 --- a/indra/llvfs/lldir_solaris.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/** - * @file fmodwrapper.cpp - * @brief dummy source file for building a shared library to wrap libfmod.a - * - * $LicenseInfo:firstyear=2005&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 "lldir_solaris.h" -#include "llerror.h" -#include "llrand.h" -#include "llstring.h" -#include -#include -#include -#include -#include -#include -#define _STRUCTURED_PROC 1 -#include -#include - -static std::string getCurrentUserHome(char* fallback) -{ - // fwiw this exactly duplicates getCurrentUserHome() in lldir_linux.cpp... - // we should either derive both from LLDir_Posix or just axe Solaris. - const uid_t uid = getuid(); - struct passwd *pw; - - pw = getpwuid(uid); - if ((pw != NULL) && (pw->pw_dir != NULL)) - { - return pw->pw_dir; - } - - LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL; - auto home_env = LLStringUtil::getoptenv("HOME"); - if (home_env) - { - return *home_env; - } - else - { - LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL; - return fallback; - } -} - - -LLDir_Solaris::LLDir_Solaris() -{ - mDirDelimiter = "/"; - mCurrentDirIndex = -1; - mCurrentDirCount = -1; - mDirp = NULL; - - char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - if (getcwd(tmp_str, LL_MAX_PATH) == NULL) - { - strcpy(tmp_str, "/tmp"); - LL_WARNS() << "Could not get current directory; changing to " - << tmp_str << LL_ENDL; - if (chdir(tmp_str) == -1) - { - LL_ERRS() << "Could not change directory to " << tmp_str << LL_ENDL; - } - } - - mExecutableFilename = ""; - mExecutablePathAndName = ""; - mExecutableDir = strdup(tmp_str); - mWorkingDir = strdup(tmp_str); - mAppRODataDir = strdup(tmp_str); - mOSUserDir = getCurrentUserHome(tmp_str); - mOSUserAppDir = ""; - mLindenUserDir = ""; - - char path [LL_MAX_PATH]; /* Flawfinder: ignore */ - - sprintf(path, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(path, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << path << LL_ENDL; - return; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << path << LL_ENDL; - close(proc_fd); - return; - } - - close(proc_fd); - - mExecutableFilename = strdup(proc_psinfo.pr_fname); - LL_INFOS() << "mExecutableFilename = [" << mExecutableFilename << "]" << LL_ENDL; - - sprintf(path, "/proc/%d/path/a.out", (int)getpid()); - - char execpath[LL_MAX_PATH]; - if(readlink(path, execpath, LL_MAX_PATH) == -1){ - LL_WARNS() << "Unable to read link from " << path << LL_ENDL; - return; - } - - char *p = execpath; // nuke trash in link, if any exists - int i = 0; - while(*p != NULL && ++i < LL_MAX_PATH && isprint((int)(*p++))); - *p = NULL; - - mExecutablePathAndName = strdup(execpath); - LL_INFOS() << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << LL_ENDL; - - //NOTE: Why force people to cd into the package directory? - // Look for SECONDLIFE env variable and use it, if set. - - auto SECONDLIFE(LLDirUtil::getoptenv("SECONDLIFE")); - if(SECONDLIFE){ - mExecutableDir = add(*SECONDLIFE, "bin"); //NOTE: make sure we point at the bin - }else{ - mExecutableDir = getDirName(execpath); - LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL; - } - - mLLPluginDir = add(mExecutableDir, "llplugin"); - - // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. - mTempDir = "/tmp"; -} - -LLDir_Solaris::~LLDir_Solaris() -{ -} - -// Implementation - - -void LLDir_Solaris::initAppDirs(const std::string &app_name, - const std::string& app_read_only_data_dir) -{ - // Allow override so test apps can read newview directory - if (!app_read_only_data_dir.empty()) - { - mAppRODataDir = app_read_only_data_dir; - mSkinBaseDir = add(mAppRODataDir, "skins"); - } - mAppName = app_name; - - std::string upper_app_name(app_name); - LLStringUtil::toUpper(upper_app_name); - - auto app_home_env(LLStringUtil::getoptenv(upper_app_name + "_USER_DIR")); - if (app_home_env) - { - // user has specified own userappdir i.e. $SECONDLIFE_USER_DIR - mOSUserAppDir = *app_home_env; - } - else - { - // traditionally on unixoids, MyApp gets ~/.myapp dir for data - mOSUserAppDir = mOSUserDir; - mOSUserAppDir += "/"; - mOSUserAppDir += "."; - std::string lower_app_name(app_name); - LLStringUtil::toLower(lower_app_name); - mOSUserAppDir += lower_app_name; - } - - // create any directories we expect to write to. - - int res = LLFile::mkdir(mOSUserAppDir); - if (res == -1) - { - LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL; - LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL; - mOSUserAppDir = mOSUserDir; - } - - res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"")); - if (res == -1) - { - LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL; - } - - res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"")); - if (res == -1) - { - LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL; - } - - res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"")); - if (res == -1) - { - LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL; - } - - mCAFile = getExpandedFilename(LL_PATH_EXECUTABLE, "ca-bundle.crt"); -} - -U32 LLDir_Solaris::countFilesInDir(const std::string &dirname, const std::string &mask) -{ - U32 file_count = 0; - glob_t g; - - std::string tmp_str; - tmp_str = dirname; - tmp_str += mask; - - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) - { - file_count = g.gl_pathc; - - globfree(&g); - } - - return (file_count); -} - -std::string LLDir_Solaris::getCurPath() -{ - char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - if (getcwd(tmp_str, LL_MAX_PATH) == NULL) - { - LL_WARNS() << "Could not get current directory" << LL_ENDL; - tmp_str[0] = '\0'; - } - return tmp_str; -} - - -bool LLDir_Solaris::fileExists(const std::string &filename) const -{ - struct stat stat_data; - // Check the age of the file - // Now, we see if the files we've gathered are recent... - int res = stat(filename.c_str(), &stat_data); - if (!res) - { - return TRUE; - } - else - { - return FALSE; - } -} - diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h deleted file mode 100644 index c6dac57e14..0000000000 --- a/indra/llvfs/lldir_solaris.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file fmodwrapper.cpp - * @brief dummy source file for building a shared library to wrap libfmod.a - * - * $LicenseInfo:firstyear=2005&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$ - */ - -#if !LL_SOLARIS -#error This header must not be included when compiling for any target other than Solaris. Consider including lldir.h instead. -#endif // !LL_SOLARIS - -#ifndef LL_LLDIR_SOLARIS_H -#define LL_LLDIR_SOLARIS_H - -#include "lldir.h" - -#include -#include - -class LLDir_Solaris : public LLDir -{ -public: - LLDir_Solaris(); - virtual ~LLDir_Solaris(); - - /*virtual*/ void initAppDirs(const std::string &app_name, - const std::string& app_read_only_data_dir); - - virtual std::string getCurPath(); - virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); - /*virtual*/ bool fileExists(const std::string &filename) const; - -private: - DIR *mDirp; - int mCurrentDirIndex; - int mCurrentDirCount; - std::string mCurrentDir; -}; - -#endif // LL_LLDIR_SOLARIS_H - - diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 617056d94d..2c64bf563e 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -33,10 +33,6 @@ #include #if LL_WINDOWS #include -#elif LL_SOLARIS -#include -#include -#include #else #include #endif @@ -2146,12 +2142,6 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r int fd; // first test the lock in a non-destructive way -#if LL_SOLARIS - struct flock fl; - fl.l_whence = SEEK_SET; - fl.l_start = 0; - fl.l_len = 1; -#else // !LL_SOLARIS if (strchr(mode, 'w') != NULL) { fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ @@ -2167,19 +2157,13 @@ LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL r fclose(fp); } } -#endif // !LL_SOLARIS // now actually open the file for use fp = LLFile::fopen(filename, mode); /* Flawfinder: ignore */ if (fp) { fd = fileno(fp); -#if LL_SOLARIS - fl.l_type = read_lock ? F_RDLCK : F_WRLCK; - if (fcntl(fd, F_SETLK, &fl) == -1) -#else if (flock(fd, (read_lock ? LOCK_SH : LOCK_EX) | LOCK_NB) == -1) -#endif { fclose(fp); fp = NULL; @@ -2207,14 +2191,6 @@ void LLVFS::unlockAndClose(LLFILE *fp) flock(fd, LOCK_UN); #endif */ -#if LL_SOLARIS - struct flock fl; - fl.l_whence = SEEK_SET; - fl.l_start = 0; - fl.l_len = 1; - fl.l_type = F_UNLCK; - fcntl(fileno(fp), F_SETLK, &fl); -#endif fclose(fp); } } diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index c20e639fc7..85eb9d6d1b 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -51,13 +51,13 @@ extern "C" { # include "fontconfig/fontconfig.h" } -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX // not necessarily available on random SDL platforms, so #if LL_LINUX // for execv(), waitpid(), fork() # include # include # include -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX extern BOOL gDebugWindowProc; @@ -323,12 +323,6 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) static int x11_detect_VRAM_kb() { -#if LL_SOLARIS && defined(__sparc) - // NOTE: there's no Xorg server on SPARC so just return 0 - // and allow SDL to attempt to get the amount of VRAM - return(0); -#else - std::string x_log_location("/var/log/"); std::string fname; int rtn = 0; // 'could not detect' @@ -409,7 +403,6 @@ static int x11_detect_VRAM_kb() } } return rtn; -#endif // LL_SOLARIS } #endif // LL_X11 @@ -484,27 +477,10 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); -#if !LL_SOLARIS - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24); // We need stencil support for a few (minor) things. if (!getenv("LL_GL_NO_STENCIL")) SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); -#else - // NOTE- use smaller Z-buffer to enable more graphics cards - // - This should not affect better GPUs and has been proven - // to provide 24-bit z-buffers when available. - // - // As the API states: - // - // GLX_DEPTH_SIZE Must be followed by a nonnegative - // minimum size specification. If this - // value is zero, visuals with no depth - // buffer are preferred. Otherwise, the - // largest available depth buffer of at - // least the minimum size is preferred. - - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); -#endif SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8); // *FIX: try to toggle vsync here? @@ -682,25 +658,13 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fixme: actually, it's REALLY important for picking that we get at // least 8 bits each of red,green,blue. Alpha we can be a bit more // relaxed about if we have to. -#if LL_SOLARIS && defined(__sparc) -// again the __sparc required because Xsun support, 32bit are very pricey on SPARC - if(colorBits < 24) //HACK: on SPARC allow 24-bit color -#else if (colorBits < 32) -#endif { close(); setupFailure( -#if LL_SOLARIS && defined(__sparc) - "Second Life requires at least 24-bit color on SPARC to run in a window.\n" - "Please use fbconfig to set your default color depth to 24 bits.\n" - "You may also need to adjust the X11 setting in SMF. To do so use\n" - " 'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" -#else "Second Life requires True Color (32-bit) to run in a window.\n" "Please go to Control Panels -> Display -> Settings and\n" "set the screen to 32-bit color.\n" -#endif "Alternately, if you choose to run fullscreen, Second Life\n" "will automatically adjust the screen each time it runs.", "Error", @@ -2503,7 +2467,7 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) } #endif // LL_GTK -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX // extracted from spawnWebBrowser for clarity and to eliminate // compiler confusion regarding close(int fd) vs. LLWindow::close() void exec_cmd(const std::string& cmd, const std::string& arg) @@ -2559,7 +2523,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX # if LL_X11 if (mSDL_Display) { @@ -2578,7 +2542,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) cmd += "launch_url.sh"; arg = escaped_url; exec_cmd(cmd, arg); -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX LL_INFOS() << "spawn_web_browser returning." << LL_ENDL; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 70b41a0a5f..4339aa8807 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -255,9 +255,9 @@ // define a self-registering event API object #include "llappviewerlistener.h" -#if (LL_LINUX || LL_SOLARIS) && LL_GTK +#if LL_LINUX && LL_GTK #include "glib.h" -#endif // (LL_LINUX || LL_SOLARIS) && LL_GTK +#endif // (LL_LINUX) && LL_GTK #if LL_MSVC // disable boost::lexical_cast warning diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 6f32aab851..dc487967fc 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -73,10 +73,6 @@ static void exceptionTerminateHandler() int main( int argc, char **argv ) { -#if LL_SOLARIS && defined(__sparc) - asm ("ta\t6"); // NOTE: Make sure memory alignment is enforced on SPARC -#endif - gArgC = argc; gArgV = argv; @@ -336,8 +332,6 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze) cmd += gDirUtilp->getDirDelimiter(); #if LL_LINUX cmd += "linux-crash-logger.bin"; -#elif LL_SOLARIS - cmd += "solaris-crash-logger"; #else # error Unknown platform #endif @@ -394,9 +388,6 @@ bool LLAppViewerLinux::beingDebugged() { static enum {unknown, no, yes} debugged = unknown; -#if LL_SOLARIS - return debugged == no; // BUG: fix this for Solaris -#else if (debugged == unknown) { pid_t ppid = getppid(); @@ -431,7 +422,6 @@ bool LLAppViewerLinux::beingDebugged() } return debugged == yes; -#endif } void LLAppViewerLinux::initLoggingAndGetLastDuration() diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index b8e6e81ee6..01790ad19e 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -37,7 +37,7 @@ #include "llviewercontrol.h" #include "llwin32headerslean.h" -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN # include "llfilepicker.h" #endif @@ -187,7 +187,7 @@ std::string LLDirPicker::getDirName() return mFilePicker->getFirstFile(); } -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX LLDirPicker::LLDirPicker() : mFileName(NULL), diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index c7dba12130..52febe4523 100644 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -78,7 +78,7 @@ private: void buildDirname( void ); bool check_local_file_access_enabled(); -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN // On Linux we just implement LLDirPicker on top of LLFilePicker LLFilePicker *mFilePicker; #endif diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index d915a9fd26..2d4478aff5 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -771,12 +771,7 @@ void LLFeatureManager::applyBaseMasks() maskFeatures("RAM256MB"); } -#if LL_SOLARIS && defined(__sparc) // even low MHz SPARCs are fast -#error The 800 is hinky. Would something like a LL_MIN_MHZ make more sense here? - if (gSysCPU.getMHz() < 800) -#else if (gSysCPU.getMHz() < 1100) -#endif { maskFeatures("CPUSlow"); } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index b6fd70452e..3669fb1eeb 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -40,7 +40,7 @@ #include "llwindowsdl.h" // for some X/GTK utils to help with filepickers #endif // LL_SDL -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include "llhttpconstants.h" // file picker uses some of thes constants on Linux #endif @@ -939,7 +939,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, } //END LL_DARWIN -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # if LL_GTK @@ -1504,4 +1504,4 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) return FALSE; } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 7bfba2a6d7..a30c73768d 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -746,9 +746,6 @@ LLSD LLFloaterReporter::gatherReport() const char* platform = "Mac"; #elif LL_LINUX const char* platform = "Lnx"; -#elif LL_SOLARIS - const char* platform = "Sol"; - const char* short_platform = "O:S"; #else const char* platform = "???"; #endif diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index fdfd22c117..63ad708e59 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -56,7 +56,7 @@ #include "m4math.h" #include "llmatrix4a.h" -#if !LL_DARWIN && !LL_LINUX && !LL_SOLARIS +#if !LL_DARWIN && !LL_LINUX extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; extern PFNGLWEIGHTFVARBPROC glWeightfvARB; extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 52dcb71c10..da0f98851d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1917,8 +1917,8 @@ LLViewerWindow::LLViewerWindow(const Params& p) ms_sleep(5000) ; //wait for 5 seconds. LLSplashScreen::update(LLTrans::getString("ShuttingDown")); -#if LL_LINUX || LL_SOLARIS - LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information." +#if LL_LINUX + LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt for further information." << LL_ENDL; #else LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 976ef61d8e..a57c657705 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -359,7 +359,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : // gMuteListp->addObserver(&mutelist_listener); -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX // HACK: THIS DOES NOT BELONG HERE // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us. // This should cause us to ignore SIGPIPE and handle the error through proper channels. -- cgit v1.2.3 From f22c85cb4164bf7041db137aac86136fb6e5fd83 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 15 Oct 2020 23:33:13 -0700 Subject: SL-13424 Add Rad Games Tools local Telemetry profiler support --- indra/newview/CMakeLists.txt | 1 + indra/newview/llappviewer.cpp | 3 + indra/newview/llstartup.cpp | 3 + indra/newview/lltelemetry.cpp | 145 ++++++++++++++++++++++++++++++++++++++++++ indra/newview/lltelemetry.h | 81 +++++++++++++++++++++++ 5 files changed, 233 insertions(+) create mode 100644 indra/newview/lltelemetry.cpp create mode 100644 indra/newview/lltelemetry.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fa148f1719..a0412f9159 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -583,6 +583,7 @@ set(viewer_SOURCE_FILES llsyntaxid.cpp llsyswellitem.cpp llsyswellwindow.cpp + lltelemetry.cpp llteleporthistory.cpp llteleporthistorystorage.cpp lltextureatlas.cpp diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4339aa8807..2feba40d23 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -89,6 +89,7 @@ #include "llsdutil_math.h" #include "lllocationhistory.h" #include "llfasttimerview.h" +#include "lltelemetry.h" #include "llvector4a.h" #include "llviewermenufile.h" #include "llvoicechannel.h" @@ -1608,6 +1609,8 @@ bool LLAppViewer::doFrame() LL_INFOS() << "Exiting main_loop" << LL_ENDL; } + LLPROFILE_UPDATE(); + return ! LLApp::isRunning(); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3ef2d47d37..8fd9a03a44 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -176,6 +176,7 @@ #include "pipeline.h" #include "llappviewer.h" #include "llfasttimerview.h" +#include "lltelemetry.h" #include "llfloatermap.h" #include "llweb.h" #include "llvoiceclient.h" @@ -527,6 +528,8 @@ bool idle_startup() } #if LL_WINDOWS + LLPROFILE_STARTUP(); + // On the windows dev builds, unpackaged, the message.xml file will // be located in indra/build-vc**/newview//app_settings. std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml"); diff --git a/indra/newview/lltelemetry.cpp b/indra/newview/lltelemetry.cpp new file mode 100644 index 0000000000..0c63e2fede --- /dev/null +++ b/indra/newview/lltelemetry.cpp @@ -0,0 +1,145 @@ + /** + * @file lltelemetry.cpp + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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 "lltelemetry.h" + +#if LLPROFILE_USE_RAD_TELEMETRY_PROFILER + #if LL_WINDOWS + #include "llwin32headers.h" + + // build-vc120-64\packages\lib\release + // build-vc150-64\packages\lib\release + #ifdef _MSC_VER + #pragma comment(lib,"rad_tm_win64.lib") + #else + #pragma message "NOTE: Rad GameTools Telemetry requested but non-MSVC compiler not yet supported on Windows" + #endif + #endif // LL_WINDOWS + + #if LL_DARWIN + #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Darwin" + #endif + + #if LL_LINUX + #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Linux" + #endif + +// +// local consts +// +static const tm_int32 TELEMETRY_BUFFER_SIZE = 8 * 1024 * 1024; + +// +// local globals +// +static char *gTelemetryBufferPtr = NULL; // Telemetry + +static const char *tm_status[ TMERR_INIT_NETWORKING_FAILED + 1 ] = +{ + "Telemetry pass: connected" // TM_OK + , "Telemetry FAIL: disabled via #define NTELEMETRY" // TMERR_DISABLED + , "Telemetry FAIL: invalid paramater" // TMERR_INVALID_PARAM + , "Telemetry FAIL: DLL not found" // TMERR_NULL_API + , "Telemetry FAIL: out of resources" // TMERR_OUT_OF_RESOURCES + , "Telemetry FAIL: tmInitialize() not called" // TMERR_UNINITIALIZED + , "Telemetry FAIL: bad hostname" // TMERR_BAD_HOSTNAME + , "Telemetry FAIL: couldn't connect to server" // TMERR_COULD_NOT_CONNECT + , "Telemetry FAIL: unknown network error" // TMERR_UNKNOWN_NETWORK + , "Telemetry FAIL: tmShutdown() already called" // TMERR_ALREADY_SHUTDOWN + , "Telemetry FAIL: memory buffer too small" // TMERR_ARENA_TOO_SMALL + , "Telemetry FAIL: server handshake error" // TMERR_BAD_HANDSHAKE + , "Telemetry FAIL: unaligned parameters" // TMERR_UNALIGNED + , "Telemetry FAIL: network not initialized" // TMERR_NETWORK_NOT_INITIALIZED -- WSAStartup not called before tmOpen() + , "Telemetry FAIL: bad version" // TMERR_BAD_VERSION + , "Telemetry FAIL: timer too large" // TMERR_BAD_TIMER + , "Telemetry FAIL: tmOpen() already called" // TMERR_ALREADY_OPENED + , "Telemetry FAIL: tmInitialize() already called" // TMERR_ALREADY_INITIALIZED + , "Telemetry FAIL: could't open file" // TMERR_FILE_OPEN_FAILED + , "Telemetry FAIL: tmOpen() failed networking" // TMERR_INIT_NETWORKING_FAILED +}; + +// +// exported functionality +// + +void telemetry_shutdown() +{ + #if LL_WINDOWS + if (gTelemetryBufferPtr) + { + tmClose(0); + tmShutdown(); + + delete[] gTelemetryBufferPtr; + gTelemetryBufferPtr = NULL; + } + #endif +} + +void telemetry_startup() +{ + #if LL_WINDOWS + tmLoadLibrary(TM_RELEASE); // Loads .dll + + gTelemetryBufferPtr = new char[ TELEMETRY_BUFFER_SIZE ]; + tmInitialize(TELEMETRY_BUFFER_SIZE, gTelemetryBufferPtr); + + tm_error telemetry_status = tmOpen( + 0, // unused + "SecondLife", // app name + __DATE__ " " __TIME__, // build identifier + "localhost", // server name (or filename) + TMCT_TCP, // connection type (or TMCT_FILE) + 4719, // port + TMOF_INIT_NETWORKING, // open flags + 250 ); // timeout ms + + if (telemetry_status == TMERR_UNKNOWN) + { + LL_ERRS() << "Telemetry FAIL: unknown error" << LL_ENDL; + } + else if (telemetry_status && (telemetry_status <= TMERR_INIT_NETWORKING_FAILED)) + { + LL_INFOS() << tm_status[ telemetry_status ] << LL_ENDL; + free(gTelemetryBufferPtr); + gTelemetryBufferPtr = NULL; + } + #endif // LL_WINDOWS +} + +// Called after we render a frame +void telemetry_update() +{ + #if LL_WINDOWS + if (gTelemetryBufferPtr) + { + tmTick(0); + } + #endif +} +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER diff --git a/indra/newview/lltelemetry.h b/indra/newview/lltelemetry.h new file mode 100644 index 0000000000..a73e5fcfa2 --- /dev/null +++ b/indra/newview/lltelemetry.h @@ -0,0 +1,81 @@ +/** + * @file lltelemetry.h + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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$ + */ + +/* +To use: + +1. Uncomment #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER below + +2. Include this header file + #include "lltelemetry.h" + +3. Add zones to the functions you wish to profile + void onFoo() + { + LLPROFILE_ZONE("Foo"); + } +*/ +//#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 1 + +// Default NO local telemetry profiling +#ifndef LLPROFILE_USE_RAD_TELEMETRY_PROFILER + #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 0 + #define LLPROFILE_SHUTDOWN( ...) {} + #define LLPROFILE_STARTUP( ...) {} + #define LLPROFILE_UPDATE( ...) {} + + #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) + #define LLPROFILE_ENTER(name) + #define LLPROFILE_ENTER_FORMAT(format, ...) + #define LLPROFILE_FUNCTION + #define LLPROFILE_LEAVE() + #define LLPROFILE_THREAD_NAME(name) + #define LLPROFILE_ZONE(name) + #define LLPROFILE_ZONE_FORMAT(format, ...) +#else + #include + + #define LLPROFILE_SHUTDOWN telemetry_shutdown + #define LLPROFILE_STARTUP telemetry_startup + #define LLPROFILE_UPDATE telemetry_update + + #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) tmZoneColor(r, g, b) + #define LLPROFILE_ENTER(name) tmEnter(0, 0, name) + #define LLPROFILE_ENTER_FORMAT(format, ...) tmEnter(0, 0, format, __VA_ARGS__) + #define LLPROFILE_FUNCTION tmFunction(0, 0) + #define LLPROFILE_LEAVE() tmLeave(0) + #define LLPROFILE_THREAD_NAME(name) tmThreadName(0, 0, name) + #define LLPROFILE_ZONE(name) tmZone(0, 0, name) + #define LLPROFILE_ZONE_FORMAT(format, ...) tmZone(0, 0, format, __VA_ARGS__) +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER + +// +// exported functionality +// + +extern void telemetry_startup(); +extern void telemetry_shutdown(); +extern void telemetry_update(); // called after every frame update -- cgit v1.2.3 From a6058b0e9f22080c7aa28e33e1061e23d671d166 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 16 Oct 2020 17:10:49 -0600 Subject: DRTVWR-510 remove obsolete mDebugGPU variable --- indra/llrender/llgl.cpp | 13 +------------ indra/llrender/llgl.h | 3 --- indra/newview/llappviewer.cpp | 5 +---- indra/newview/lldynamictexture.cpp | 7 ------- 4 files changed, 2 insertions(+), 26 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index ada5371c1a..36177e00e8 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -471,8 +471,6 @@ LLGLManager::LLGLManager() : mHasSeparateSpecularColor(FALSE), - mDebugGPU(FALSE), - mDriverVersionMajor(1), mDriverVersionMinor(0), mDriverVersionRelease(0), @@ -865,16 +863,7 @@ bool LLGLManager::initGL() return true; } -void LLGLManager::setToDebugGPU() -{ - //"MOBILE INTEL(R) 965 EXPRESS CHIP", - if (mGLRenderer.find("INTEL") != std::string::npos && mGLRenderer.find("965") != std::string::npos) - { - mDebugGPU = TRUE ; - } - - return ; -} +//void LLGLManager::setToDebugGPU() void LLGLManager::getGLInfo(LLSD& info) { diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 91ef4e9102..95cc1899ee 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -142,9 +142,6 @@ public: // Misc extensions BOOL mHasSeparateSpecularColor; - //whether this GPU is in the debug list. - BOOL mDebugGPU; - S32 mDriverVersionMajor; S32 mDriverVersionMinor; S32 mDriverVersionRelease; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2feba40d23..9452028174 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1291,10 +1291,7 @@ void LLAppViewer::checkMemory() //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - if(!gGLManager.mDebugGPU) - { - return ; - } + return ; if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) { diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 89c20904c1..1edf8fd47c 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -56,13 +56,6 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon { llassert((1 <= components) && (components <= 4)); - if(gGLManager.mDebugGPU) - { - if(components == 3) - { - mComponents = 4 ; //convert to 32bits. - } - } generateGLTexture(); llassert( 0 <= order && order < ORDER_COUNT ); -- cgit v1.2.3 From d12305496f73e0b55e8e1ec327a2567ca713da22 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 19 Oct 2020 13:46:04 -0600 Subject: DRTVWR-510 clean up obsolete downstream-from-mDebugGPU code --- indra/llcommon/llmemory.cpp | 54 +-------------------------------- indra/llcommon/llmemory.h | 4 +-- indra/llrender/llgl.cpp | 6 ---- indra/llrender/llgl.h | 1 - indra/newview/app_settings/settings.xml | 2 +- indra/newview/llappviewer.cpp | 33 +------------------- indra/newview/llappviewer.h | 3 -- indra/newview/lldynamictexture.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 5 +-- indra/newview/llviewertexture.cpp | 7 ----- indra/newview/llviewerwindow.cpp | 4 --- indra/newview/pipeline.cpp | 19 ------------ indra/newview/pipeline.h | 5 --- 13 files changed, 6 insertions(+), 139 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7cf4bc0706..ea84e4c1ea 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle sVirtualMem("virtual_mem", "virtu U32Kilobytes LLMemory::sAllocatedMemInKB(0); U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); -BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { @@ -75,10 +74,9 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) } //static -void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size) { sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); - sEnableMemoryFailurePrevention = prevent_heap_failure ; } //static @@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update) LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; } -//return 0: everything is normal; -//return 1: the memory pool is low, but not in danger; -//return -1: the memory pool is in danger, is about to crash. -//static -bool LLMemory::isMemoryPoolLow() -{ - static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); - const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); - static void* last_reserved_address = NULL ; - - if(!sEnableMemoryFailurePrevention) - { - return false ; //no memory failure prevention. - } - - if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory - { - return true ; - } - - if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. - { - return true ; - } - - bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD - || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; - - //check the virtual address space fragmentation - if(!is_low) - { - if(!last_reserved_address) - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - else - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - if(!last_reserved_address) //failed, try once more - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - } - - is_low = !last_reserved_address ; //allocation failed - } - - return is_low ; -} - //static U32Kilobytes LLMemory::getAvailableMemKB() { diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f04ae5f5cb..24f86cc11e 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -344,10 +344,9 @@ public: // Return value is zero if not known. static U64 getCurrentRSS(); static void* tryToAlloc(void* address, U32 size); - static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); + static void initMaxHeapSizeGB(F32Gigabytes max_heap_size); static void updateMemoryInfo() ; static void logMemoryInfo(BOOL update = FALSE); - static bool isMemoryPoolLow(); static U32Kilobytes getAvailableMemKB() ; static U32Kilobytes getMaxMemKB() ; @@ -359,7 +358,6 @@ private: static U32Kilobytes sAllocatedPageSizeInKB ; static U32Kilobytes sMaxHeapSizeInKB; - static BOOL sEnableMemoryFailurePrevention; }; // LLRefCount moved to llrefcount.h diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 36177e00e8..fa4d0977b2 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -852,10 +852,6 @@ bool LLGLManager::initGL() stop_glerror(); - setToDebugGPU(); - - stop_glerror(); - initGLStates(); stop_glerror(); @@ -863,8 +859,6 @@ bool LLGLManager::initGL() return true; } -//void LLGLManager::setToDebugGPU() - void LLGLManager::getGLInfo(LLSD& info) { if (gHeadlessClient) diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 95cc1899ee..3d597a23fe 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -173,7 +173,6 @@ private: void initExtensions(); void initGLStates(); void initGLImages(); - void setToDebugGPU(); }; extern LLGLManager gGLManager; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 52dc4744f2..0b9cc78132 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6564,7 +6564,7 @@ Value 1 - MemoryFailurePreventionEnabled + MemoryFailurePreventionEnabled Comment If set, the viewer will quit to avoid crash when memory failure happens diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9452028174..4c4848390f 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1280,36 +1280,8 @@ void LLAppViewer::initMaxHeapSize() //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; - BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; - LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; -} - -void LLAppViewer::checkMemory() -{ - const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second - //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds - //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - - return ; - - if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) - { - return ; - } - mMemCheckTimer.reset() ; - - //update the availability of memory - LLMemory::updateMemoryInfo() ; - - bool is_low = LLMemory::isMemoryPoolLow() ; - - LLPipeline::throttleNewMemoryAllocation(is_low) ; - - if(is_low) - { - LLMemory::logMemoryInfo() ; - } + LLMemory::initMaxHeapSizeGB(max_heap_size_gb); } static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); @@ -1388,9 +1360,6 @@ bool LLAppViewer::doFrame() //clear call stack records LL_CLEAR_CALLSTACKS(); - //check memory availability information - checkMemory() ; - { pingMainloopTimeout("Main:MiscNativeWindowEvents"); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 8f0f54de3b..f3c5f5b500 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -230,7 +230,6 @@ private: bool initConfiguration(); // Initialize settings from the command line/config file. void initStrings(); // Initialize LLTrans machinery bool initCache(); // Initialize local client cache. - void checkMemory() ; // We have switched locations of both Mac and Windows cache, make sure // files migrate and old cache is cleared out. @@ -306,8 +305,6 @@ private: LLAllocator mAlloc; - LLFrameTimer mMemCheckTimer; - // llcorehttp library init/shutdown helper LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 1edf8fd47c..8b8273d183 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -204,7 +204,7 @@ void LLViewerDynamicTexture::postRender(BOOL success) BOOL LLViewerDynamicTexture::updateAllInstances() { sNumRenders = 0; - if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) + if (gGLManager.mIsDisabled) { return TRUE; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index caf79edfe4..0c112047de 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -745,10 +745,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glViewport(0,0,512,512); LLVOAvatar::updateFreezeCounter() ; - if(!LLPipeline::sMemAllocationThrottled) - { - LLVOAvatar::updateImpostors(); - } + LLVOAvatar::updateImpostors(); set_current_projection(proj); set_current_modelview(mod); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a2cec9a613..6a3cdafecb 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3289,13 +3289,6 @@ void LLViewerLODTexture::processTextureStats() { mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); } - else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. - { - if(scaleDown()) - { - mDesiredDiscardLevel = mCachedRawDiscardLevel; - } - } } bool LLViewerLODTexture::scaleDown() diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index da0f98851d..053e18d627 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4789,10 +4789,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei return FALSE; } //check if there is enough memory for the snapshot image - if(LLPipeline::sMemAllocationThrottled) - { - return FALSE ; //snapshot taking is disabled due to memory restriction. - } if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K { if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 604c5f770d..a898c2668b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -347,7 +347,6 @@ bool LLPipeline::sRenderFrameTest = false; bool LLPipeline::sRenderAttachedLights = true; bool LLPipeline::sRenderAttachedParticles = true; bool LLPipeline::sRenderDeferred = false; -bool LLPipeline::sMemAllocationThrottled = false; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; bool LLPipeline::sRenderingHUDs; @@ -717,24 +716,6 @@ void LLPipeline::destroyGL() static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); -//static -void LLPipeline::throttleNewMemoryAllocation(bool disable) -{ - if(sMemAllocationThrottled != disable) - { - sMemAllocationThrottled = disable ; - - if(sMemAllocationThrottled) - { - //send out notification - LLNotification::Params params("LowMemory"); - LLNotifications::instance().add(params); - - //release some memory. - } - } -} - void LLPipeline::requestResizeScreenTexture() { gResizeScreenTexture = TRUE; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 600bdd9d06..d93d6cb50c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -413,10 +413,6 @@ public: static void updateRenderDeferred(); static void refreshCachedSettings(); - static void throttleNewMemoryAllocation(bool disable); - - - void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector& restoreList ); @@ -598,7 +594,6 @@ public: static bool sRenderAttachedLights; static bool sRenderAttachedParticles; static bool sRenderDeferred; - static bool sMemAllocationThrottled; static S32 sVisibleLightCount; static F32 sMinRenderSize; static bool sRenderingHUDs; -- cgit v1.2.3 From 5de57339330609758ec99cc16052e95a5480a785 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 19:57:09 -0800 Subject: SL-14275: Add two new Water Reflection modes to Graphics Advanced --- .../default/xui/en/floater_preferences_graphics_advanced.xml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index e93568a87e..69f31333cd 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -720,6 +720,14 @@ top_delta="0" name="Reflections" width="150"> + + Date: Thu, 5 Nov 2020 20:06:46 -0800 Subject: SL-14275: Cleanup non descript name for water reflection mode --- indra/newview/pipeline.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a898c2668b..d26e9b7b0a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -129,6 +129,18 @@ // #define MATERIALS_IN_REFLECTIONS 0 +// NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +enum EWaterReflectionMode +{ + WATER_REFLECT_NONE_WATER_OPAQUE = -2, + WATER_REFLECT_NONE_WATER_TRANSPARENT = -1, + WATER_REFLECT_MINIMAL = 0, + WATER_REFLECT_TERRAIN = 1, + WATER_REFLECT_STATIC_OBJECTS = 2, + WATER_REFLECT_AVATARS = 3, + WATER_REFLECT_EVERYTHING = 4 +}; + bool gShiftFrame = false; //cached settings @@ -9239,7 +9251,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) glh::matrix4f saved_projection = get_current_projection(); glh::matrix4f mat; - S32 detail = RenderReflectionDetail; + S32 reflection_detail = RenderReflectionDetail; F32 water_height = gAgent.getRegion()->getWaterHeight(); F32 camera_height = camera_in.getOrigin().mV[VZ]; @@ -9338,15 +9350,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); - if (detail > 0) + if (reflection_detail > WATER_REFLECT_MINIMAL) { //mask out selected geometry based on reflection detail - if (detail < 4) + if (reflection_detail < WATER_REFLECT_EVERYTHING) { clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - if (detail < 3) + if (reflection_detail < WATER_REFLECT_AVATARS) { clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); - if (detail < 2) + if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) { clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); } -- cgit v1.2.3 From 2d2cab2ccc0bd1fbd508cdb2627fccb49a38be01 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 20:16:56 -0800 Subject: SL-14275: Cleanup inconsistent indentation --- indra/newview/pipeline.cpp | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d26e9b7b0a..c980851f00 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9284,8 +9284,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) S32 occlusion = LLPipeline::sUseOcclusion; - //disable occlusion culling for reflection map for now - LLPipeline::sUseOcclusion = 0; + //disable occlusion culling for reflection map for now + LLPipeline::sUseOcclusion = 0; if (!camera_is_underwater) { //generate planar reflection map @@ -9336,7 +9336,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) updateCull(camera, mSky); stateSort(camera, mSky); - renderGeom(camera, TRUE); + renderGeom(camera, TRUE); gPipeline.popRenderTypeMask(); } @@ -9369,11 +9369,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLGLDisable cull(GL_CULL_FACE); updateCull(camera, mReflectedObjects, -water_clip, &plane); stateSort(camera, mReflectedObjects); - renderGeom(camera); - } + renderGeom(camera); + } + gPipeline.popRenderTypeMask(); mWaterRef.flush(); - } + } glCullFace(GL_BACK); gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -9419,12 +9420,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::sDistortionRender = true; LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor(); - glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); + glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; mWaterDis.bindTarget(); - mWaterDis.getViewport(gGLViewport); + mWaterDis.getViewport(gGLViewport); gGL.setColorMask(true, true); mWaterDis.clear(); @@ -9449,19 +9450,19 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) updateCull(camera, mRefractedObjects, water_clip, &plane); stateSort(camera, mRefractedObjects); - renderGeom(camera); + renderGeom(camera); - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } - - LLWorld::getInstance()->renderPropertyLines(); - - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.unbind(); - } + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + + LLWorld::getInstance()->renderPropertyLines(); + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } mWaterDis.flush(); } -- cgit v1.2.3 From fb8e642052bad3f83565574a2dcab1e1deb1cd47 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 20:50:15 -0800 Subject: SL-14275: Don't render clouds in water reflection --- indra/newview/pipeline.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c980851f00..a7f135139d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9329,10 +9329,22 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) //initial sky pass (no user clip plane) { //mask out everything but the sky gPipeline.pushRenderTypeMask(); - gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); + + if (reflection_detail >= WATER_REFLECT_MINIMAL) + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + } + else + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::END_RENDER_TYPES); + } updateCull(camera, mSky); stateSort(camera, mSky); -- cgit v1.2.3 From d629fabd38766d7d9d18eaa40a838f959b899b1c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 20:56:08 -0800 Subject: SL-14275: Cleanup Detabifying --- indra/newview/pipeline.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a7f135139d..6dca840200 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9353,32 +9353,32 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.popRenderTypeMask(); } - gPipeline.pushRenderTypeMask(); - - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - - if (reflection_detail > WATER_REFLECT_MINIMAL) - { //mask out selected geometry based on reflection detail - if (reflection_detail < WATER_REFLECT_EVERYTHING) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_AVATARS) - { + gPipeline.pushRenderTypeMask(); + + clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + + if (reflection_detail > WATER_REFLECT_MINIMAL) + { //mask out selected geometry based on reflection detail + if (reflection_detail < WATER_REFLECT_EVERYTHING) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_AVATARS) + { clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); - } - } - } + if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + } + } + } LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); - LLGLDisable cull(GL_CULL_FACE); + LLGLDisable cull(GL_CULL_FACE); updateCull(camera, mReflectedObjects, -water_clip, &plane); stateSort(camera, mReflectedObjects); renderGeom(camera); -- cgit v1.2.3 From a862322ba9ef9c280c75d1f1c1eebffb640af245 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 22:20:06 -0800 Subject: SL-14275: Implement two new water reflection modes --- indra/newview/pipeline.cpp | 61 ++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6dca840200..f699593c8b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9353,38 +9353,42 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.popRenderTypeMask(); } - gPipeline.pushRenderTypeMask(); - - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - - if (reflection_detail > WATER_REFLECT_MINIMAL) - { //mask out selected geometry based on reflection detail - if (reflection_detail < WATER_REFLECT_EVERYTHING) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_AVATARS) + if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) + { + gPipeline.pushRenderTypeMask(); + + clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + + if (reflection_detail > WATER_REFLECT_MINIMAL) + { //mask out selected geometry based on reflection detail + if (reflection_detail < WATER_REFLECT_EVERYTHING) { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_AVATARS) { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + } } } + + LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); + LLGLDisable cull(GL_CULL_FACE); + updateCull(camera, mReflectedObjects, -water_clip, &plane); + stateSort(camera, mReflectedObjects); + renderGeom(camera); } - LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); - LLGLDisable cull(GL_CULL_FACE); - updateCull(camera, mReflectedObjects, -water_clip, &plane); - stateSort(camera, mReflectedObjects); - renderGeom(camera); + gPipeline.popRenderTypeMask(); } - gPipeline.popRenderTypeMask(); mWaterRef.flush(); } @@ -9460,9 +9464,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) clip_plane.disable(); } - updateCull(camera, mRefractedObjects, water_clip, &plane); - stateSort(camera, mRefractedObjects); - renderGeom(camera); + if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) + { + updateCull(camera, mRefractedObjects, water_clip, &plane); + stateSort(camera, mRefractedObjects); + renderGeom(camera); + } if (LLGLSLShader::sNoFixedFunction) { -- cgit v1.2.3 From 5c7e4c8dce1a971446252295a7e04d3d06e7802e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 22:28:12 -0800 Subject: SL-14275: Cleanup: Add indentation for some push/pop RenderTypeMask() --- indra/newview/pipeline.cpp | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f699593c8b..17650bde15 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9329,63 +9329,63 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) //initial sky pass (no user clip plane) { //mask out everything but the sky gPipeline.pushRenderTypeMask(); - - if (reflection_detail >= WATER_REFLECT_MINIMAL) - { - gPipeline.andRenderTypeMask( - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - } - else { - gPipeline.andRenderTypeMask( - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::END_RENDER_TYPES); - } - - updateCull(camera, mSky); - stateSort(camera, mSky); - renderGeom(camera, TRUE); + if (reflection_detail >= WATER_REFLECT_MINIMAL) + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + } + else + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::END_RENDER_TYPES); + } - gPipeline.popRenderTypeMask(); + updateCull(camera, mSky); + stateSort(camera, mSky); + renderGeom(camera, TRUE); + } + gPipeline.popRenderTypeMask(); } if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) { gPipeline.pushRenderTypeMask(); + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - - if (reflection_detail > WATER_REFLECT_MINIMAL) - { //mask out selected geometry based on reflection detail - if (reflection_detail < WATER_REFLECT_EVERYTHING) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_AVATARS) + if (reflection_detail > WATER_REFLECT_MINIMAL) + { //mask out selected geometry based on reflection detail + if (reflection_detail < WATER_REFLECT_EVERYTHING) { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); - if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_AVATARS) { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + } } } - } - LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); - LLGLDisable cull(GL_CULL_FACE); - updateCull(camera, mReflectedObjects, -water_clip, &plane); - stateSort(camera, mReflectedObjects); - renderGeom(camera); + LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); + LLGLDisable cull(GL_CULL_FACE); + updateCull(camera, mReflectedObjects, -water_clip, &plane); + stateSort(camera, mReflectedObjects); + renderGeom(camera); + } } - gPipeline.popRenderTypeMask(); } -- cgit v1.2.3 From 8e455bf71bd8c8377d21f063c3d150ab0ff7a878 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 5 Nov 2020 22:38:15 -0800 Subject: SL-14275: Cleanup: Detabify generateWaterReflection() --- indra/newview/pipeline.cpp | 223 +++++++++++++++++++++++---------------------- 1 file changed, 114 insertions(+), 109 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 17650bde15..f9d510472d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9228,28 +9228,27 @@ inline float sgn(float a) } 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 || !LLVOAvatar::sVisibleInFirstPerson) - { - skip_avatar_update = true; - } - - LLCamera camera = camera_in; +{ + if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) + { + bool skip_avatar_update = false; + if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) + { + skip_avatar_update = true; + } + LLCamera camera = camera_in; camera.setFar(camera_in.getFar() * 0.75f); bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater(); - LLPipeline::sReflectionRender = true; - - gPipeline.pushRenderTypeMask(); + LLPipeline::sReflectionRender = true; + + gPipeline.pushRenderTypeMask(); glh::matrix4f saved_modelview = get_current_modelview(); glh::matrix4f saved_projection = get_current_projection(); - glh::matrix4f mat; + glh::matrix4f mat; S32 reflection_detail = RenderReflectionDetail; @@ -9265,22 +9264,24 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); - //plane params + //plane params LLPlane plane; - LLVector3 pnorm; - S32 water_clip = 0; + LLVector3 pnorm; + S32 water_clip = 0; if (!camera_is_underwater) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); + { + //camera is above water, clip plane points up + pnorm.setVec(0,0,1); plane.setVec(pnorm, -water_height); water_clip = 1; - } - else - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); + } + else + { + //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-1); plane.setVec(pnorm, water_height); water_clip = -1; - } + } S32 occlusion = LLPipeline::sUseOcclusion; @@ -9288,9 +9289,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::sUseOcclusion = 0; if (!camera_is_underwater) - { //generate planar reflection map - - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0; + { + //generate planar reflection map + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); @@ -9303,9 +9304,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) mReflectionModelView = mat; set_current_modelview(mat); - gGL.loadMatrix(mat.m); + gGL.loadMatrix(mat.m); - LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); glh::vec3f origin(0, 0, 0); glh::matrix4f inv_mat = mat.inverse(); @@ -9313,10 +9314,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOrigin(origin.v); - glCullFace(GL_FRONT); + glCullFace(GL_FRONT); - if (LLDrawPoolWater::sNeedsReflectionUpdate) - { + if (LLDrawPoolWater::sNeedsReflectionUpdate) + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glClearColor(0,0,0,0); mWaterRef.bindTarget(); @@ -9326,38 +9327,38 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gGL.setColorMask(true, false); mWaterRef.getViewport(gGLViewport); - //initial sky pass (no user clip plane) - { //mask out everything but the sky - gPipeline.pushRenderTypeMask(); + //initial sky pass (no user clip plane) + //mask out everything but the sky + gPipeline.pushRenderTypeMask(); + { + if (reflection_detail >= WATER_REFLECT_MINIMAL) { - if (reflection_detail >= WATER_REFLECT_MINIMAL) - { - gPipeline.andRenderTypeMask( - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - } - else - { - gPipeline.andRenderTypeMask( - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::END_RENDER_TYPES); - } - - updateCull(camera, mSky); - stateSort(camera, mSky); - renderGeom(camera, TRUE); + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); } - gPipeline.popRenderTypeMask(); - } + else + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::END_RENDER_TYPES); + } + + updateCull(camera, mSky); + stateSort(camera, mSky); + renderGeom(camera, TRUE); + } + gPipeline.popRenderTypeMask(); if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) { gPipeline.pushRenderTypeMask(); { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_VOIDWATER, LLPipeline::RENDER_TYPE_GROUND, LLPipeline::RENDER_TYPE_SKY, @@ -9371,7 +9372,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); if (reflection_detail < WATER_REFLECT_AVATARS) { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_AVATAR, + LLPipeline::RENDER_TYPE_CONTROL_AV, + END_RENDER_TYPES); if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) { clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); @@ -9392,45 +9396,46 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) mWaterRef.flush(); } - glCullFace(GL_BACK); + glCullFace(GL_BACK); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - + gGL.popMatrix(); + set_current_modelview(saved_modelview); - } + } //LLPipeline::sUseOcclusion = occlusion; - camera.setOrigin(camera_in.getOrigin()); - //render distortion map - static bool last_update = true; - if (last_update) - { + camera.setOrigin(camera_in.getOrigin()); + //render distortion map + static bool last_update = true; + if (last_update) + { gPipeline.pushRenderTypeMask(); - camera.setFar(camera_in.getFar()); - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - END_RENDER_TYPES); + camera.setFar(camera_in.getFar()); + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + END_RENDER_TYPES); // intentionally inverted so that distortion map contents (objects under the water when we're above it) // will properly include water fog effects LLPipeline::sUnderWaterRender = !camera_is_underwater; - if (LLPipeline::sUnderWaterRender) - { + if (LLPipeline::sUnderWaterRender) + { clearRenderTypeMask( - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::RENDER_TYPE_WL_SKY, - END_RENDER_TYPES); - } - LLViewerCamera::updateFrustumPlanes(camera); + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::RENDER_TYPE_WL_SKY, + END_RENDER_TYPES); + } + LLViewerCamera::updateFrustumPlanes(camera); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate) { LLPipeline::sDistortionRender = true; @@ -9439,10 +9444,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; - + mWaterDis.bindTarget(); mWaterDis.getViewport(gGLViewport); - + gGL.setColorMask(true, true); mWaterDis.clear(); gGL.setColorMask(true, false); @@ -9454,15 +9459,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPlane plane(-pnorm, water_dist); LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection); - gGL.setColorMask(true, true); - mWaterDis.clear(); - gGL.setColorMask(true, false); + gGL.setColorMask(true, true); + mWaterDis.clear(); + gGL.setColorMask(true, false); // ignore clip plane if we're underwater and viewing distortion map of objects above waterline if (camera_is_underwater) - { + { clip_plane.disable(); - } + } if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) { @@ -9484,39 +9489,39 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } mWaterDis.flush(); - } + } LLPipeline::sDistortionRender = false; - + gPipeline.popRenderTypeMask(); - } - last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; + } + last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; gPipeline.popRenderTypeMask(); LLPipeline::sUseOcclusion = occlusion; LLPipeline::sUnderWaterRender = false; - LLPipeline::sReflectionRender = false; + LLPipeline::sReflectionRender = false; LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; - if (!LLRenderTarget::sUseFBO) - { - glClear(GL_DEPTH_BUFFER_BIT); - } - glClearColor(0.f, 0.f, 0.f, 0.f); - gViewerWindow->setup3DViewport(); - - LLGLState::checkStates(); + if (!LLRenderTarget::sUseFBO) + { + glClear(GL_DEPTH_BUFFER_BIT); + } + glClearColor(0.f, 0.f, 0.f, 0.f); + gViewerWindow->setup3DViewport(); - if (!skip_avatar_update) - { - gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); - } + LLGLState::checkStates(); - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; - } + if (!skip_avatar_update) + { + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); + } + + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; + } } glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up) -- cgit v1.2.3 From c865eda3b31a982c601889d8b2259c98032b25b5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 9 Nov 2020 16:54:04 -0800 Subject: SL-14275: Replace enum with S32 to better match reflection_detail --- indra/newview/pipeline.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f9d510472d..623a109d2d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -130,16 +130,13 @@ #define MATERIALS_IN_REFLECTIONS 0 // NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml -enum EWaterReflectionMode -{ - WATER_REFLECT_NONE_WATER_OPAQUE = -2, - WATER_REFLECT_NONE_WATER_TRANSPARENT = -1, - WATER_REFLECT_MINIMAL = 0, - WATER_REFLECT_TERRAIN = 1, - WATER_REFLECT_STATIC_OBJECTS = 2, - WATER_REFLECT_AVATARS = 3, - WATER_REFLECT_EVERYTHING = 4 -}; +const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; +const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; +const S32 WATER_REFLECT_MINIMAL = 0; +const S32 WATER_REFLECT_TERRAIN = 1; +const S32 WATER_REFLECT_STATIC_OBJECTS = 2; +const S32 WATER_REFLECT_AVATARS = 3; +const S32 WATER_REFLECT_EVERYTHING = 4; bool gShiftFrame = false; -- cgit v1.2.3 From f9a09406b38ad62e1db5914a96e462002c80fce9 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 11 Nov 2020 13:38:19 -0800 Subject: SL-14275: Comment out unused global consts for compilers that treat this an an error --- indra/newview/pipeline.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 623a109d2d..c09c593c4a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -130,13 +130,14 @@ #define MATERIALS_IN_REFLECTIONS 0 // NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml -const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; -const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; -const S32 WATER_REFLECT_MINIMAL = 0; -const S32 WATER_REFLECT_TERRAIN = 1; -const S32 WATER_REFLECT_STATIC_OBJECTS = 2; -const S32 WATER_REFLECT_AVATARS = 3; -const S32 WATER_REFLECT_EVERYTHING = 4; +// NOTE: Unused consts are commented out since some compilers (on macOS) may complain about unused variables. +// const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; + const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; + const S32 WATER_REFLECT_MINIMAL = 0; +// const S32 WATER_REFLECT_TERRAIN = 1; + const S32 WATER_REFLECT_STATIC_OBJECTS = 2; + const S32 WATER_REFLECT_AVATARS = 3; + const S32 WATER_REFLECT_EVERYTHING = 4; bool gShiftFrame = false; -- cgit v1.2.3 From 9962df9fb7303dc52f52bf448bef407342286008 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 4 Jan 2021 16:33:50 +0200 Subject: SL-14529 Replace dynamic_cast to LLAvatarJoint with static casts Replaced couple (LLAvatarJoint*) for consistency --- indra/llappearance/llavatarjoint.cpp | 6 +++--- indra/newview/llviewerjoint.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp index 80b3e42b52..a1d4fe6423 100644 --- a/indra/llappearance/llavatarjoint.cpp +++ b/indra/llappearance/llavatarjoint.cpp @@ -103,7 +103,7 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) for (joints_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { - LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); + LLAvatarJoint* joint = static_cast(*iter); joint->setValid(valid, TRUE); } } @@ -136,7 +136,7 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive) for (joints_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { - LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); + LLAvatarJoint* joint = static_cast(*iter); joint->setVisible(visible, recursive); } } @@ -167,7 +167,7 @@ void LLAvatarJoint::updateJointGeometry() for (joints_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { - LLAvatarJoint* joint = dynamic_cast(*iter); + LLAvatarJoint* joint = static_cast(*iter); joint->updateJointGeometry(); } } diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index a448a95904..9653e80b53 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -143,8 +143,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) //---------------------------------------------------------------- for (LLJoint* j : mChildren) { - LLAvatarJoint* joint = dynamic_cast(j); - F32 jointLOD = joint ? joint->getLOD() : 0; + // LLViewerJoint is derived from LLAvatarJoint, + // all children of LLAvatarJoint are assumed to be LLAvatarJoint + LLAvatarJoint* joint = static_cast(j); + F32 jointLOD = joint->getLOD(); if (pixelArea >= jointLOD || sDisableLOD) { triangle_count += joint->render( pixelArea, TRUE, is_dummy ); -- cgit v1.2.3 From 1a8800b051166d3406065df312c66b7e4f00fe05 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 19 Nov 2020 16:56:10 +0000 Subject: SL-14347 Crash at ChoosePixelFormat --- indra/llwindow/llwindowwin32.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8ec85976c3..6831071cd1 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -428,7 +428,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp)); memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp)); mCustomGammaSet = FALSE; - + mWindowHandle = NULL; + if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) { mMouseVanish = TRUE; @@ -1169,7 +1170,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO << " Height: " << (window_rect.bottom - window_rect.top) << " Fullscreen: " << mFullscreen << LL_ENDL; - if (!destroy_window_handler(mWindowHandle)) + if (mWindowHandle && !destroy_window_handler(mWindowHandle)) { LL_WARNS("Window") << "Failed to properly close window before recreating it!" << LL_ENDL; } @@ -1228,13 +1229,26 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "Device context retrieved." << LL_ENDL ; - if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd))) - { - close(); - OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), - mCallbacks->translateString("MBError"), OSMB_OK); - return FALSE; - } + try + { + // Looks like ChoosePixelFormat can crash in case of faulty driver + if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd))) + { + LL_WARNS("Window") << "ChoosePixelFormat failed, code: " << GetLastError() << LL_ENDL; + OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), + mCallbacks->translateString("MBError"), OSMB_OK); + close(); + return FALSE; + } + } + catch (...) + { + LL_WARNS("Window") << "ChoosePixelFormat failed." << LL_ENDL; + OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), + mCallbacks->translateString("MBError"), OSMB_OK); + close(); + return FALSE; + } LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ; @@ -1494,7 +1508,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO } // Destroy The Window - if (!destroy_window_handler(mWindowHandle)) + if (mWindowHandle && !destroy_window_handler(mWindowHandle)) { LL_WARNS("Window") << "Failed to properly close window!" << LL_ENDL; } -- cgit v1.2.3 From 5af5498cf60b98c6ca00a1341ec4099b6cf0ffe9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 14 Dec 2020 19:20:22 +0200 Subject: SL-11300 Camera distance to avatar in neighbouring region incorrect --- indra/newview/lldrawable.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 2219f20272..1da94f4698 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -912,22 +912,18 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) if (volume->getAvatar()) { const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents(); - LLVector3d cam_pos = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); - LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); - - LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); + LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box); mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() << " pos (ignored) " << pos - << " cam pos " << cam_pos - << " cam region pos " << cam_region_pos + << " cam pos " << cam_pos_from_agent << " box " << av_box[0] << "," << av_box[1] << " -> dist " << mDistanceWRTCamera << LL_ENDL; mVObjp->updateLOD(); return; } - } else { -- cgit v1.2.3 From daa957b93ba173feb69d003dbc578e621a9a68e3 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 6 Jan 2021 17:36:10 -0800 Subject: SL-14035: Incorporate patch from Sovereign Engineer to fix specular reflection --- indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 3 +++ indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 7 ++----- .../app_settings/shaders/class1/deferred/multiPointLightF.glsl | 2 -- .../app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 4 ---- .../newview/app_settings/shaders/class1/deferred/pointLightF.glsl | 3 +-- .../newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 2 +- .../app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 4 ---- .../newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 5 +++-- indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 2 +- 9 files changed, 11 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index d29e8a9423..eb6e56e718 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -40,6 +40,8 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; +vec3 linear_to_srgb(vec3 c); + void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -52,6 +54,7 @@ void main() vec4 norm = texture2D(normalMap, vary_texcoord0.xy); vec4 spec = texture2D(specularMap, vary_texcoord0.xy); + col.rgb = linear_to_srgb(col.rgb); frag_data[0] = vec4(col.rgb, 0.0); frag_data[1] = spec; frag_data[2] = vec4(norm.xy,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 80d19102b6..bb69e45816 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -159,11 +159,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe vec3 speccol = lit*scol*light_col.rgb*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); col += speccol; - - float cur_glare = max(speccol.r, speccol.g); - cur_glare = max(cur_glare, speccol.b); - glare = max(glare, speccol.r); - glare += max(cur_glare, 0.0); } } } @@ -406,6 +401,8 @@ void main() vec3 light = vec3(0, 0, 0); + final_specular.rgb = srgb_to_linear(final_specular.rgb); // SL-14035 + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); LIGHT_LOOP(1) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 8c402fcb54..09c47165dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -73,9 +73,7 @@ void main() vec3 norm = getNorm(frag.xy); vec4 spec = texture2DRect(specularRect, frag.xy); - spec.rgb = srgb_to_linear(spec.rgb); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; - diff.rgb = srgb_to_linear(diff.rgb); float noise = texture2D(noiseMap, frag.xy / 128.0).b; vec3 npos = normalize(-pos); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 9bba45bc4e..ec3fb9c543 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -182,10 +182,6 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere* - // *gbuffer is sRGB, convert to linear whenever sampling from it - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index d805c9ea48..18616a9bb3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -90,7 +90,6 @@ void main() float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; - col.rgb = srgb_to_linear(col.rgb); float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); @@ -127,7 +126,7 @@ void main() { discard; } -//col.rgb = vec3(0); + frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index f80f1a985a..7f2c603f87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -90,7 +90,7 @@ void main() vec4 diffuse = texture2DRect(diffuseRect, tc); //convert to gamma space - //diffuse.rgb = linear_to_srgb(diffuse.rgb); + diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 color = vec3(0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 5d7a28c359..1b7a1cc6ec 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -191,10 +191,6 @@ void main() float da = dot(norm, lv); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere* - // *gbuffer IS sRGB, convert to linear since this shader outputs linear - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec4 spec = texture2DRect(specularRect, frag.xy); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f4db53e0b7..7700d16007 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -87,8 +87,9 @@ void main() float light_gamma = 1.0 / 1.3; da = pow(da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec4 diffuse = texture2DRect(diffuseRect, tc); + diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14025 + vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; scol_ambocc = pow(scol_ambocc, vec2(light_gamma)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 5ab0b5c5b4..774f537821 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -189,7 +189,7 @@ void main() lv = normalize(lv); float da = dot(norm, lv); - vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); + vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; vec4 spec = texture2DRect(specularRect, frag.xy); vec3 dlit = vec3(0, 0, 0); -- cgit v1.2.3 From a5aac898093371fddf3c7323c9dadc2f5be15583 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 6 Jan 2021 18:17:56 -0800 Subject: SL-14035: Don't use sRGB textures when not specified --- indra/llrender/llrender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 11d9ef3f57..d515fc707a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -871,10 +871,10 @@ void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) } } else -#endif { glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); } +#endif } LLLightState::LLLightState(S32 index) -- cgit v1.2.3 From f89db964071121812baa4d81ce065f3579701251 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 7 Jan 2021 10:39:55 -0800 Subject: SL-14035 revert incorrect removal of glare --- indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index bb69e45816..e1f7031af6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -159,6 +159,11 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe vec3 speccol = lit*scol*light_col.rgb*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); col += speccol; + + float cur_glare = max(speccol.r, speccol.g); + cur_glare = max(cur_glare, speccol.b); + glare = max(glare, speccol.r); + glare += max(cur_glare, 0.0); } } } -- cgit v1.2.3 From 9e58a7bdd6777889a43c2a7753cd3b372e55fe84 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 12 Jan 2021 18:13:16 -0700 Subject: SL-13629 Modify texcoord to reverse rainbow color order --- .../newview/app_settings/shaders/class2/deferred/skyF.glsl | 10 +++++++++- .../newview/app_settings/shaders/class3/deferred/skyF.glsl | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index 1485c515a4..5a58f9bc8c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -73,7 +73,15 @@ uniform float ice_level; vec3 rainbow(float d) { - d = clamp(d, -1.0, 0.0); + // d is the dot product of view and sun directions, so ranging -1.0..1.0 + // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec + // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + + // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. + // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the + // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 + d = clamp(-0.575 - d, 0.0, 1.0); + float rad = (droplet_radius - 5.0f) / 1024.0f; return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 6de01cb667..0f908a1d82 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -56,8 +56,17 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir vec3 ColorFromRadiance(vec3 radiance); vec3 rainbow(float d) { - float rad = (droplet_radius - 5.0f) / 1024.0f; - return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; + // d is the dot product of view and sun directions, so ranging -1.0..1.0 + // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec + // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + + // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. + // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the + // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 + d = clamp(-0.575 - d, 0.0, 1.0); + + float rad = (droplet_radius - 5.0f) / 1024.0f; + return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } vec3 halo22(float d) -- cgit v1.2.3 From 28b9a465ac79e7d2284f9d561bb3ffda61c922d8 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 19 Jan 2021 11:11:46 -0700 Subject: SL-13629, reconstruct rainbow lookup coord to reduce interior banding --- indra/newview/app_settings/shaders/class2/deferred/skyF.glsl | 6 ++++++ indra/newview/app_settings/shaders/class3/deferred/skyF.glsl | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index 5a58f9bc8c..6841a8194f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -82,6 +82,12 @@ vec3 rainbow(float d) // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 d = clamp(-0.575 - d, 0.0, 1.0); + // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. + // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate + // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 + float interior_coord = max(0.0, d - 0.25) * 4.2857; + d = clamp(d, 0.0, 0.25) + interior_coord; + float rad = (droplet_radius - 5.0f) / 1024.0f; return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 0f908a1d82..a0b082ed7c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -65,6 +65,12 @@ vec3 rainbow(float d) // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 d = clamp(-0.575 - d, 0.0, 1.0); + // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. + // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate + // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 + float interior_coord = max(0.0, d - 0.25) * 4.2857; + d = clamp(d, 0.0, 0.25) + interior_coord; + float rad = (droplet_radius - 5.0f) / 1024.0f; return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } -- cgit v1.2.3 From 1e26adf288f8b4585c0ce8338dd548475613862c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 22 Jan 2021 16:31:50 -0800 Subject: SL-14707: Merge Sovereign Engineer's fix for clouds: Clouds are unusually dim in EEP --- indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl | 1 + indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl | 1 + 2 files changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index a132220bef..8e0a001403 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -166,6 +166,7 @@ void main() (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); // CLOUDS + sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); sunlight *= exp(-light_atten * off_axis); diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index b004cc7ddd..97ffa9feef 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -166,6 +166,7 @@ void main() (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); // CLOUDS + sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); sunlight *= exp(-light_atten * off_axis); -- cgit v1.2.3 From ef4c7c124753ca93659e34c6bbf0f6ef0ca208e7 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 21 Jan 2021 17:29:54 -0800 Subject: SL-14705: Merge Sovereign Engineer's fix for name tags showing in front with AMD GPUs: Fix GL_INVALID_OPERATION when copying stencil to default window framebuffer on AMD graphics on windows --- indra/llwindow/llwindowwin32.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 6831071cd1..0db9886d03 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1474,24 +1474,29 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "pixel formats done." << LL_ENDL ; - S32 swap_method = 0; - S32 cur_format = num_formats-1; - GLint swap_query = WGL_SWAP_METHOD_ARB; - - BOOL found_format = FALSE; - - while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) + S32 swap_method = 0; + S32 cur_format = 0; + GLint swap_query = WGL_SWAP_METHOD_ARB; + + // SL-14705 Fix name tags showing in front of objects with AMD GPUs. + // On AMD hardware we need to iterate from the first pixel format to the end. + // Spec: + // https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt + while (wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method)) { - if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0) + if (swap_method == WGL_SWAP_UNDEFINED_ARB) { - found_format = TRUE; + break; } - else + else if (cur_format >= (S32)(num_formats - 1)) { - --cur_format; + cur_format = 0; + break; } + + ++cur_format; } - + pixel_format = pixel_formats[cur_format]; if (mhDC != 0) // Does The Window Have A Device Context? -- cgit v1.2.3 From 7b2dd98962c92a4ae84ce8042109f0d9ec9b4b56 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 22 Jan 2021 16:48:31 -0800 Subject: SL-14705: Cleanup U32 S32 cast --- indra/llwindow/llwindowwin32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 0db9886d03..afe0c2cc6a 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1476,6 +1476,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO S32 swap_method = 0; S32 cur_format = 0; +const S32 max_format = (S32)num_formats - 1; GLint swap_query = WGL_SWAP_METHOD_ARB; // SL-14705 Fix name tags showing in front of objects with AMD GPUs. @@ -1488,7 +1489,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO { break; } - else if (cur_format >= (S32)(num_formats - 1)) + else if (cur_format >= max_format) { cur_format = 0; break; -- cgit v1.2.3 From 6564fce81aa22e2ff558206903d2281a57a7f1cd Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 22 Jan 2021 16:58:58 -0700 Subject: SL-13490 fix debug normals under non-uniform scale --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llspatialpartition.cpp | 126 ++++++++++++++++++++++---------- 2 files changed, 87 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0b9cc78132..62ceb9077a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9091,7 +9091,7 @@ Type F32 Value - 0.03 + 0.1 RenderDebugPipeline diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 8fc2405f0a..b87551dab5 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2253,52 +2253,98 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) } } -void renderNormals(LLDrawable* drawablep) +void renderNormals(LLDrawable *drawablep) { - LLVertexBuffer::unbind(); + if (!drawablep->isVisible()) + return; - LLVOVolume* vol = drawablep->getVOVolume(); - if (vol) - { - LLVolume* volume = vol->getVolume(); - gGL.pushMatrix(); - gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVertexBuffer::unbind(); - LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); + LLVOVolume *vol = drawablep->getVOVolume(); - for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = volume->getVolumeFace(i); + if (vol) + { + LLVolume *volume = vol->getVolume(); - for (S32 j = 0; j < face.mNumVertices; ++j) - { - gGL.begin(LLRender::LINES); - LLVector4a n,p; - - n.setMul(face.mNormals[j], scale); - p.setAdd(face.mPositions[j], n); - - gGL.diffuseColor4f(1,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - - if (face.mTangents) - { - n.setMul(face.mTangents[j], scale); - p.setAdd(face.mPositions[j], n); - - gGL.diffuseColor4f(0,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - } - gGL.end(); - } - } + // Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied. + // + // SL-13490, using pos + normal to compute the 2nd vertex of a normal line segment doesn't + // work when there's a non-uniform scale in the mix. Normals require MVP-inverse-transpose + // transform. We get that effect here by pre-applying the inverse scale (twice, because + // one forward scale will be re-applied via the MVP in the vertex shader) - gGL.popMatrix(); - } + LLVector3 scale_v3 = vol->getScale(); + LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]); + obj_scale.normalize3(); + + float draw_length = gSavedSettings.getF32("RenderDebugNormalScale"); + + // Create inverse-scale vector for normals + LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]); + inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice + inv_scale.normalize3fast(); + + gGL.pushMatrix(); + gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) + { + const LLVolumeFace &face = volume->getVolumeFace(i); + + gGL.flush(); + gGL.diffuseColor4f(1, 1, 0, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a n, p; + + n.setMul(face.mNormals[j], 1.0); + n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP + n.normalize3fast(); + + // Since we send 2 vertices instead of a vertex and a vector, the drawn normal length ends up + // getting stretched along with the object. To minimize that effect (imperfectly), reduce its + // length by a dot factor with the dominant scale direction. + float mvp_scale_factor = 0.95 * abs(n.dot3(obj_scale).getF32()); + n.mul((1.0 - mvp_scale_factor) * draw_length); + p.setAdd(face.mPositions[j], n); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + + // Tangents are simple vectors and do not require reorientation via pre-scaling + if (face.mTangents) + { + gGL.flush(); + gGL.diffuseColor4f(0, 1, 1, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a t, p; + + t.setMul(face.mTangents[j], 1.0f); + t.normalize3fast(); + + // Since we send 2 vertices instead of a vertex and a vector, the drawn tangent length ends up + // getting stretched along with the object. To minimize that effect (imperfectly), reduce its + // length by a dot factor with the dominant scale direction. + float mvp_scale_factor = 0.95 * abs(t.dot3(obj_scale).getF32()); + t.mul((1.0 - mvp_scale_factor) * draw_length); + p.setAdd(face.mPositions[j], t); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + } + } + + gGL.popMatrix(); + } } S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale) -- cgit v1.2.3 From 10e95a60af08c870e3d2b0a4cc74f76cd923d2aa Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 29 Jan 2021 12:05:29 -0700 Subject: SL-13490 replace imperfect object-relative normals with constant length --- indra/newview/llspatialpartition.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b87551dab5..0186c1943f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2274,10 +2274,13 @@ void renderNormals(LLDrawable *drawablep) // one forward scale will be re-applied via the MVP in the vertex shader) LLVector3 scale_v3 = vol->getScale(); + float scale_len = scale_v3.length(); LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]); obj_scale.normalize3(); - float draw_length = gSavedSettings.getF32("RenderDebugNormalScale"); + // Normals &tangent line segments get scaled along with the object. Divide by scale length + // to keep the as-viewed lengths (relatively) constant with the debug setting length + float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len; // Create inverse-scale vector for normals LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]); @@ -2303,12 +2306,7 @@ void renderNormals(LLDrawable *drawablep) n.setMul(face.mNormals[j], 1.0); n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP n.normalize3fast(); - - // Since we send 2 vertices instead of a vertex and a vector, the drawn normal length ends up - // getting stretched along with the object. To minimize that effect (imperfectly), reduce its - // length by a dot factor with the dominant scale direction. - float mvp_scale_factor = 0.95 * abs(n.dot3(obj_scale).getF32()); - n.mul((1.0 - mvp_scale_factor) * draw_length); + n.mul(draw_length); p.setAdd(face.mPositions[j], n); gGL.vertex3fv(face.mPositions[j].getF32ptr()); @@ -2328,12 +2326,7 @@ void renderNormals(LLDrawable *drawablep) t.setMul(face.mTangents[j], 1.0f); t.normalize3fast(); - - // Since we send 2 vertices instead of a vertex and a vector, the drawn tangent length ends up - // getting stretched along with the object. To minimize that effect (imperfectly), reduce its - // length by a dot factor with the dominant scale direction. - float mvp_scale_factor = 0.95 * abs(t.dot3(obj_scale).getF32()); - t.mul((1.0 - mvp_scale_factor) * draw_length); + t.mul(draw_length); p.setAdd(face.mPositions[j], t); gGL.vertex3fv(face.mPositions[j].getF32ptr()); -- cgit v1.2.3 From d7b2016e39cb298a0a105e624ecc7bcf9d7db187 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 29 Jan 2021 13:04:39 -0800 Subject: SL-14731: Fix sun gamma -- merge Sovereign Engineer's patch: Fix sun gamma space for accurate color reproduction of sun textures --- indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl | 4 ---- indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl | 1 - 2 files changed, 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 454af2a9bc..b2fa5d8a25 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -49,10 +49,6 @@ void main() vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); - c.rgb = srgb_to_linear(c.rgb); - c.rgb = clamp(c.rgb, vec3(0), vec3(1)); - c.rgb = pow(c.rgb, vec3(0.7f)); - //c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index b9ae7a0226..5a41dc644a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -51,7 +51,6 @@ void main() // SL-9806 stars poke through // c.a *= sun_fade; - c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); frag_color = c; -- cgit v1.2.3 From cc6d132e90921c7006253f6fba149d22f2cabd39 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 29 Jan 2021 14:32:37 -0800 Subject: SL-14732: Merge Sovereign Engineer's cloud patch: Fix writing outside outside of the bound fbo in forward render class2 cloud shader --- indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 75bf8730df..fa928d993e 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -26,9 +26,9 @@ /*[EXTRA_CODE_HERE]*/ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; +out vec4 frag_color; #else -#define frag_data gl_FragData +#define frag_color gl_FragColor #endif ///////////////////////////////////////////////////////////////////////// @@ -126,8 +126,6 @@ void main() color.rgb = scaleSoftClip(color.rgb); /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, alpha1); - frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0,0,0,1); + frag_color = vec4(color.rgb, alpha1); } -- cgit v1.2.3 From ab02a6dfd42bb44bdfbdf5a97221c0abdfbe81e2 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 29 Jan 2021 18:41:04 -0800 Subject: SL-14706 Merge Sovereign Engineer's fix for stars not centered around camera: Stars render around center of sim instead of center of camera. --- indra/newview/lldrawpoolwlsky.cpp | 13 +++++++++---- indra/newview/lldrawpoolwlsky.h | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index d4e7f1600e..0c3d8f3098 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -226,7 +226,7 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL } } -void LLDrawPoolWLSky::renderStars(void) const +void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_skybox(true, false); @@ -266,6 +266,7 @@ void LLDrawPoolWLSky::renderStars(void) const } gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); if (LLGLSLShader::sNoFixedFunction) { @@ -296,7 +297,7 @@ void LLDrawPoolWLSky::renderStars(void) const } } -void LLDrawPoolWLSky::renderStarsDeferred(void) const +void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_sky(true, false); @@ -337,6 +338,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->bind(tex_b); } + gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); if (LLPipeline::sReflectionRender) @@ -355,6 +358,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); gDeferredStarProgram.unbind(); + + gGL.popMatrix(); } void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const @@ -601,7 +606,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(); + renderStarsDeferred(origin); renderHeavenlyBodies(); renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } @@ -620,7 +625,7 @@ void LLDrawPoolWLSky::render(S32 pass) LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); renderSkyHaze(origin, camHeightLocal); - renderStars(); + renderStars(origin); renderHeavenlyBodies(); renderSkyClouds(origin, camHeightLocal, cloud_shader); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index a4f176d6db..324886ed42 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -78,8 +78,8 @@ private: void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderStarsDeferred(void) const; - void renderStars(void) const; + void renderStarsDeferred(const LLVector3& camPosLocal) const; + void renderStars(const LLVector3& camPosLocal) const; void renderHeavenlyBodies(); }; -- cgit v1.2.3 From 033d16747c7aab02e67001c210ecdb1cf953e327 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 1 Feb 2021 16:25:56 -0700 Subject: DRTVWR-525 fix build error resulting from 6.4.13 merge --- indra/llrender/llgl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 542b081806..43fedeca64 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1015,7 +1015,6 @@ void LLGLManager::asLLSD(LLSD& info) // Other fields info["has_requirements"] = mHasRequirements; info["has_separate_specular_color"] = mHasSeparateSpecularColor; - info["debug_gpu"] = mDebugGPU; info["max_vertex_range"] = mGLMaxVertexRange; info["max_index_range"] = mGLMaxIndexRange; info["max_texture_size"] = mGLMaxTextureSize; -- cgit v1.2.3 From dab09485448f7761f88d0debe6e5204a5980b6d2 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 4 Feb 2021 10:51:46 -0700 Subject: DRTVWR-525, improve dev's quality-of-life --- indra/llrender/llshadermgr.h | 428 ++++++++++++++++++++-------------------- indra/llrender/llvertexbuffer.h | 43 ++-- 2 files changed, 238 insertions(+), 233 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 127b5ce5b6..3908efd4ec 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -36,221 +36,223 @@ public: LLShaderMgr(); virtual ~LLShaderMgr(); - typedef enum - { - MODELVIEW_MATRIX = 0, - PROJECTION_MATRIX, - INVERSE_PROJECTION_MATRIX, - MODELVIEW_PROJECTION_MATRIX, - INVERSE_MODELVIEW_MATRIX, - NORMAL_MATRIX, - TEXTURE_MATRIX0, - TEXTURE_MATRIX1, - TEXTURE_MATRIX2, - TEXTURE_MATRIX3, - OBJECT_PLANE_S, - OBJECT_PLANE_T, - 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, - DIFFUSE_MAP, - ALTERNATE_DIFFUSE_MAP, - SPECULAR_MAP, - BUMP_MAP, - BUMP_MAP2, - ENVIRONMENT_MAP, - CLOUD_NOISE_MAP, - CLOUD_NOISE_MAP_NEXT, - 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, - BOX_CENTER, - BOX_SIZE, - - GLOW_MIN_LUMINANCE, - GLOW_MAX_EXTRACT_ALPHA, - GLOW_LUM_WEIGHTS, - GLOW_WARMTH_WEIGHTS, - GLOW_WARMTH_AMOUNT, - GLOW_STRENGTH, - GLOW_DELTA, - - MINIMUM_ALPHA, - EMISSIVE_BRIGHTNESS, - - 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_MOON_DIR, - DEFERRED_SHADOW_RES, - DEFERRED_PROJ_SHADOW_RES, - DEFERRED_DEPTH_CUTOFF, - DEFERRED_NORM_CUTOFF, - DEFERRED_SHADOW_TARGET_WIDTH, - - 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, - DOF_MAX_COF, - DOF_RES_SCALE, - DOF_WIDTH, - DOF_HEIGHT, - - 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, - DEFERRED_NORM_MATRIX, - TEXTURE_GAMMA, - SPECULAR_COLOR, - ENVIRONMENT_INTENSITY, - - AVATAR_MATRIX, - AVATAR_TRANSLATION, - - WATER_SCREENTEX, - WATER_SCREENDEPTH, - WATER_REFTEX, - WATER_EYEVEC, - WATER_TIME, - WATER_WAVE_DIR1, - WATER_WAVE_DIR2, - WATER_LIGHT_DIR, - WATER_SPECULAR, - WATER_SPECULAR_EXP, - WATER_FOGCOLOR, - WATER_FOGDENSITY, - WATER_FOGKS, - WATER_REFSCALE, - WATER_WATERHEIGHT, - WATER_WATERPLANE, - WATER_NORM_SCALE, - WATER_FRESNEL_SCALE, - WATER_FRESNEL_OFFSET, - WATER_BLUR_MULTIPLIER, - WATER_SUN_ANGLE, - WATER_SCALED_ANGLE, - WATER_SUN_ANGLE2, - - WL_CAMPOSLOCAL, - - AVATAR_WIND, - AVATAR_SINWAVE, - AVATAR_GRAVITY, - - TERRAIN_DETAIL0, - TERRAIN_DETAIL1, - TERRAIN_DETAIL2, - TERRAIN_DETAIL3, - TERRAIN_ALPHARAMP, - - SHINY_ORIGIN, - DISPLAY_GAMMA, - - INSCATTER_RT, - SUN_SIZE, - FOG_COLOR, + // clang-format off + typedef enum + { // Shader uniform name, set in LLShaderMgr::initAttribsAndUniforms() + MODELVIEW_MATRIX = 0, // "modelview_matrix" + PROJECTION_MATRIX, // "projection_matrix" + INVERSE_PROJECTION_MATRIX, // "inv_proj" + MODELVIEW_PROJECTION_MATRIX, // "modelview_projection_matrix" + INVERSE_MODELVIEW_MATRIX, // "inv_modelview" + NORMAL_MATRIX, // "normal_matrix" + TEXTURE_MATRIX0, // "texture_matrix0" + TEXTURE_MATRIX1, // "texture_matrix1" + TEXTURE_MATRIX2, // "texture_matrix2" + TEXTURE_MATRIX3, // "texture_matrix3" + OBJECT_PLANE_S, // "object_plane_s" + OBJECT_PLANE_T, // "object_plane_t" + VIEWPORT, // "viewport" + LIGHT_POSITION, // "light_position" + LIGHT_DIRECTION, // "light_direction" + LIGHT_ATTENUATION, // "light_attenuation" + LIGHT_DIFFUSE, // "light_diffuse" + LIGHT_AMBIENT, // "light_ambient" + MULTI_LIGHT_COUNT, // "light_count" + MULTI_LIGHT, // "light" + MULTI_LIGHT_COL, // "light_col" + MULTI_LIGHT_FAR_Z, // "far_z" + PROJECTOR_MATRIX, // "proj_mat" + PROJECTOR_NEAR, // "proj_near" + PROJECTOR_P, // "proj_p" + PROJECTOR_N, // "proj_n" + PROJECTOR_ORIGIN, // "proj_origin" + PROJECTOR_RANGE, // "proj_range" + PROJECTOR_AMBIANCE, // "proj_ambiance" + PROJECTOR_SHADOW_INDEX, // "proj_shadow_idx" + PROJECTOR_SHADOW_FADE, // "shadow_fade" + PROJECTOR_FOCUS, // "proj_focus" + PROJECTOR_LOD, // "proj_lod" + PROJECTOR_AMBIENT_LOD, // "proj_ambient_lod" + DIFFUSE_COLOR, // "color" + DIFFUSE_MAP, // "diffuseMap" + ALTERNATE_DIFFUSE_MAP, // "altDiffuseMap" + SPECULAR_MAP, // "specularMap" + BUMP_MAP, // "bumpMap" + BUMP_MAP2, // "bumpMap2" + ENVIRONMENT_MAP, // "environmentMap" + CLOUD_NOISE_MAP, // "cloud_noise_texture" + CLOUD_NOISE_MAP_NEXT, // "cloud_noise_texture_next" + FULLBRIGHT, // "fullbright" + LIGHTNORM, // "lightnorm" + SUNLIGHT_COLOR, // "sunlight_color" + AMBIENT, // "ambient_color" + BLUE_HORIZON, // "blue_horizon" + BLUE_DENSITY, // "blue_density" + HAZE_HORIZON, // "haze_horizon" + HAZE_DENSITY, // "haze_density" + CLOUD_SHADOW, // "cloud_shadow" + DENSITY_MULTIPLIER, // "density_multiplier" + DISTANCE_MULTIPLIER, // "distance_multiplier" + MAX_Y, // "max_y" + GLOW, // "glow" + CLOUD_COLOR, // "cloud_color" + CLOUD_POS_DENSITY1, // "cloud_pos_density1" + CLOUD_POS_DENSITY2, // "cloud_pos_density2" + CLOUD_SCALE, // "cloud_scale" + GAMMA, // "gamma" + SCENE_LIGHT_STRENGTH, // "scene_light_strength" + LIGHT_CENTER, // "center" + LIGHT_SIZE, // "size" + LIGHT_FALLOFF, // "falloff" + BOX_CENTER, // "box_center" + BOX_SIZE, // "box_size" + + GLOW_MIN_LUMINANCE, // "minLuminance" + GLOW_MAX_EXTRACT_ALPHA, // "maxExtractAlpha" + GLOW_LUM_WEIGHTS, // "lumWeights" + GLOW_WARMTH_WEIGHTS, // "warmthWeights" + GLOW_WARMTH_AMOUNT, // "warmthAmount" + GLOW_STRENGTH, // "glowStrength" + GLOW_DELTA, // "glowDelta" + + MINIMUM_ALPHA, // "minimum_alpha" + EMISSIVE_BRIGHTNESS, // "emissive_brightness" + + DEFERRED_SHADOW_MATRIX, // "shadow_matrix" + DEFERRED_ENV_MAT, // "env_mat" + DEFERRED_SHADOW_CLIP, // "shadow_clip" + DEFERRED_SUN_WASH, // "sun_wash" + DEFERRED_SHADOW_NOISE, // "shadow_noise" + DEFERRED_BLUR_SIZE, // "blur_size" + DEFERRED_SSAO_RADIUS, // "ssao_radius" + DEFERRED_SSAO_MAX_RADIUS, // "ssao_max_radius" + DEFERRED_SSAO_FACTOR, // "ssao_factor" + DEFERRED_SSAO_FACTOR_INV, // "ssao_factor_inv" + DEFERRED_SSAO_EFFECT_MAT, // "ssao_effect_mat" + DEFERRED_SCREEN_RES, // "screen_res" + DEFERRED_NEAR_CLIP, // "near_clip" + DEFERRED_SHADOW_OFFSET, // "shadow_offset" + DEFERRED_SHADOW_BIAS, // "shadow_bias" + DEFERRED_SPOT_SHADOW_BIAS, // "spot_shadow_bias" + DEFERRED_SPOT_SHADOW_OFFSET, // "spot_shadow_offset" + DEFERRED_SUN_DIR, // "sun_dir" + DEFERRED_MOON_DIR, // "moon_dir" + DEFERRED_SHADOW_RES, // "shadow_res" + DEFERRED_PROJ_SHADOW_RES, // "proj_shadow_res" + DEFERRED_DEPTH_CUTOFF, // "depth_cutoff" + DEFERRED_NORM_CUTOFF, // "norm_cutoff" + DEFERRED_SHADOW_TARGET_WIDTH, // "shadow_target_width" + + FXAA_TC_SCALE, // "tc_scale" + FXAA_RCP_SCREEN_RES, // "rcp_screen_res" + FXAA_RCP_FRAME_OPT, // "rcp_frame_opt" + FXAA_RCP_FRAME_OPT2, // "rcp_frame_opt2" + + DOF_FOCAL_DISTANCE, // "focal_distance" + DOF_BLUR_CONSTANT, // "blur_constant" + DOF_TAN_PIXEL_ANGLE, // "tan_pixel_angle" + DOF_MAGNIFICATION, // "magnification" + DOF_MAX_COF, // "max_cof" + DOF_RES_SCALE, // "res_scale" + DOF_WIDTH, // "dof_width" + DOF_HEIGHT, // "dof_height" + + DEFERRED_DEPTH, // "depthMap" + DEFERRED_SHADOW0, // "shadowMap0" + DEFERRED_SHADOW1, // "shadowMap1" + DEFERRED_SHADOW2, // "shadowMap2" + DEFERRED_SHADOW3, // "shadowMap3" + DEFERRED_SHADOW4, // "shadowMap4" + DEFERRED_SHADOW5, // "shadowMap5" + DEFERRED_NORMAL, // "normalMap" + DEFERRED_POSITION, // "positionMap" + DEFERRED_DIFFUSE, // "diffuseRect" + DEFERRED_SPECULAR, // "specularRect" + DEFERRED_NOISE, // "noiseMap" + DEFERRED_LIGHTFUNC, // "lightFunc" + DEFERRED_LIGHT, // "lightMap" + DEFERRED_BLOOM, // "bloomMap" + DEFERRED_PROJECTION, // "projectionMap" + DEFERRED_NORM_MATRIX, // "norm_mat" + TEXTURE_GAMMA, // "texture_gamma" + SPECULAR_COLOR, // "specular_color" + ENVIRONMENT_INTENSITY, // "env_intensity" + + AVATAR_MATRIX, // "matrixPalette" + AVATAR_TRANSLATION, // "translationPalette" + + WATER_SCREENTEX, // "screenTex" + WATER_SCREENDEPTH, // "screenDepth" + WATER_REFTEX, // "refTex" + WATER_EYEVEC, // "eyeVec" + WATER_TIME, // "time" + WATER_WAVE_DIR1, // "waveDir1" + WATER_WAVE_DIR2, // "waveDir2" + WATER_LIGHT_DIR, // "lightDir" + WATER_SPECULAR, // "specular" + WATER_SPECULAR_EXP, // "lightExp" + WATER_FOGCOLOR, // "waterFogColor" + WATER_FOGDENSITY, // "waterFogDensity" + WATER_FOGKS, // "waterFogKS" + WATER_REFSCALE, // "refScale" + WATER_WATERHEIGHT, // "waterHeight" + WATER_WATERPLANE, // "waterPlane" + WATER_NORM_SCALE, // "normScale" + WATER_FRESNEL_SCALE, // "fresnelScale" + WATER_FRESNEL_OFFSET, // "fresnelOffset" + WATER_BLUR_MULTIPLIER, // "blurMultiplier" + WATER_SUN_ANGLE, // "sunAngle" + WATER_SCALED_ANGLE, // "scaledAngle" + WATER_SUN_ANGLE2, // "sunAngle2" + + WL_CAMPOSLOCAL, // "camPosLocal" + + AVATAR_WIND, // "gWindDir" + AVATAR_SINWAVE, // "gSinWaveParams" + AVATAR_GRAVITY, // "gGravity" + + TERRAIN_DETAIL0, // "detail_0" + TERRAIN_DETAIL1, // "detail_1" + TERRAIN_DETAIL2, // "detail_2" + TERRAIN_DETAIL3, // "detail_3" + TERRAIN_ALPHARAMP, // "alpha_ramp" + + SHINY_ORIGIN, // "origin" + DISPLAY_GAMMA, // "display_gamma" + + INSCATTER_RT, // "inscatter" + SUN_SIZE, // "sun_size" + FOG_COLOR, // "fog_color" // precomputed textures - TRANSMITTANCE_TEX, - SCATTER_TEX, - SINGLE_MIE_SCATTER_TEX, - ILLUMINANCE_TEX, - BLEND_FACTOR, - - NO_ATMO, - MOISTURE_LEVEL, - DROPLET_RADIUS, - ICE_LEVEL, - RAINBOW_MAP, - HALO_MAP, - - MOON_BRIGHTNESS, - - CLOUD_VARIANCE, - - SH_INPUT_L1R, - SH_INPUT_L1G, - SH_INPUT_L1B, - - SUN_MOON_GLOW_FACTOR, - WATER_EDGE_FACTOR, - SUN_UP_FACTOR, - MOONLIGHT_COLOR, - END_RESERVED_UNIFORMS - } eGLSLReservedUniforms; + TRANSMITTANCE_TEX, // "transmittance_texture" + SCATTER_TEX, // "scattering_texture" + SINGLE_MIE_SCATTER_TEX, // "single_mie_scattering_texture" + ILLUMINANCE_TEX, // "irradiance_texture" + BLEND_FACTOR, // "blend_factor" + + NO_ATMO, // "no_atmo" + MOISTURE_LEVEL, // "moisture_level" + DROPLET_RADIUS, // "droplet_radius" + ICE_LEVEL, // "ice_level" + RAINBOW_MAP, // "rainbow_map" + HALO_MAP, // "halo_map" + + MOON_BRIGHTNESS, // "moon_brightness" + + CLOUD_VARIANCE, // "cloud_variance" + + SH_INPUT_L1R, // "sh_input_r" + SH_INPUT_L1G, // "sh_input_g" + SH_INPUT_L1B, // "sh_input_b" + + SUN_MOON_GLOW_FACTOR, // "sun_moon_glow_factor" + WATER_EDGE_FACTOR, // "water_edge" + SUN_UP_FACTOR, // "sun_up_factor" + MOONLIGHT_COLOR, // "moonlight_color" + END_RESERVED_UNIFORMS + } eGLSLReservedUniforms; + // clang-format on // singleton pattern implementation static LLShaderMgr * instance(); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 9867bd16d6..dbe1a3687f 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -155,9 +155,8 @@ public: //get the size of a buffer with the given typemask and vertex count //fill offsets with the offset of each vertex component array into the buffer // indexed by the following enum - static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices); + 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 @@ -165,24 +164,28 @@ public: // 4 - modify LLVertexBuffer::setupClientArray // 5 - modify LLViewerShaderMgr::mReservedAttribs // 6 - update LLVertexBuffer::setupVertexArray - enum { - TYPE_VERTEX = 0, - TYPE_NORMAL, - TYPE_TEXCOORD0, - TYPE_TEXCOORD1, - TYPE_TEXCOORD2, - TYPE_TEXCOORD3, - TYPE_COLOR, - TYPE_EMISSIVE, - TYPE_TANGENT, - TYPE_WEIGHT, - TYPE_WEIGHT4, - TYPE_CLOTHWEIGHT, - TYPE_TEXTURE_INDEX, - TYPE_MAX, // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer - TYPE_INDEX, // TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer - }; - enum { + + // clang-format off + enum { // Shader attribute name, set in LLShaderMgr::initAttribsAndUniforms() + TYPE_VERTEX = 0, // "position" + TYPE_NORMAL, // "normal" + TYPE_TEXCOORD0, // "texcoord0" + TYPE_TEXCOORD1, // "texcoord1" + TYPE_TEXCOORD2, // "texcoord2" + TYPE_TEXCOORD3, // "texcoord3" + TYPE_COLOR, // "diffuse_color" + TYPE_EMISSIVE, // "emissive" + TYPE_TANGENT, // "tangent" + TYPE_WEIGHT, // "weight" + TYPE_WEIGHT4, // "weight4" + TYPE_CLOTHWEIGHT, // "clothing" + TYPE_TEXTURE_INDEX, // "texture_index" + TYPE_MAX, // TYPE_MAX is the size/boundary marker for attributes that go in the vertex buffer + TYPE_INDEX, // TYPE_INDEX is beyond _MAX because it lives in a separate (index) buffer + }; + // clang-format on + + enum { MAP_VERTEX = (1< Date: Tue, 9 Feb 2021 16:36:50 -0700 Subject: DRTVWR-525 housekeeping: delete unused shader file --- .../shaders/class3/deferred/lightUtil.glsl | 117 --------------------- 1 file changed, 117 deletions(-) delete mode 100644 indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl deleted file mode 100644 index 8bb3f07fc6..0000000000 --- a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file lightInfo.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$ - */ - -struct DirectionalLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedLightDirection; - vec3 normalizedToLight; - float lightIntensity; - vec3 lightDiffuseColor; - float specExponent; - float shadow; -}; - -struct SpotLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedLightDirection; - vec3 normalizedToLight; - float lightIntensity; - float attenuation; - float distanceToLight; - vec3 lightDiffuseColor; - float innerHalfAngleCos; - float outerHalfAngleCos; - float spotExponent; - float specExponent; - float shadow; -}; - -struct PointLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedToLight; - float lightIntensity; - float attenuation; - float distanceToLight; - vec3 lightDiffuseColor; - float lightRadius; - float specExponent; - vec3 worldspaceLightDirection; - float shadow; -}; - -float attenuate(float attenuationSelection, float distanceToLight) -{ -// LLRENDER_REVIEW -// sh/could eventually consume attenuation func defined in texture - return (attenuationSelection == 0.0f) ? 1.0f : // none - (attenuationSelection < 1.0f) ? (1.0f / distanceToLight) : // linear atten - (attenuationSelection < 2.0f) ? (1.0f / (distanceToLight*distanceToLight)) // quadratic atten - : (1.0f / (distanceToLight*distanceToLight*distanceToLight)); // cubic atten -} - - -vec3 lightDirectional(struct DirectionalLightInfo dli) -{ - float lightIntensity = dli.lightIntensity; - lightIntensity *= dot(dli.normal.xyz, dli.normalizedLightDirection); - //lightIntensity *= directionalShadowSample(vec4(dli.pos.xyz, 1.0f), dli.depth, dli.directionalShadowMap, dli.directionalShadowMatrix); - return lightIntensity * dli.lightDiffuseColor; -} - - -vec3 lightSpot(struct SpotLightInfo sli) -{ - float penumbraRange = (sli.outerHalfAngleCos - sli.innerHalfAngleCos); - float coneAngleCos = max(dot(sli.normalizedLightDirection, sli.normalizedToLight), 0.0); - float coneAttenFactor = (coneAngleCos <= sli.outerHalfAngleCos) ? 1.0f : pow(smoothstep(1,0, sli.outerHalfAngleCos / penumbraRange), sli.spotExponent); - float distanceAttenuation = attenuate(sli.attenuation, sli.distanceToLight); - float lightIntensity = sli.lightIntensity; - lightIntensity *= distanceAttenuation; - lightIntensity *= max(dot(sli.normal.xyz, sli.normalizedLightDirection), 0.0); - lightIntensity *= coneAttenFactor; - lightIntensity *= sli.shadow; - return lightIntensity * sli.lightDiffuseColor; -} - -vec3 lightPoint(struct PointLightInfo pli) -{ - float padRadius = pli.lightRadius * 0.1; // distance for which to perform smoothed dropoff past light radius - float distanceAttenuation = attenuate(pli.attenuation, pli.distanceToLight); - float lightIntensity = pli.lightIntensity; - lightIntensity*= distanceAttenuation; - lightIntensity *= clamp((padRadius - pli.distanceToLight + pli.lightRadius) / padRadius, 0.0, 1.0); - lightIntensity *= pli.shadow; - lightIntensity *= max(dot(pli.normal.xyz, pli.normalizedToLight), 0.0); - return lightIntensity * pli.lightDiffuseColor; -} -- cgit v1.2.3 From 3c002e7db56c214267177c040704484d0a489581 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 10 Mar 2021 18:04:22 +0200 Subject: SL-14975 SL-14384 viewer crashes because of large chat groups 1. Due to desync participant can be NULL - added NULL checks 2. With large backlog of events, closing and then opening a goup session was causing a crash due to obsolete events - added cleanup for backlog 3. In some cases events were accumulating faster than they were processed - ensured that after certain point event processing scales up with a backlog --- indra/newview/llconversationmodel.cpp | 4 +- indra/newview/llconversationview.cpp | 11 ++++-- indra/newview/llfloaterimcontainer.cpp | 69 ++++++++++++++++++++++++++------- indra/newview/llfloaterimcontainer.h | 5 ++- indra/newview/llfloaterimsessiontab.cpp | 5 ++- 5 files changed, 70 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 4aa74a550c..27b1f3d20a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -355,7 +355,7 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const for (iter = mChildren.begin(); iter != mChildren.end(); iter++) { participant = dynamic_cast(*iter); - if (participant->hasSameValue(participant_id)) + if (participant && participant->hasSameValue(participant_id)) { break; } @@ -466,7 +466,7 @@ const bool LLConversationItemSession::getTime(F64& time) const { participant = dynamic_cast(*iter); F64 participant_time; - if (participant->getTime(participant_time)) + if (participant && participant->getTime(participant_time)) { has_time = true; most_recent_time = llmax(most_recent_time,participant_time); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 093e772abe..7c1db98b3f 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -617,10 +617,13 @@ void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data LLConversationItemParticipant* participant_model = dynamic_cast(getViewModelItem()); - participant_model->resetRefresh(); - - // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat - mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); + if (participant_model) + { + participant_model->resetRefresh(); + + // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat + mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); + } // Do the regular upstream refresh LLFolderViewItem::refresh(); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index c6e9069d09..007c0d3b22 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -59,7 +59,9 @@ #include "boost/foreach.hpp" -const S32 EVENTS_PER_IDLE_LOOP = 100; +const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80; +const S32 EVENTS_PER_IDLE_LOOP_BACKGROUND = 40; +const F32 EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE = 0.01f; // process a minimum of 1% of total events per frame // // LLFloaterIMContainer @@ -416,8 +418,11 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); - // Get the avatar name for this participant id from the cache and update the model - participant_model->updateName(); + if (participant_model) + { + // Get the avatar name for this participant id from the cache and update the model + participant_model->updateName(); + } // Next participant current_participant_model++; } @@ -464,8 +469,11 @@ void LLFloaterIMContainer::idleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); - participant_model->setModeratorOptionsVisible(is_moderator); - participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); + if (participant_model) + { + participant_model->setModeratorOptionsVisible(is_moderator); + participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); + } current_participant_model++; } @@ -498,20 +506,49 @@ void LLFloaterIMContainer::idleUpdate() void LLFloaterIMContainer::idleProcessEvents() { - if (!mConversationEventQueue.empty()) - { - S32 events_to_handle = llmin((S32)mConversationEventQueue.size(), EVENTS_PER_IDLE_LOOP); - for (S32 i = 0; i < events_to_handle; i++) - { - handleConversationModelEvent(mConversationEventQueue.back()); - mConversationEventQueue.pop_back(); - } - } + LLUUID current_session_id = getSelectedSession(); + conversations_items_deque::iterator iter = mConversationEventQueue.begin(); + conversations_items_deque::iterator end = mConversationEventQueue.end(); + while (iter != end) + { + std::deque &events = iter->second; + if (!events.empty()) + { + S32 events_to_handle; + S32 query_size = (S32)events.size(); + if (current_session_id == iter->first) + { + events_to_handle = EVENTS_PER_IDLE_LOOP_CURRENT_SESSION; + } + else + { + events_to_handle = EVENTS_PER_IDLE_LOOP_BACKGROUND; + } + + if (events_to_handle <= query_size) + { + // Some groups can be very large and can generate huge amount of updates, scale processing up to keep up + events_to_handle = llmax(events_to_handle, (S32)(query_size * EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE)); + } + else + { + events_to_handle = query_size; + } + + for (S32 i = 0; i < events_to_handle; i++) + { + handleConversationModelEvent(events.back()); + events.pop_back(); + } + } + iter++; + } } bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event) { - mConversationEventQueue.push_front(event); + LLUUID id = event.get("session_uuid").asUUID(); + mConversationEventQueue[id].push_front(event); return true; } @@ -1822,6 +1859,8 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c // Suppress the conversation items and widgets from their respective maps mConversationsItems.erase(uuid); mConversationsWidgets.erase(uuid); + // Clear event query (otherwise reopening session in some way can bombard session with stale data) + mConversationEventQueue.erase(uuid); // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 468b47f1f1..b4a9d377ab 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -229,9 +229,10 @@ private: conversations_widgets_map mConversationsWidgets; LLConversationViewModel mConversationViewModel; LLFolderView* mConversationsRoot; - LLEventStream mConversationsEventStream; + LLEventStream mConversationsEventStream; - std::deque mConversationEventQueue; + typedef std::map > conversations_items_deque; + conversations_items_deque mConversationEventQueue; LLTimer mParticipantRefreshTimer; }; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d604d0a789..80165f9b9a 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -492,7 +492,10 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() while (current_participant_model != end_participant_model) { LLConversationItem* participant_model = dynamic_cast(*current_participant_model); - addConversationViewParticipant(participant_model); + if (participant_model) + { + addConversationViewParticipant(participant_model); + } current_participant_model++; } } -- cgit v1.2.3 From 247a3362b8d35541993007a33693186def7f23b0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 22 Mar 2021 23:45:25 +0200 Subject: SL-14993 Crash accessing mInvBindMatrix --- indra/llprimitive/llmodel.cpp | 30 +++++++++++++++++++----------- indra/newview/llskinningutil.cpp | 34 +++------------------------------- indra/newview/llskinningutil.h | 1 - 3 files changed, 22 insertions(+), 43 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index a2d9b4cd9b..702a1b5238 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -434,7 +434,7 @@ void LLModel::generateNormals(F32 angle_cutoff) if (vol_face.mNumIndices > 65535) { - LL_WARNS() << "Too many vertices for normal generation to work." << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Too many vertices for normal generation to work." << LL_ENDL; continue; } @@ -1100,7 +1100,7 @@ bool LLModel::loadModel(std::istream& is) { if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024)) { - LL_WARNS() << "Mesh header parse error. Not a valid mesh asset!" << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Mesh header parse error. Not a valid mesh asset!" << LL_ENDL; return false; } } @@ -1132,7 +1132,7 @@ bool LLModel::loadModel(std::istream& is) if (header[lod_name[lod]]["offset"].asInteger() == -1 || header[lod_name[lod]]["size"].asInteger() == 0 ) { //cannot load requested LOD - LL_WARNS() << "LoD data is invalid!" << LL_ENDL; + LL_WARNS("MESHSKININFO") << "LoD data is invalid!" << LL_ENDL; return false; } @@ -1195,7 +1195,7 @@ bool LLModel::loadModel(std::istream& is) } else { - LL_WARNS() << "unpackVolumeFaces failed!" << LL_ENDL; + LL_WARNS("MESHSKININFO") << "unpackVolumeFaces failed!" << LL_ENDL; } return false; @@ -1223,7 +1223,7 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) if (!foundRef) { - LL_INFOS() << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL; + LL_INFOS("MESHSKININFO") << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL; return false; } } @@ -1259,7 +1259,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn bool isASubset = isMaterialListSubset( ref ); if ( !isASubset ) { - LL_INFOS()<<"Material of model is not a subset of reference."<= face.mNumVertices) { - LL_WARNS() << "Face has invalid index." << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Face has invalid index." << LL_ENDL; return false; } } if (face.mNumIndices % 3 != 0 || face.mNumIndices == 0) { - LL_WARNS() << "Face has invalid number of indices." << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Face has invalid number of indices." << LL_ENDL; return false; } @@ -1879,7 +1887,7 @@ bool validate_model(const LLModel* mdl) { if (mdl->getNumVolumeFaces() == 0) { - LL_WARNS() << "Model has no faces!" << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Model has no faces!" << LL_ENDL; return false; } @@ -1887,13 +1895,13 @@ bool validate_model(const LLModel* mdl) { if (mdl->getVolumeFace(i).mNumVertices == 0) { - LL_WARNS() << "Face has no vertices." << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Face has no vertices." << LL_ENDL; return false; } if (mdl->getVolumeFace(i).mNumIndices == 0) { - LL_WARNS() << "Face has no indices." << LL_ENDL; + LL_WARNS("MESHSKININFO") << "Face has no indices." << LL_ENDL; return false; } diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 1fb63c7444..f325315933 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -309,7 +309,8 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a if (vol_face.mJointRiggingInfoTab.needsUpdate()) { S32 num_verts = vol_face.mNumVertices; - if (num_verts>0 && vol_face.mWeights && (skin->mJointNames.size()>0)) + S32 num_joints = skin->mJointNames.size(); + if (num_verts > 0 && vol_face.mWeights && num_joints > 0) { initJointNums(const_cast(skin), avatar); if (vol_face.mJointRiggingInfoTab.size()==0) @@ -343,7 +344,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a for (U32 k=0; k<4; ++k) { S32 joint_index = idx[k]; - if (wght[k] > 0.0f) + if (wght[k] > 0.0f && num_joints > joint_index) { S32 joint_num = skin->mJointNums[joint_index]; if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS) @@ -394,35 +395,6 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a } } -void LLSkinningUtil::updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab) -{ - LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO); - for (S32 i=0; i < num_verts; i++) - { - LLVector4a& pos = positions[i]; - LLVector4a& wght = weights[i]; - for (U32 k=0; k<4; ++k) - { - S32 joint_num = skin->mJointNums[joint_indices[k]]; - llassert(joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS); - { - rig_info_tab[joint_num].setIsRiggedTo(true); - LLMatrix4a bind_shape; - bind_shape.loadu(skin->mBindShapeMatrix); - LLMatrix4a inv_bind; - inv_bind.loadu(skin->mInvBindMatrix[joint_indices[k]]); - LLMatrix4a mat; - matMul(bind_shape, inv_bind, mat); - LLVector4a pos_joint_space; - mat.affineTransform(pos, pos_joint_space); - pos_joint_space.mul(wght[k]); - LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents(); - update_min_max(extents[0], extents[1], pos_joint_space); - } - } - } -} - // This is used for extracting rotation from a bind shape matrix that // already has scales baked in LLQuaternion LLSkinningUtil::getUnscaledQuaternion(const LLMatrix4& mat4) diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h index 549aa6a29f..efe7c85997 100644 --- a/indra/newview/llskinningutil.h +++ b/indra/newview/llskinningutil.h @@ -67,7 +67,6 @@ namespace LLSkinningUtil void initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar); void updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face); - void updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab); LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4); }; -- cgit v1.2.3 From 022ff9819336a9beab744f2d25baa51a249e998e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 30 Mar 2021 22:42:40 +0300 Subject: SL-14990 ig75icd64 and other intel crashes Obsolete driver detection --- indra/newview/llappviewer.cpp | 40 ++++++++++++++++++++++ .../newview/skins/default/xui/en/notifications.xml | 6 ++++ 2 files changed, 46 insertions(+) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 297925d0f0..ef3759905b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1115,6 +1115,46 @@ bool LLAppViewer::init() } } +#if LL_WINDOWS && ADDRESS_SIZE == 64 + if (gGLManager.mIsIntel) + { + // Check intel driver's version + // Ex: "3.1.0 - Build 8.15.10.2559"; + std::string version = ll_safe_string((const char *)glGetString(GL_VERSION)); + + const boost::regex is_intel_string("[0-9].[0-9].[0-9] - Build [0-9]{1,2}.[0-9]{2}.[0-9]{2}.[0-9]{4}"); + + if (boost::regex_search(version, is_intel_string)) + { + // Valid string, extract driver version + std::size_t found = version.find("Build "); + std::string driver = version.substr(found + 6); + S32 v1, v2, v3, v4; + S32 count = sscanf(driver.c_str(), "%d.%d.%d.%d", &v1, &v2, &v3, &v4); + if (count > 0 && v1 <= 10) + { + LL_INFOS("AppInit") << "Detected obsolete intel driver: " << driver << LL_ENDL; + LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedIntelDriver"); + std::string gpu_name = ll_safe_string((const char *)glGetString(GL_RENDERER)); + details.setArg("[VERSION]", driver); + details.setArg("[GPUNAME]", gpu_name); + S32 button = OSMessageBox(details.getString(), + LLStringUtil::null, + OSMB_YESNO); + if (OSBTN_YES == button && gViewerWindow) + { + std::string url = LLWeb::escapeURL(LLTrans::getString("IntelDriverPage")); + if (gViewerWindow->getWindow()) + { + gViewerWindow->getWindow()->spawnWebBrowser(url, false); + } + } + } + } + } +#endif + + // Obsolete? mExpectedGLVersion is always zero #if LL_WINDOWS if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion()) { diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 2f4da4f9b7..cac41dac2f 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -9580,6 +9580,12 @@ You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_ If you continue to have problems, please visit the [SUPPORT_SITE]. + +The installed Intel graphics driver for [GPUNAME], version [VERSION], is significantly out of date and is known to cause excessive rates of program crashes. You are strongly advised to update to a current Intel driver + +Do you want to check the Intel driver website? + + 796 -- cgit v1.2.3 From d357bf7ae5c5e0b6e66e7d82ce1677360b4cb990 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 1 Apr 2021 17:36:26 +0300 Subject: SL-14990 Turn on shader init logging after crash --- indra/llrender/llglslshader.cpp | 10 ++++++- indra/llrender/llshadermgr.cpp | 60 +++++++++++++++++------------------------ 2 files changed, 33 insertions(+), 37 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 74cfa60b27..4351f6e2c8 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -396,10 +396,18 @@ BOOL LLGLSLShader::createShader(std::vector * attributes, mLightHash = 0xFFFFFFFF; llassert_always(!mShaderFiles.empty()); - BOOL success = TRUE; // Create program mProgramObject = glCreateProgramObjectARB(); + if (mProgramObject == 0) + { + // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist. + LL_SHADER_LOADING_WARNS() << "Failed to create handle for shader: " << mName << LL_ENDL; + unloadInternal(); + return FALSE; + } + + BOOL success = TRUE; #if LL_DARWIN // work-around missing mix(vec3,vec3,bvec3) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 236ebbd78f..e8c6295930 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -611,13 +611,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade #endif GLenum error = GL_NO_ERROR; - if (gDebugGL) + + error = glGetError(); + if (error != GL_NO_ERROR) { - error = glGetError(); - if (error != GL_NO_ERROR) - { - LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << LL_ENDL; - } + LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << " for file: " << filename << LL_ENDL; } if (filename.empty()) @@ -966,55 +964,45 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //create shader object GLhandleARB ret = glCreateShaderObjectARB(type); - if (gDebugGL) + + error = glGetError(); + if (error != GL_NO_ERROR) { - error = glGetError(); - if (error != GL_NO_ERROR) - { - LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL; - } + LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL; } - + //load source glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL); - if (gDebugGL) + error = glGetError(); + if (error != GL_NO_ERROR) { - error = glGetError(); - if (error != GL_NO_ERROR) - { - LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL; - } + LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL; } //compile source glCompileShaderARB(ret); - if (gDebugGL) + error = glGetError(); + if (error != GL_NO_ERROR) { - error = glGetError(); - if (error != GL_NO_ERROR) - { - LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL; - } + LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL; } - + if (error == GL_NO_ERROR) { //check for errors GLint success = GL_TRUE; glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); - if (gDebugGL || success == GL_FALSE) + + error = glGetError(); + if (error != GL_NO_ERROR || success == GL_FALSE) { - error = glGetError(); - if (error != GL_NO_ERROR || success == GL_FALSE) - { - //an error occured, print log - LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; - dumpObjectLog(ret, TRUE, open_file_name); - dumpShaderSource(shader_code_count, shader_code_text); - ret = 0; - } + //an error occured, print log + LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; + dumpObjectLog(ret, TRUE, open_file_name); + dumpShaderSource(shader_code_count, shader_code_text); + ret = 0; } } else -- cgit v1.2.3 From b58c15b1bd77ea2f5fa5b00bf870d04f93772651 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 16 Apr 2021 15:28:00 -0700 Subject: SL-15096: Merge SovereignEngineer's fix for SL-14035 regression --- indra/newview/llvosky.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 2037aca7e9..878d7287ed 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -209,14 +209,7 @@ void LLSkyTex::create() void LLSkyTex::createGLImage(S32 which) { - if (mIsShiny) - { - mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); - } - else - { - mTexture[which]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA); - } + mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL); mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP); } -- cgit v1.2.3 From 272da688f75880f73e227ae62bad1c5a9b28b288 Mon Sep 17 00:00:00 2001 From: Euclid Linden Date: Thu, 29 Apr 2021 21:29:54 +0000 Subject: Force a clean, full rebuild --- indra/edit-me-to-trigger-new-build.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index 0cad6370a9..5366987cff 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1,2 +1,3 @@ euclid 5/29/2020 euclid 7/23/2020 +euclid 4/29/2021 \ No newline at end of file -- cgit v1.2.3 From 7199ce45142f47003ba04381a76c1a4c7545f127 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 26 May 2021 10:57:39 -0600 Subject: SL-15299 SL-15313 BUG-230802 Revert BOM fix causing issues with avatar alpha masks. Revert "SL-12069 Issues with bakes-on-mesh and alpha modes" This reverts commit 5691d302ef876a7e6fb6861441f14e5e7f0c7735. --- indra/llprimitive/llmaterial.cpp | 40 +----- indra/llprimitive/llmaterial.h | 11 -- indra/newview/lldrawpoolavatar.cpp | 4 +- indra/newview/llface.cpp | 4 +- indra/newview/llviewerobject.cpp | 191 +++------------------------- indra/newview/llviewerobject.h | 24 +--- indra/newview/llvovolume.cpp | 254 +++++++++++++++++++++++++++++++++++-- indra/newview/llvovolume.h | 20 +++ indra/newview/pipeline.cpp | 2 +- 9 files changed, 291 insertions(+), 259 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index a1bfc4edd9..a219ac1450 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -28,8 +28,6 @@ #include "llmaterial.h" -#include "../llrender/llglheaders.h" - /** * Materials cap parameters */ @@ -107,8 +105,6 @@ LLMaterial::LLMaterial() , mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT) , mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY) , mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) - , mDiffuseFormatPrimary(GL_RGBA) - , mDiffuseBaked(false) , mAlphaMaskCutoff(0) { } @@ -315,20 +311,6 @@ void LLMaterial::setEnvironmentIntensity(U8 intensity) mEnvironmentIntensity = intensity; } -U8 LLMaterial::getDiffuseAlphaModeRender() const -{ - if (mDiffuseBaked - || mDiffuseFormatPrimary == GL_RGBA - || mDiffuseFormatPrimary == GL_ALPHA) - { - return mDiffuseAlphaMode; - } - else - { - return DIFFUSE_ALPHA_MODE_NONE; - } -} - U8 LLMaterial::getDiffuseAlphaMode() const { return mDiffuseAlphaMode; @@ -339,26 +321,6 @@ void LLMaterial::setDiffuseAlphaMode(U8 alpha_mode) mDiffuseAlphaMode = alpha_mode; } -U32 LLMaterial::getDiffuseFormatPrimary() const -{ - return mDiffuseFormatPrimary; -} - -void LLMaterial::setDiffuseFormatPrimary(U32 format_primary) -{ - mDiffuseFormatPrimary = format_primary; -} - -bool LLMaterial::getIsDiffuseBaked() const -{ - return mDiffuseBaked; -} - -void LLMaterial::setDiffuseBaked(bool baked) -{ - mDiffuseBaked = baked; -} - U8 LLMaterial::getAlphaMaskCutoff() const { return mAlphaMaskCutoff; @@ -475,7 +437,7 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode) } else { - ret = getDiffuseAlphaModeRender(); + ret = getDiffuseAlphaMode(); } llassert(ret < SHADER_COUNT); diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 1207917568..d58b7ee812 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -115,17 +115,8 @@ public: void setSpecularLightExponent(U8 exponent); U8 getEnvironmentIntensity() const; void setEnvironmentIntensity(U8 intensity); - - // getDiffuseAlphaModeRender takes into account if image supports alpha - // and returns value apropriate for render - // getDiffuseAlphaMode() returns value as is - U8 getDiffuseAlphaModeRender() const; U8 getDiffuseAlphaMode() const; void setDiffuseAlphaMode(U8 alpha_mode); - U32 getDiffuseFormatPrimary() const; - void setDiffuseFormatPrimary(U32 format_primary); - bool getIsDiffuseBaked() const; - void setDiffuseBaked(bool baked); U8 getAlphaMaskCutoff() const; void setAlphaMaskCutoff(U8 cutoff); @@ -156,8 +147,6 @@ protected: U8 mSpecularLightExponent; U8 mEnvironmentIntensity; U8 mDiffuseAlphaMode; - U32 mDiffuseFormatPrimary; // value from texture, LLGLenum, is not included in fromLLSD/asLLSD - bool mDiffuseBaked; // is not included in fromLLSD/asLLSD U8 mAlphaMaskCutoff; }; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 55b3864b6d..687b13d2c8 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -2129,7 +2129,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (mat) { - switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaModeRender())) + switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaMode())) { case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: { @@ -2267,7 +2267,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec); sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env); - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { F32 cutoff = mat->getAlphaMaskCutoff()/255.f; sVertexProgram->setMinimumAlpha(cutoff); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 01d8b6775b..4a802ad9aa 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1165,7 +1165,7 @@ bool LLFace::canRenderAsMask() } LLMaterial* mat = te->getMaterialParams(); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) { return false; } @@ -1412,7 +1412,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { - if (!mat || mat->getDiffuseAlphaModeRender() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { shiny_in_alpha = true; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 395dd0495f..b88baf6aa7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4880,78 +4880,22 @@ void LLViewerObject::refreshBakeTexture() } } -void LLViewerObject::updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture) -{ - // Objects getting non-alpha texture and alpha mask can result in graphical bugs, like white or red alphas. - // To resolve the issue this function provides image format to material and based on format material's - // getDiffuseAlphaModeRender() function will decide what value to provide to render - // - // Unfortunately LLMaterial has no access to diffuse image, so we have to set this data in LLViewerObject - // regardles of object being used/seen or frequency of image-updates. - mat->setDiffuseBaked(baked_texture); - - if (!baked_texture) - { - if (imagep->isMissingAsset()) - { - mat->setDiffuseFormatPrimary(0); - } - else if (0 == imagep->getPrimaryFormat()) - { - // We don't have information about this texture, wait for it - mWaitingTextureInfo.insert(uuid_material_mmap_t::value_type(imagep->getID(), material_info(LLRender::DIFFUSE_MAP, te))); - // Temporary assume RGBA image - mat->setDiffuseFormatPrimary(GL_RGBA); - } - else - { - mat->setDiffuseFormatPrimary(imagep->getPrimaryFormat()); - } - } -} - -S32 LLViewerObject::setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep) -{ - LLUUID new_id = imagep->getID(); - S32 retval = LLPrimitive::setTETexture(te, new_id); - - LLTextureEntry* tep = getTE(te); - LLUUID old_image_id = tep->getID(); - - LLViewerTexture* baked_texture = getBakedTextureForMagicId(new_id); - mTEImages[te] = baked_texture ? baked_texture : imagep; - updateAvatarMeshVisibility(new_id, old_image_id); - - LLMaterial* mat = tep->getMaterialParams(); - if (mat) - { - // Don't update format from texture (and don't shedule one) if material has no alpha mode set, - // just assume RGBA format, format will get updated with setTEMaterialParams call if mode changes - if (mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - bool baked = baked_texture != NULL; - updateDiffuseMatParams(te, mat, imagep, baked); - } - else - { - mat->setDiffuseFormatPrimary(GL_RGBA); - } - } - - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - - return retval; -} - void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { if (mTEImages[te] != imagep) { - setDiffuseImageAndParams(te, imagep); + LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null; + + LLPrimitive::setTETexture(te, imagep->getID()); + + LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); + mTEImages[te] = baked_texture ? baked_texture : imagep; + updateAvatarMeshVisibility(imagep->getID(), old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } } @@ -4963,7 +4907,15 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { - retval = setDiffuseImageAndParams(te, image); + retval = LLPrimitive::setTETexture(te, uuid); + LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); + mTEImages[te] = baked_texture ? baked_texture : image; + updateAvatarMeshVisibility(uuid,old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } return retval; } @@ -5258,29 +5210,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return 0; } - if (pMaterialParams.notNull() - && pMaterialParams->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - // Don't update if no alpha is set. If alpha changes, this function will run again, - // no point in sheduling additional texture callbacks (in updateDiffuseMatParams) - LLTextureEntry* tex_entry = getTE(te); - bool is_baked = tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()); - - LLViewerTexture *img_diffuse = getTEImage(te); - llassert(NULL != img_diffuse); - - if (NULL != img_diffuse) - { - // Will modify alpha mask provided to renderer to fit image - updateDiffuseMatParams(te, pMaterialParams.get(), img_diffuse, is_baked); - } - else - { - LLMaterial *mat = pMaterialParams.get(); // to avoid const - mat->setDiffuseFormatPrimary(0); - } - } - retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); LL_DEBUGS("Material") << "Changing material params for te " << (S32)te << ", object " << mID @@ -5293,84 +5222,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return retval; } -bool LLViewerObject::notifyAboutCreatingTexture(LLViewerTexture *texture) -{ - // Confirmation about texture creation, check wait-list - // and make changes, or return false - - std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); - - bool refresh_materials = false; - - // RGB textures without alpha channels won't work right with alpha, - // we provide format to material for material to decide when to drop alpha - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - U32 format = texture->getPrimaryFormat(); - if (format != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(format); - refresh_materials = true; - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - -bool LLViewerObject::notifyAboutMissingAsset(LLViewerTexture *texture) -{ - // When waiting information about texture it turned out to be missing. - // Confirm the state, update values accordingly - std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); - if (range.first == range.second) return false; - - bool refresh_materials = false; - - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.isNull()) - continue; - - if (range_it->second.map == LLRender::DIFFUSE_MAP) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - if (0 != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(0); - refresh_materials = true; - } - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - void LLViewerObject::refreshMaterials() { setChanged(TEXTURE); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 9444c4f788..250c4ac328 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -768,12 +768,7 @@ protected: void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy); void deleteParticleSource(); void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id); - - // Helper function to modify alpha mask provided to render according to image (ex: RGB image will drop alpha mask) - void updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture); - // Shared part of code from setTEImage and setTETextureCore - S32 setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep); - + private: void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string void deleteTEImages(); // correctly deletes list of images @@ -906,27 +901,10 @@ public: LLJointRiggingInfoTab mJointRiggingInfoTab; - bool notifyAboutCreatingTexture(LLViewerTexture *texture); - bool notifyAboutMissingAsset(LLViewerTexture *texture); - private: LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory. EObjectUpdateType mLastUpdateType; BOOL mLastUpdateCached; - - struct material_info - { - LLRender::eTexIndex map; - U8 te; - - material_info(LLRender::eTexIndex map_, U8 te_) - : map(map_) - , te(te_) - {} - }; - - typedef std::multimap uuid_material_mmap_t; - uuid_material_mmap_t mWaitingTextureInfo; }; /////////////////// diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 2d1a882a7e..3bdb8a2981 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2295,11 +2295,243 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) return res; } +bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture) +{ //Ok, here we have confirmation about texture creation, check our wait-list + //and make changes, or return false + + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + + //here we just interesting in DIFFUSE_MAP only! + if(NULL != cur_material.get() && LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) + { //ok let's check the diffuse mode + switch(cur_material->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //uups... we have non 32 bit texture with LLMaterial::DIFFUSE_ALPHA_MODE_* => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + } break; + } //switch + } //if + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + +bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) +{ //Ok, here if we wait information about texture and it's missing + //then depending from the texture map (diffuse, normal, or specular) + //make changes in material and confirm it. If not return false. + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + if(range.first == range.second) return false; + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + if (cur_material.isNull()) + continue; + + switch(range_it->second.map) + { + case LLRender::DIFFUSE_MAP: + { + if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode()) + { //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } break; + case LLRender::NORMAL_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setNormalID(LLUUID::null); + } break; + case LLRender::SPECULAR_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setSpecularID(LLUUID::null); + } break; + case LLRender::NUM_TEXTURE_CHANNELS: + //nothing to do, make compiler happy + break; + } //switch + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { - S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LLMaterialPtr pMaterial = const_cast(pMaterialParams); + + if(pMaterialParams) + { //check all of them according to material settings + + LLViewerTexture *img_diffuse = getTEImage(te); + LLViewerTexture *img_normal = getTENormalMap(te); + LLViewerTexture *img_specular = getTESpecularMap(te); + + llassert(NULL != img_diffuse); + + LLMaterialPtr new_material = NULL; + + //diffuse + if(NULL != img_diffuse) + { //guard + if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te))); + } + else + { + bool bSetDiffuseNone = false; + if(img_diffuse->isMissingAsset()) + { + bSetDiffuseNone = true; + } + else + { + switch(pMaterialParams->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //all of them modes available only for 32 bit textures + LLTextureEntry* tex_entry = getTE(te); + bool bIsBakedImageId = false; + if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID())) + { + bIsBakedImageId = true; + } + if (GL_RGBA != img_diffuse->getPrimaryFormat() && !bIsBakedImageId) + { + bSetDiffuseNone = true; + } + } break; + } + } //else + + + if(bSetDiffuseNone) + { //upps... we should substitute this material with LLMaterial::DIFFUSE_ALPHA_MODE_NONE + new_material = new LLMaterial(pMaterialParams->asLLSD()); + new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } + } + + //normal + if(LLUUID::null != pMaterialParams->getNormalID()) + { + if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setNormalID(LLUUID::null); + } + else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te))); + } + + } + + + //specular + if(LLUUID::null != pMaterialParams->getSpecularID()) + { + if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setSpecularID(LLUUID::null); + } + else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te))); + } + } + + if(new_material) { + pMaterial = new_material; + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial); + } + } + + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); @@ -4366,7 +4598,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& LLMaterial* mat = te->getMaterialParams(); if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE @@ -5012,7 +5244,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaModeRender(); + draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); } else @@ -5374,7 +5606,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (mat && LLPipeline::sRenderDeferred) { - U8 alpha_mode = mat->getDiffuseAlphaModeRender(); + U8 alpha_mode = mat->getDiffuseAlphaMode(); bool is_alpha = type == LLDrawPool::POOL_ALPHA && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || @@ -5403,7 +5635,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) else if (mat) { bool is_alpha = type == LLDrawPool::POOL_ALPHA; - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; @@ -6301,7 +6533,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace bool can_be_shiny = true; if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; } @@ -6323,7 +6555,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace // if (te->getFullbright()) { - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { if (opaque) { @@ -6408,7 +6640,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)); @@ -6507,7 +6739,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (fullbright || bake_sunlight) { //fullbright - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); } @@ -6529,7 +6761,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { //material alpha mask can be respected in non-deferred registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK); } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 97888ed869..ce400a3498 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -441,6 +441,26 @@ protected: static S32 sNumLODChanges; friend class LLVolumeImplFlexible; + +public: + bool notifyAboutCreatingTexture(LLViewerTexture *texture); + bool notifyAboutMissingAsset(LLViewerTexture *texture); + +private: + struct material_info + { + LLRender::eTexIndex map; + U8 te; + + material_info(LLRender::eTexIndex map_, U8 te_) + : map(map_) + , te(te_) + {} + }; + + typedef std::multimap mmap_UUID_MAP_t; + mmap_UUID_MAP_t mWaitingTextureInfo; + }; #endif // LL_LLVOVOLUME_H diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d5c98fc908..cd1b9c7c69 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1668,7 +1668,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima if (alpha && mat) { - switch (mat->getDiffuseAlphaModeRender()) + switch (mat->getDiffuseAlphaMode()) { case 1: alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. -- cgit v1.2.3 From 4623b822386accfae5907c88099c2a88377a0271 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 7 Jun 2021 13:48:49 -0400 Subject: Increment viewer version to 6.4.20 following promotion of DRTVWR-525 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 427dc381ad..e786022da5 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.4.19 +6.4.20 -- cgit v1.2.3