From bafe54c1fe5f83552a6be6c10b0f3b6e3ef69859 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 17 Jan 2018 18:46:56 +0200 Subject: MAINT-8183 Additional logging --- indra/llwindow/llwindowwin32.cpp | 24 ++++++++++++++++++++---- indra/newview/llviewerwindow.cpp | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 2ad6f7c8b5..9fa07d1d34 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1101,7 +1101,14 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); - LL_INFOS("Window") << "window is created." << LL_ENDL ; + if (mWindowHandle) + { + LL_INFOS("Window") << "window is created." << LL_ENDL ; + } + else + { + LL_WARNS("Window") << "Window creation failed, code: " << GetLastError() << LL_ENDL; + } //----------------------------------------------------------------------- // Create GL drawing context @@ -1416,7 +1423,16 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); - LL_INFOS("Window") << "recreate window done." << LL_ENDL ; + + if (mWindowHandle) + { + LL_INFOS("Window") << "recreate window done." << LL_ENDL ; + } + else + { + // Note: if value is NULL GetDC retrieves the DC for the entire screen. + LL_WARNS("Window") << "Window recreation failed, code: " << GetLastError() << LL_ENDL; + } if (!(mhDC = GetDC(mWindowHandle))) { @@ -2646,20 +2662,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } case WM_SETFOCUS: - window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS"); if (gDebugWindowProc) { LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL; } + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS"); window_imp->mCallbacks->handleFocus(window_imp); return 0; case WM_KILLFOCUS: - window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS"); if (gDebugWindowProc) { LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL; } + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS"); window_imp->mCallbacks->handleFocusLost(window_imp); return 0; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ca231c164c..74deaffe16 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2268,6 +2268,7 @@ void LLViewerWindow::shutdownGL() LLViewerWindow::~LLViewerWindow() { LL_INFOS() << "Destroying Window" << LL_ENDL; + gDebugWindowProc = TRUE; // event catching, at this point it shouldn't output at all destroyWindow(); delete mDebugText; -- cgit v1.2.3 From 750d90cf592d22b9c717fa138f17b2c1e32dd1c7 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 22 Jan 2018 18:11:12 +0200 Subject: MAINT-8208 [Mac] Viewer crashes when uploading certain mesh model after enabling "Include skin weight" --- indra/llprimitive/llmodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 29af859cd0..8fbb4f6b96 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1034,8 +1034,11 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { //no exact match found, get closest point const F32 epsilon = 1e-5f; weight_map::iterator iter_up = mSkinWeights.lower_bound(pos); - weight_map::iterator iter_down = ++iter_up; - + weight_map::iterator iter_down = iter_up; + if (iter_up != mSkinWeights.end()) + { + iter_down = ++iter_up; + } weight_map::iterator best = iter_up; F32 min_dist = (iter->first - pos).magVec(); -- cgit v1.2.3 From e6f5aa7f61891395eaf0f376dca88c1d1a951d1b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 22 Jan 2018 20:37:58 +0200 Subject: MAINT-8210 Fixed crash in avatar name cache --- indra/llmessage/llavatarnamecache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 5a112b5432..abe0e46e5d 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -769,7 +769,7 @@ LLUUID LLAvatarNameCache::findIdByName(const std::string& name) // Legacy method LLUUID id; - if (gCacheName->getUUID(name, id)) + if (gCacheName && gCacheName->getUUID(name, id)) { return id; } -- cgit v1.2.3 From b654513257ea7e5f74d61c9b4586e480838be23c Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 24 Jan 2018 21:16:27 +0200 Subject: MAINT-8197 Fix for crash in gpu_benchmark() including safety checks and some refactoring --- indra/newview/llglsandbox.cpp | 192 ++++++++++++++++++++++++++---------------- 1 file changed, 118 insertions(+), 74 deletions(-) (limited to 'indra') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 1b6494195b..63270e13fe 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -881,8 +881,100 @@ void LLViewerObjectList::renderObjectBeacons() } +//----------------------------------------------------------------------------- +// gpu_benchmark() helper classes +//----------------------------------------------------------------------------- + +// This struct is used to ensure that once we call initProfile(), it will +// definitely be matched by a corresponding call to finishProfile(). It's +// a struct rather than a class simply because every member is public. +struct ShaderProfileHelper +{ + ShaderProfileHelper() + { + LLGLSLShader::initProfile(); + } + ~ShaderProfileHelper() + { + LLGLSLShader::finishProfile(false); + } +}; + +// This helper class is used to ensure that each generateTextures() call +// is matched by a corresponding deleteTextures() call. It also handles +// the bindManual() calls using those textures. +class TextureHolder +{ +public: + TextureHolder(U32 unit, U32 size) : + texUnit(gGL.getTexUnit(unit)), + source(size) // preallocate vector + { + // takes (count, pointer) + // &vector[0] gets pointer to contiguous array + LLImageGL::generateTextures(source.size(), &source[0]); + } + + ~TextureHolder() + { + // unbind + if (texUnit) + { + texUnit->unbind(LLTexUnit::TT_TEXTURE); + } + // ensure that we delete these textures regardless of how we exit + LLImageGL::deleteTextures(source.size(), &source[0]); + } + + bool bind(U32 index) + { + if (texUnit) // should always be there with dummy (-1), but just in case + { + return texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]); + } + return false; + } + +private: + // capture which LLTexUnit we're going to use + LLTexUnit* texUnit; + + // use std::vector for implicit resource management + std::vector source; +}; + +class ShaderBinder +{ +public: + ShaderBinder(LLGLSLShader& shader) : + mShader(shader) + { + mShader.bind(); + } + ~ShaderBinder() + { + mShader.unbind(); + } + +private: + LLGLSLShader& mShader; +}; + + +//----------------------------------------------------------------------------- +// gpu_benchmark() +//----------------------------------------------------------------------------- F32 gpu_benchmark() { +#if LL_WINDOWS + if (gGLManager.mIsIntel + && std::string::npos != LLOSInfo::instance().getOSStringSimple().find("Microsoft Windows 8")) // or 8.1 + { // don't run benchmark on Windows 8/8.1 based PCs with Intel GPU (MAINT-8197) + LL_WARNS() << "Skipping gpu_benchmark() for Intel graphics on Windows 8." << LL_ENDL; + return -1.f; + } +#endif + if (!gGLManager.mHasShaderObjects || !gGLManager.mHasTimerQuery) { // don't bother benchmarking the fixed function // or venerable drivers which don't support accurate timing anyway @@ -922,59 +1014,9 @@ F32 gpu_benchmark() //number of samples to take const S32 samples = 64; - - // This struct is used to ensure that once we call initProfile(), it will - // definitely be matched by a corresponding call to finishProfile(). It's - // a struct rather than a class simply because every member is public. - struct ShaderProfileHelper - { - ShaderProfileHelper() - { - LLGLSLShader::initProfile(); - } - ~ShaderProfileHelper() - { - LLGLSLShader::finishProfile(false); - } - }; + ShaderProfileHelper initProfile; - - // This helper class is used to ensure that each generateTextures() call - // is matched by a corresponding deleteTextures() call. It also handles - // the bindManual() calls using those textures. - class TextureHolder - { - public: - TextureHolder(U32 unit, U32 size): - texUnit(gGL.getTexUnit(unit)), - source(size) // preallocate vector - { - // takes (count, pointer) - // &vector[0] gets pointer to contiguous array - LLImageGL::generateTextures(source.size(), &source[0]); - } - - ~TextureHolder() - { - // unbind - texUnit->unbind(LLTexUnit::TT_TEXTURE); - // ensure that we delete these textures regardless of how we exit - LLImageGL::deleteTextures(source.size(), &source[0]); - } - - void bind(U32 index) - { - texUnit->bindManual(LLTexUnit::TT_TEXTURE, source[index]); - } - - private: - // capture which LLTexUnit we're going to use - LLTexUnit* texUnit; - - // use std::vector for implicit resource management - std::vector source; - }; - + std::vector dest(count); TextureHolder texHolder(0, count); std::vector results; @@ -987,18 +1029,31 @@ F32 gpu_benchmark() pixels[i] = (U8) ll_rand(255); } - gGL.setColorMask(true, true); LLGLDepthTest depth(GL_FALSE); for (U32 i = 0; i < count; ++i) - { //allocate render targets and textures - dest[i].allocate(res,res,GL_RGBA,false, false, LLTexUnit::TT_TEXTURE, true); + { + //allocate render targets and textures + if (!dest[i].allocate(res, res, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true)) + { + LL_WARNS() << "Failed to allocate render target." << LL_ENDL; + // abandon the benchmark test + delete[] pixels; + return -1.f; + } dest[i].bindTarget(); dest[i].clear(); dest[i].flush(); - texHolder.bind(i); + if (!texHolder.bind(i)) + { + // can use a dummy value mDummyTexUnit = new LLTexUnit(-1); + LL_WARNS() << "Failed to bind tex unit." << LL_ENDL; + // abandon the benchmark test + delete[] pixels; + return -1.f; + } LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels); } @@ -1006,7 +1061,13 @@ F32 gpu_benchmark() //make a dummy triangle to draw with LLPointer buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, GL_STATIC_DRAW_ARB); - buff->allocateBuffer(3, 0, true); + + if (!buff->allocateBuffer(3, 0, true)) + { + LL_WARNS() << "Failed to allocate buffer during benchmark." << LL_ENDL; + // abandon the benchmark test + return -1.f; + } LLStrider v; LLStrider tc; @@ -1029,22 +1090,6 @@ F32 gpu_benchmark() buff->flush(); // ensure matched pair of bind() and unbind() calls - class ShaderBinder - { - public: - ShaderBinder(LLGLSLShader& shader): - mShader(shader) - { - mShader.bind(); - } - ~ShaderBinder() - { - mShader.unbind(); - } - - private: - LLGLSLShader& mShader; - }; ShaderBinder binder(gBenchmarkProgram); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -1103,4 +1148,3 @@ F32 gpu_benchmark() return gbps; } - -- cgit v1.2.3