diff options
-rw-r--r-- | indra/llcommon/llsdutil.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 1 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 42 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llcommandhandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerstats.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 161 | ||||
-rw-r--r-- | indra/newview/llxmlrpclistener.cpp | 2 |
8 files changed, 244 insertions, 45 deletions
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/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; diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 384e5bf99f..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<LLStaticHashedString> * 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<string,GLenum> >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -485,11 +493,36 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, return success; } -BOOL LLGLSLShader::attachVertexObject(std::string object_path) { +#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; } @@ -506,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; } @@ -522,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 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 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/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 85d87a43af..04172adde9 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,38 @@ 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. + static bool vulkan_oneshot = false; + static bool vulkan_detected = false; + + if (!vulkan_oneshot) + { + 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 + + 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"); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index f64dfcf0d4..0b5ca0b79c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -313,6 +313,99 @@ RecordToChatConsole::RecordToChatConsole(): //////////////////////////////////////////////////////////////////////////// // +// 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. +// 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[] = + { + 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[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 +// 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 +// 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 ; \ +} + +//////////////////////////////////////////////////////////////////////////// +// // LLDebugText // @@ -333,7 +426,11 @@ private: typedef std::vector<Line> 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)); @@ -369,11 +466,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")) @@ -709,33 +817,25 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); - ypos += y_inc; + char camera_lines[8][32]; + memset(camera_lines, ' ', sizeof(camera_lines)); - 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])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); - ypos += y_inc; + // 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; - - 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])); - ypos += y_inc; - - 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])); - ypos += y_inc; + // View last column is always <0,0,0,1> + 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; @@ -877,6 +977,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) { @@ -885,7 +997,6 @@ public: LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } - mLineList.clear(); } }; 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 */ |