diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 441b72b8ba..f53fe21f85 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1577,16 +1577,21 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
}
alpha_data = new U8[width * height];
mAlphaCache[cache_index] = alpha_data;
- // Format GL_ALPHA is invalid for glReadPixels
- //glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
- U8* alpha_buffer = new U8[width * height * 4];
- glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, alpha_buffer);
- for (S32 i = 0; i < width * height; ++i)
+
+ // nSight doesn't support use of glReadPixels
+ if (!LLRender::sNsightDebugSupport)
{
- alpha_data[i] = alpha_buffer[i * 4 + 3];
+ // Format GL_ALPHA is invalid for glReadPixels
+ //glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
+ U8* alpha_buffer = new U8[width * height * 4];
+ glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, alpha_buffer);
+ for (S32 i = 0; i < width * height; ++i)
+ {
+ alpha_data[i] = alpha_buffer[i * 4 + 3];
+ }
+ delete[] alpha_buffer;
+ //
}
- delete[] alpha_buffer;
- //
}
getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 45a55046ff..c7a09d9210 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -2285,13 +2285,24 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
//and trailers are different for the formats.
U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
{
+ if (size == 0)
+ {
+ LL_WARNS() << "No data to unzip." << LL_ENDL;
+ return NULL;
+ }
+
U8* result = NULL;
U32 cur_size = 0;
z_stream strm;
const U32 CHUNK = 0x4000;
- U8 *in = new U8[size];
+ U8 *in = new(std::nothrow) U8[size];
+ if (in == NULL)
+ {
+ LL_WARNS() << "Memory allocation failure." << LL_ENDL;
+ return NULL;
+ }
is.read((char*) in, size);
U8 out[CHUNK];
@@ -2343,7 +2354,10 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32
U8* new_result = (U8*) realloc(result, cur_size + have);
if (new_result == NULL)
{
- LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
+ LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size
+ << " bytes; requested " << cur_size + have
+ << " bytes; total syze: ." << size << " bytes."
+ << LL_ENDL;
inflateEnd(&strm);
if (result)
{
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 32e8ea9682..1f4aa9b3a6 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -152,13 +152,16 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
//LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
- // We're done with the run function, this thread is done executing now.
- //NB: we are using this flag to sync across threads...we really need memory barriers here
- threadp->mStatus = STOPPED;
delete threadp->mRecorder;
threadp->mRecorder = NULL;
+ // We're done with the run function, this thread is done executing now.
+ //NB: we are using this flag to sync across threads...we really need memory barriers here
+ // Todo: add LLMutex per thread instead of flag?
+ // We are using "while (mStatus != STOPPED) {ms_sleep();}" everywhere.
+ threadp->mStatus = STOPPED;
+
return NULL;
}
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 22f3886e9e..5967ff5ff0 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -31,6 +31,9 @@
// Freetype stuff
#include
+#ifdef LL_WINDOWS
+#include
+#endif
// For some reason, this won't work if it's not wrapped in the ifdef
#ifdef FT_FREETYPE_H
@@ -107,8 +110,10 @@ LLFontFreetype::LLFontFreetype()
mAscender(0.f),
mDescender(0.f),
mLineHeight(0.f),
- pFontBuffer(NULL),
- mBufferSize(0),
+#ifdef LL_WINDOWS
+ pFileStream(NULL),
+ pFtStream(NULL),
+#endif
mIsFallback(FALSE),
mFTFace(NULL),
mRenderGlyphCount(0),
@@ -136,9 +141,11 @@ LLFontFreetype::~LLFontFreetype()
std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer());
mCharGlyphInfoMap.clear();
+#ifdef LL_WINDOWS
+ delete pFileStream; // closed by FT_Done_Face
+ delete pFtStream;
+#endif
delete mFontBitmapCachep;
- delete pFontBuffer;
- disclaimMem(mBufferSize);
// mFallbackFonts cleaned up by LLPointer destructor
// Delete the kerning cache
@@ -149,6 +156,21 @@ LLFontFreetype::~LLFontFreetype()
//
}
+#ifdef LL_WINDOWS
+unsigned long ft_read_cb(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count) {
+ if (count <= 0) return count;
+ llifstream *file_stream = static_cast(stream->descriptor.pointer);
+ file_stream->seekg(offset, std::ios::beg);
+ file_stream->read((char*)buffer, count);
+ return file_stream->gcount();
+}
+
+void ft_close_cb(FT_Stream stream) {
+ llifstream *file_stream = static_cast(stream->descriptor.pointer);
+ file_stream->close();
+}
+#endif
+
BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, S32 components, BOOL is_fallback)
{
// Don't leak face objects. This is also needed to deal with
@@ -163,56 +185,44 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
// FIRE-7570. Only load/mmap fonts once. loadFont will either load a font into memory, or reuse an already loaded font.
//#ifdef LL_WINDOWS
-//
-// if (mBufferSize > 0)
+// pFileStream = new llifstream(filename, std::ios::binary);
+// if (pFileStream->is_open())
// {
-// delete pFontBuffer;
-// disclaimMem(mBufferSize);
-// pFontBuffer = NULL;
-// mBufferSize = 0;
+// std::streampos beg = pFileStream->tellg();
+// pFileStream->seekg(0, std::ios::end);
+// std::streampos end = pFileStream->tellg();
+// std::size_t file_size = end - beg;
+// pFileStream->seekg(0, std::ios::beg);
+//
+// pFtStream = new LLFT_Stream();
+// pFtStream->base = 0;
+// pFtStream->pos = 0;
+// pFtStream->size = file_size;
+// pFtStream->descriptor.pointer = pFileStream;
+// pFtStream->read = ft_read_cb;
+// pFtStream->close = ft_close_cb;
+//
+// FT_Open_Args args;
+// args.flags = FT_OPEN_STREAM;
+// args.stream = (FT_StreamRec*)pFtStream;
+//
+// error = FT_Open_Face(gFTLibrary,
+// &args,
+// 0,
+// &mFTFace);
// }
-//
-// S32 file_size = 0;
-// LLFILE* file = LLFile::fopen(filename, "rb");
-// if (!file)
+// else
// {
+// delete pFileStream;
+// pFileStream = NULL;
// return FALSE;
// }
-//
-// if (!fseek(file, 0, SEEK_END))
-// {
-// file_size = ftell(file);
-// fseek(file, 0, SEEK_SET);
-// }
-//
-// // Don't delete before FT_Done_Face
-// pFontBuffer = new(std::nothrow) U8[file_size];
-// if (!pFontBuffer)
-// {
-// fclose(file);
-// return FALSE;
-// }
-//
-// mBufferSize = fread(pFontBuffer, 1, file_size, file);
-// fclose(file);
-//
-// if (mBufferSize != file_size)
-// {
-// delete pFontBuffer;
-// mBufferSize = 0;
-// return FALSE;
-// }
-//
-// error = FT_New_Memory_Face( gFTLibrary,
-// (FT_Byte*) pFontBuffer,
-// mBufferSize,
-// 0,
-// &mFTFace);
//#else
// error = FT_New_Face( gFTLibrary,
// filename.c_str(),
// 0,
// &mFTFace);
+//#endif
FT_Open_Args openArgs;
memset( &openArgs, 0, sizeof( openArgs ) );
openArgs.memory_base = gFontManagerp->loadFont( filename, openArgs.memory_size );
@@ -223,15 +233,19 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
openArgs.flags = FT_OPEN_MEMORY;
error = FT_Open_Face( gFTLibrary, &openArgs, 0, &mFTFace );
-
-//#endif
//
if (error)
{
- delete pFontBuffer;
- pFontBuffer = NULL;
- mBufferSize = 0;
+// FIRE-7570. Only load/mmap fonts once. loadFont will either load a font into memory, or reuse an already loaded font.
+//#ifdef LL_WINDOWS
+// pFileStream->close();
+// delete pFileStream;
+// delete pFtStream;
+// pFileStream = NULL;
+// pFtStream = NULL;
+//#endif
+//
return FALSE;
}
@@ -248,15 +262,19 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
{
// Clean up freetype libs.
FT_Done_Face(mFTFace);
- delete pFontBuffer;
- pFontBuffer = NULL;
- mBufferSize = 0;
+// FIRE-7570. Only load/mmap fonts once. loadFont will either load a font into memory, or reuse an already loaded font.
+//#ifdef LL_WINDOWS
+// pFileStream->close();
+// delete pFileStream;
+// delete pFtStream;
+// pFileStream = NULL;
+// pFtStream = NULL;
+//#endif
+//
mFTFace = NULL;
return FALSE;
}
- claimMem(mBufferSize);
-
F32 y_max, y_min, x_max, x_min;
F32 ems_per_unit = 1.f/ mFTFace->units_per_EM;
F32 pixels_per_unit = pixels_per_em * ems_per_unit;
diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h
index 81829285c5..608b5db705 100644
--- a/indra/llrender/llfontfreetype.h
+++ b/indra/llrender/llfontfreetype.h
@@ -40,6 +40,8 @@
// We'll forward declare the struct here. JC
struct FT_FaceRec_;
typedef struct FT_FaceRec_* LLFT_Face;
+struct FT_StreamRec_;
+typedef struct FT_StreamRec_ LLFT_Stream;
// FIRE-7570. Only load/mmap fonts once.
namespace nd
@@ -178,8 +180,11 @@ private:
F32 mLineHeight;
LLFT_Face mFTFace;
- U8* pFontBuffer;
- S32 mBufferSize;
+
+#ifdef LL_WINDOWS
+ llifstream *pFileStream;
+ LLFT_Stream *pFtStream;
+#endif
BOOL mIsFallback;
font_vector_t mFallbackFonts; // A list of fallback fonts to look for glyphs in (for Unicode chars)
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 0df484cf3a..081a83f2ae 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1359,8 +1359,19 @@ void LLGLManager::initExtensions()
if (mHasVertexShader)
{
LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL;
+
+ // nSight doesn't support use of ARB funcs that have been normalized in the API
+ if (!LLRender::sNsightDebugSupport)
+ {
glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB");
glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB");
+ }
+ else
+ {
+ glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocation");
+ glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocation");
+ }
+
glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB");
glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB");
glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB");
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index c59c6d2765..b313e4164a 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -49,6 +49,7 @@ U32 LLRender::sUICalls = 0;
U32 LLRender::sUIVerts = 0;
U32 LLTexUnit::sWhiteTexture = 0;
bool LLRender::sGLCoreProfile = false;
+bool LLRender::sNsightDebugSupport = false;
static const U32 LL_NUM_TEXTURE_LAYERS = 32;
static const U32 LL_NUM_LIGHT_UNITS = 8;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index f89258ce9f..f8b9f8b9ac 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -443,7 +443,8 @@ public:
static U32 sUICalls;
static U32 sUIVerts;
static bool sGLCoreProfile;
-
+ static bool sNsightDebugSupport;
+
private:
friend class LLLightState;
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index f363648fb2..30b88f563b 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1719,12 +1719,12 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
BOOL LLLineEditor::canDoDelete() const
{
- return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
+ return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
}
void LLLineEditor::doDelete()
{
- if (canDoDelete())
+ if (canDoDelete() && mText.length() > 0)
{
// Prepare for possible rollback
LLLineEditorRollback rollback( this );
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 803224578d..e6a2468e03 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -2196,6 +2196,10 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask)
LLScrollListCell* cellp = item->getColumn(column_index);
cellp->setValue(item_value);
cellp->onCommit();
+ if (mLastSelected == NULL)
+ {
+ break;
+ }
}
}
//FIXME: find a better way to signal cell changes
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index aeaf3c4518..c6e166dc5b 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -285,7 +285,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name,
LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL;
}
- mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "ca-bundle.crt");
+ mCAFile = gDirUtilp->getExpandedFilename( LL_PATH_EXECUTABLE, "ca-bundle.crt" );
}
U32 LLDir_Win32::countFilesInDir(const std::string &dirname, const std::string &mask)
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index 2fd2614cce..be8e83a56f 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -52,13 +52,14 @@ S32 LLLFSThread::updateClass(U32 ms_elapsed)
//static
void LLLFSThread::cleanupClass()
{
+ llassert(sLocal != NULL);
sLocal->setQuitting();
while (sLocal->getPending())
{
sLocal->update(0);
}
delete sLocal;
- sLocal = 0;
+ sLocal = NULL;
}
//----------------------------------------------------------------------------
@@ -75,6 +76,7 @@ LLLFSThread::LLLFSThread(bool threaded) :
LLLFSThread::~LLLFSThread()
{
+ // mLocalAPRFilePoolp cleanup in LLThread
// ~LLQueuedThread() will be called here
}
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 7811489a66..04ba473e4b 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1555,7 +1555,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
(LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << LL_ENDL;
done = true;
- if (LLRender::sGLCoreProfile)
+ // force sNoFixedFunction iff we're trying to use nsight debugging which does not support many legacy API uses
+
+ // nSight doesn't support use of legacy API funcs in the fixed function pipe
+ if (LLRender::sGLCoreProfile || LLRender::sNsightDebugSupport)
{
LLGLSLShader::sNoFixedFunction = true;
}
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index d911f15595..10b765f5b8 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1977,7 +1977,6 @@ set(viewer_APPSETTINGS_FILES
app_settings/viewerart.xml
${CMAKE_SOURCE_DIR}/../etc/message.xml
${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
- ${AUTOBUILD_INSTALL_DIR}/ca-bundle.crt
packages-info.txt
)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 47884e99fd..6021f7e145 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -11081,6 +11081,19 @@ Change of this parameter will affect the layout of buttons in notification toast
Value
0
+ RenderNsightDebugSupport
+
RenderLocalLights