diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llimagegl.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 17 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 2 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 61 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.h | 5 |
7 files changed, 67 insertions, 24 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 42af68c276..9ff483b92b 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -357,7 +357,9 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac #endif case GL_DEPTH_COMPONENT: return 24; + case GL_DEPTH_COMPONENT16: return 16; case GL_DEPTH_COMPONENT24: return 24; + case GL_DEPTH_COMPONENT32: return 32; case GL_RGBA16: return 64; case GL_R16F: return 16; case GL_RG16F: return 32; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index d0e268f08c..5d26a69d7b 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -530,7 +530,9 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio { if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC) { - glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gGLManager.mMaxAnisotropy); + //glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gGLManager.mMaxAnisotropy); + //We plan to add a setting. For now we stick to a low value. + glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4.0); } else { @@ -1592,7 +1594,6 @@ void LLRender::end(std::string comment_) void LLRender::flush(std::string comment_) { - LOG_GLERROR("LLRender::flush() begin " + comment_); if (mCount > 0) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; @@ -1661,9 +1662,9 @@ void LLRender::flush(std::string comment_) } resetStriders(count); - } - LOG_GLERROR("LLRender::flush() end " + comment_); + LOG_GLERROR("LLRender::flush() end " + comment_); + } } LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) @@ -1760,9 +1761,11 @@ LLVertexBuffer* LLRender::genBuffer(U32 attribute_mask, S32 count) vb->setColorData(mColorsp.get()); } -#if LL_DARWIN - vb->unmapBuffer(); -#endif + if(gGLManager.mIsApple && LLVertexBuffer::getVertexBufferMode() == 0) + { + vb->unmapBuffer(); + } + vb->unbind(); return vb; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 957c85b606..4fd32620e1 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -368,7 +368,7 @@ bool LLRenderTarget::allocateDepth() U32 internal_type = LLTexUnit::getInternalType(mUsage); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_FLOAT, NULL, false); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); sBytesAllocated += mResX*mResY*4; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 3bc71a7413..fa1c686e8e 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1512,6 +1512,8 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("bloomExtractORM"); mReservedUniforms.push_back("bloomExtractMetal"); mReservedUniforms.push_back("bloomExtractNonMetal"); + mReservedUniforms.push_back("bloomClampValue"); + mReservedUniforms.push_back("mpHDRBoost"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 8b0bfc6bbe..19416066a5 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -352,6 +352,8 @@ public: BLOOM_EXTRACT_ORM, // "bloomExtractORM" BLOOM_EXTRACT_METAL, // "bloomExtractMetal" BLOOM_EXTRACT_NONMETAL, // "bloomExtractNonMetal" + BLOOM_CLAMP, // "bloomClampValue" + MP_HDR_BOOST, // "mpHDRBoost" END_RESERVED_UNIFORMS } eGLSLReservedUniforms; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 2a0acab05a..040dde7317 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -29,7 +29,6 @@ #include "llfasttimer.h" #include "llsys.h" #include "llvertexbuffer.h" -// #include "llrender.h" #include "llglheaders.h" #include "llrender.h" #include "llvector4a.h" @@ -272,13 +271,13 @@ static GLuint gen_buffer() { LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer"); sIndex = pool_size; -#if !LL_DARWIN +//#if !LL_DARWIN if (!gGLManager.mIsAMD) { glGenBuffers(pool_size, sNamePool); } else -#endif +//#endif { // work around for AMD driver bug for (U32 i = 0; i < pool_size; ++i) { @@ -615,6 +614,8 @@ public: static LLVBOPool* sVBOPool = nullptr; +static U32 sMPVertexBufferMode = 0; + void LLVertexBufferData::drawWithMatrix() { if (!mVB) @@ -946,11 +947,13 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const } //static -void LLVertexBuffer::initClass(LLWindow* window) +void LLVertexBuffer::initClass(LLWindow* window, U32 mode_) { llassert(sVBOPool == nullptr); - if (gGLManager.mIsApple) + sMPVertexBufferMode = mode_; + + if (mode_ == 0 && gGLManager.mIsApple) { LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL; sVBOPool = new LLAppleVBOPool(); @@ -973,6 +976,12 @@ void LLVertexBuffer::initClass(LLWindow* window) } //static +U32 LLVertexBuffer::getVertexBufferMode() +{ + return sMPVertexBufferMode; +} + +//static void LLVertexBuffer::unbind() { glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -1291,7 +1300,7 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde count = mNumVerts - index; } - if (!gGLManager.mIsApple) + if (!gGLManager.mIsApple || sMPVertexBufferMode == 1) { U32 start = mOffsets[type] + sTypeSize[type] * index; U32 end = start + sTypeSize[type] * count-1; @@ -1328,7 +1337,7 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) count = mNumIndices-index; } - if (!gGLManager.mIsApple) + if (!gGLManager.mIsApple || sMPVertexBufferMode == 1) { U32 start = sizeof(U16) * index; U32 end = start + sizeof(U16) * count-1; @@ -1365,13 +1374,35 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 { if (gGLManager.mIsApple) { - // on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call - // _mapBuffer to tag the buffer for flushing to GL - _mapBuffer(); - LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy"); - //LOG_GLERROR("LLVertexBuffer::flush_vbo()"); - // copy into mapped buffer - memcpy(dst+start, data, end-start+1); + if(sMPVertexBufferMode == 1) + { + //LL_WARNS() << "flush_vbo mode 1" << LL_ENDL; + + U32 MapBits = GL_MAP_WRITE_BIT; + //U32 MapBits = GL_MAP_READ_BIT; + U32 buffer_size = end-start+1; + + U8 * mptr = NULL; + mptr = (U8*) glMapBufferRange( target, start, end-start+1, MapBits); + + if (mptr) + { + std::memcpy(mptr, (U8*) data, buffer_size); + if(!glUnmapBuffer(target)) LL_WARNS() << "glUnmapBuffer() failed" << LL_ENDL; + } + else LL_WARNS() << "glMapBufferRange() returned NULL" << LL_ENDL; + + } + else + { + //LL_WARNS() << "flush_vbo mode 0" << LL_ENDL; + // on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call + // _mapBuffer to tag the buffer for flushing to GL + _mapBuffer(); + LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy"); + // copy into mapped buffer + memcpy(dst+start, data, end-start+1); + } } else { @@ -1428,7 +1459,7 @@ void LLVertexBuffer::_unmapBuffer() } }; - if (gGLManager.mIsApple) + if (gGLManager.mIsApple && sMPVertexBufferMode == 0) { LOG_GLERROR("LLVertexBuffer::_unmapBuffer() - apple 1"); if (mMappedData) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 375ad76fb8..4239477b8d 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -109,7 +109,7 @@ public: return *this; } - static void initClass(LLWindow* window); + static void initClass(LLWindow* window, U32 mode_ = 0); static void cleanupClass(); static void setupClientArrays(U32 data_mask); static void drawArrays(U32 mode, const std::vector<LLVector3>& pos); @@ -128,6 +128,9 @@ public: // flush any pending mapped buffers static void flushBuffers(); + static U32 getVertexBufferMode(); + + //WARNING -- when updating these enums you MUST // 1 - update LLVertexBuffer::sTypeSize // 2 - update LLVertexBuffer::vb_type_name |