diff options
author | mobserveur <mobserveur@gmail.com> | 2024-08-07 19:02:44 +0200 |
---|---|---|
committer | mobserveur <mobserveur@gmail.com> | 2024-08-07 19:02:44 +0200 |
commit | 17420cffcb0859eb1fe4a7a141ee47e12b8c0c3d (patch) | |
tree | 84c1511fa4be9d6e080178a6e90b8a84cde002c0 | |
parent | 3a995b4fb5d34b967212a61b065ad6e14422179a (diff) |
megapahit tuning : return of the smoothie
This commit reintroduces the meapahit specic optimisations while maintaining an option for
the LL vertex buffer optimisation mode.
-rw-r--r-- | indra/llrender/llrender.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 45 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_mp_performance.xml | 10 |
4 files changed, 37 insertions, 24 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 0a522c88d7..99d7b897ee 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1711,7 +1711,7 @@ void LLRender::flush() } //LL_INFOS() << "LLVertexBuffer::sMappingMode " << LLVertexBuffer::sMappingMode << LL_ENDL; - if(LLVertexBuffer::sMappingMode > 1) + if(LLVertexBuffer::sMappingMode == 3) { vb->unmapBuffer(); } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index db881efd2b..5e936c1428 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -317,7 +317,7 @@ public: ~LLVBOPool() { - if(mMappingMode > 1) return; + if(mMappingMode == 3) return; clear(); } @@ -336,7 +336,7 @@ public: U64 getVramBytesUsed() { - if(mMappingMode > 1) return mAllocated; + if(mMappingMode == 3) return mAllocated; else return mAllocated + mReserved; } @@ -359,7 +359,7 @@ public: llassert(data == nullptr); // non null data indicates a buffer that wasn't freed llassert(size >= 2); // any buffer size smaller than a single index is nonsensical - if(mMappingMode > 1) + if(mMappingMode == 3) { mAllocated += size; @@ -427,7 +427,7 @@ public: llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER); llassert(size >= 2); - if(mMappingMode > 1) + if(mMappingMode == 3) { if (data) { @@ -785,7 +785,7 @@ void LLVertexBuffer::initClass(LLWindow* window) sVBOPool = new LLVBOPool(); sVBOPool->mMappingMode = sMappingMode; - //LL_INFOS() << "milo sVBOPool intialized with " << sMappingMode << LL_ENDL; + //LL_INFOS() << "sVBOPool intialized with mapping mode: " << sMappingMode << LL_ENDL; #if ENABLE_GL_WORK_QUEUE sQueue = new GLWorkQueue(); @@ -1093,7 +1093,7 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde count = mNumVerts - index; } - if(sMappingMode < 2) + if(sMappingMode != 3) { U32 start = mOffsets[type] + sTypeSize[type] * index; U32 end = start + sTypeSize[type] * count-1; @@ -1130,7 +1130,7 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) count = mNumIndices-index; } - if(sMappingMode < 2) + if(sMappingMode != 3) { U32 start = sizeof(U16) * index; U32 end = start + sizeof(U16) * count-1; @@ -1165,9 +1165,24 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) // dst -- mMappedData or mMappedIndexData void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8* dst) { - if(sMappingMode > 1) + if(sMappingMode == 2) + { + //LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb glMapBufferRange"); + if (end == 0) return; + U32 buffer_size = end-start+1; + U8 * mptr = (U8*) glMapBufferRange( target, start, end-start+1, GL_MAP_WRITE_BIT); + + 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; + return; + } + + if(sMappingMode == 3) { - //LL_INFOS() << "milo flush_vbo() NO POOL" << LL_ENDL; LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy"); //STOP_GLERROR; // copy into mapped buffer @@ -1208,7 +1223,7 @@ void LLVertexBuffer::unmapBuffer() } }; - if(sMappingMode > 1) + if(sMappingMode == 3) { //STOP_GLERROR; if (mMappedData) @@ -1220,8 +1235,7 @@ void LLVertexBuffer::unmapBuffer() mGLBuffer = gen_buffer(); glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer); sGLRenderBuffer = mGLBuffer; - if(sMappingMode==2) glBufferData(GL_ARRAY_BUFFER, mSize, mMappedData, GL_STATIC_DRAW); - else glBufferData(GL_ARRAY_BUFFER, mSize, mMappedData, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, mSize, mMappedData, GL_DYNAMIC_DRAW); } else if (mGLBuffer != sGLRenderBuffer) { @@ -1241,8 +1255,7 @@ void LLVertexBuffer::unmapBuffer() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices); sGLRenderIndices = mGLIndices; - if(sMappingMode==2) glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndicesSize, mMappedIndexData, GL_STATIC_DRAW); - else glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndicesSize, mMappedIndexData, GL_DYNAMIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndicesSize, mMappedIndexData, GL_DYNAMIC_DRAW); } else if (mGLIndices != sGLRenderIndices) { @@ -1439,10 +1452,10 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, U32 in // Set for rendering void LLVertexBuffer::setBuffer() { - if(sMappingMode > 1) + if(sMappingMode == 3) { if (!mGLBuffer) - { // OS X doesn't allocate a buffer until we call unmapBuffer + { return; } } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 35c5bb7cff..e03fc429bf 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13775,8 +13775,8 @@ OpenGL buffer mapping mode: 0:auto 1:normal - 2:optimised - 3:experimental.</string> + 2:MP optimised + 3:LL optimized.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/skins/default/xui/en/floater_mp_performance.xml b/indra/newview/skins/default/xui/en/floater_mp_performance.xml index 06dc4cabc6..d943a13f66 100644 --- a/indra/newview/skins/default/xui/en/floater_mp_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_mp_performance.xml @@ -66,7 +66,7 @@ height="15" left="2" top="8"> - Buffer mapping + Optimisations: (needs restart): </text> @@ -85,13 +85,13 @@ value="1" /> <combo_box.item enabled="true" - label="Optimized (Apple GPU)" - name="Optimized" + label="Apple GPU (smoothie)" + name="Megapahit Optimisations" value="2" /> <combo_box.item enabled="true" - label="Experimental" - name="Experimental" + label="Apple GPU (LL)" + name="LL Optimisations" value="3" /> </combo_box> |