diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 79 | ||||
-rw-r--r-- | indra/llrender/llfontfreetype.h | 7 | ||||
-rw-r--r-- | indra/llrender/llfontregistry.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 11 | ||||
-rw-r--r-- | indra/llrender/llgltexture.h | 1 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 1 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 10 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 24 |
8 files changed, 115 insertions, 20 deletions
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index de26d19efc..ab668dc192 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -31,6 +31,9 @@ // Freetype stuff #include <ft2build.h> +#ifdef LL_WINDOWS +#include <freetype2\freetype\ftsystem.h> +#endif // For some reason, this won't work if it's not wrapped in the ifdef #ifdef FT_FREETYPE_H @@ -106,6 +109,10 @@ LLFontFreetype::LLFontFreetype() mAscender(0.f), mDescender(0.f), mLineHeight(0.f), +#ifdef LL_WINDOWS + pFileStream(NULL), + pFtStream(NULL), +#endif mIsFallback(FALSE), mFTFace(NULL), mRenderGlyphCount(0), @@ -127,10 +134,29 @@ 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; // mFallbackFonts cleaned up by LLPointer destructor } +#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<llifstream *>(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<llifstream *>(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 @@ -143,13 +169,55 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v int error; +#ifdef LL_WINDOWS + pFileStream = new llifstream(filename, std::ios::binary); + if (pFileStream->is_open()) + { + 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); + } + else + { + delete pFileStream; + pFileStream = NULL; + return FALSE; + } +#else error = FT_New_Face( gFTLibrary, filename.c_str(), 0, - &mFTFace ); + &mFTFace); +#endif - if (error) + if (error) { +#ifdef LL_WINDOWS + pFileStream->close(); + delete pFileStream; + delete pFtStream; + pFileStream = NULL; + pFtStream = NULL; +#endif return FALSE; } @@ -166,6 +234,13 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v { // Clean up freetype libs. FT_Done_Face(mFTFace); +#ifdef LL_WINDOWS + pFileStream->close(); + delete pFileStream; + delete pFtStream; + pFileStream = NULL; + pFtStream = NULL; +#endif mFTFace = NULL; return FALSE; } diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index a5ece42b88..aadebf5e70 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; class LLFontManager { @@ -159,6 +161,11 @@ private: LLFT_Face mFTFace; +#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/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index d003687415..3c829596ce 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -447,7 +447,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) if (!fontp->loadFace(font_path, extra_scale * point_size, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { - LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL; + LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << " from path " << local_path << LL_ENDL; delete fontp; fontp = NULL; } diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 155c2402bd..35b6951779 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1348,8 +1348,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/llgltexture.h b/indra/llrender/llgltexture.h index 45592ee077..70610d9626 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -49,6 +49,7 @@ public: enum EBoostLevel { BOOST_NONE = 0, + BOOST_ALM , //acts like NONE when ALM is on, max discard when ALM is off BOOST_AVATAR_BAKED , BOOST_AVATAR , BOOST_CLOUDS , diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 76f28bb43f..65d6181920 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 a67fb8da52..32bb728d8a 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -269,6 +269,13 @@ public: SPECULAR_MAP, NUM_TEXTURE_CHANNELS, }; + + enum eVolumeTexIndex + { + LIGHT_TEX = 0, + SCULPT_TEX, + NUM_VOLUME_TEXTURE_CHANNELS, + }; typedef enum { TRIANGLES = 0, @@ -438,7 +445,8 @@ public: static U32 sUICalls; static U32 sUIVerts; static bool sGLCoreProfile; - + static bool sNsightDebugSupport; + private: friend class LLLightState; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f10301b42d..a55ca5ed9c 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -98,7 +98,6 @@ U32 LLVertexBuffer::sCurVAOName = 1; U32 LLVertexBuffer::sAllocatedIndexBytes = 0; U32 LLVertexBuffer::sIndexCount = 0; -LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL; U32 LLVertexBuffer::sBindCount = 0; U32 LLVertexBuffer::sSetCount = 0; S32 LLVertexBuffer::sCount = 0; @@ -191,6 +190,10 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); + if (!ret) + { + LL_ERRS() << "Failed to allocate for LLVBOPool buffer" << LL_ENDL; + } } } else @@ -859,11 +862,6 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping) { sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject; sDisableVBOMapping = sEnableVBOs && no_vbo_mapping; - - if (!sPrivatePoolp) - { - sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC); - } } //static @@ -906,12 +904,6 @@ void LLVertexBuffer::cleanupClass() sStreamVBOPool.cleanup(); sDynamicVBOPool.cleanup(); sDynamicCopyVBOPool.cleanup(); - - if(sPrivatePoolp) - { - LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp); - sPrivatePoolp = NULL; - } } //---------------------------------------------------------------------------- @@ -1202,7 +1194,7 @@ bool LLVertexBuffer::createGLBuffer(U32 size) { static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; - mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedData = (U8*)ll_aligned_malloc_16(size); disclaimMem(mSize); mSize = size; claimMem(mSize); @@ -1244,7 +1236,7 @@ bool LLVertexBuffer::createGLIndices(U32 size) } else { - mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedIndexData = (U8*)ll_aligned_malloc_16(size); static int gl_buffer_idx = 0; mGLIndices = ++gl_buffer_idx; mIndicesSize = size; @@ -1267,7 +1259,7 @@ void LLVertexBuffer::destroyGLBuffer() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedData); + ll_aligned_free_16((void*)mMappedData); mMappedData = NULL; mEmpty = true; } @@ -1287,7 +1279,7 @@ void LLVertexBuffer::destroyGLIndices() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData); + ll_aligned_free_16((void*)mMappedIndexData); mMappedIndexData = NULL; mEmpty = true; } |