diff options
author | mobserveur <mobserveur@gmail.co[alias]> | 2024-11-06 01:28:26 +0100 |
---|---|---|
committer | mobserveur <mobserveur@gmail.co[alias]> | 2024-11-06 01:28:26 +0100 |
commit | 569fc58358a49d6eb8007ea987969c449db43834 (patch) | |
tree | d39e6870abc0a487b47774bbab7a6c7fca0ffd35 | |
parent | 76d31ddf9a4f8bdd94dd86053dd1296912f9c9ac (diff) |
Re-introduction of the "smoothie" optimization
This commit replaces the LL optimizations for Macs with Apple gpus by the "Smoothie" optimizations, and replaces the tuning panel with a simple fps limiter panel.
This should fix the crash occurring in extraFPS when the viewer goes in the background.
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 3 | ||||
-rw-r--r-- | indra/newview/mpfloatertuning.cpp | 36 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_mp_performance.xml | 86 |
4 files changed, 64 insertions, 88 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 12ae36f4bb..091c43c19c 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -942,7 +942,8 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const void LLVertexBuffer::initClass(LLWindow* window) { llassert(sVBOPool == nullptr); - if (gGLManager.mIsApple) + //if (gGLManager.mIsApple) + if(0) { LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL; sVBOPool = new LLAppleVBOPool(); @@ -1285,7 +1286,8 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde count = mNumVerts - index; } - if (!gGLManager.mIsApple) + //if (!gGLManager.mIsApple) + if (1) { U32 start = mOffsets[type] + sTypeSize[type] * index; U32 end = start + sTypeSize[type] * count-1; @@ -1322,7 +1324,8 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) count = mNumIndices-index; } - if (!gGLManager.mIsApple) + //if (!gGLManager.mIsApple) + if(1) { U32 start = sizeof(U16) * index; U32 end = start + sizeof(U16) * count-1; @@ -1359,6 +1362,20 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 { if (gGLManager.mIsApple) { + U32 MapBits = GL_MAP_WRITE_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; + + /* // 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(); @@ -1366,6 +1383,7 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 STOP_GLERROR; // copy into mapped buffer memcpy(dst+start, data, end-start+1); + */ } else { @@ -1423,7 +1441,8 @@ void LLVertexBuffer::_unmapBuffer() } }; - if (gGLManager.mIsApple) + //if (gGLManager.mIsApple) + if (0) { STOP_GLERROR; if (mMappedData) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 41cd05f828..c12cb74b7c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1388,7 +1388,8 @@ bool LLAppViewer::frame() bool LLAppViewer::doFrame() { - static LLCachedControl<U32> fpsLimitMaxFps(gSavedSettings, "MaxFPS", 0); + U32 fpsLimitMaxFps = (U32)gSavedSettings.getU32("MaxFPS"); + if(fpsLimitMaxFps>120) fpsLimitMaxFps=0; using TimePoint = std::chrono::steady_clock::time_point; diff --git a/indra/newview/mpfloatertuning.cpp b/indra/newview/mpfloatertuning.cpp index bfa96a8764..1a3e4cf718 100644 --- a/indra/newview/mpfloatertuning.cpp +++ b/indra/newview/mpfloatertuning.cpp @@ -29,13 +29,12 @@ #include "mpfloatertuning.h" #include "llsliderctrl.h" +#include "lltextbox.h" #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llviewercontrol.h" #include "llsdserialize.h" -#include "../llrender/llvertexbuffer.cpp" - MPFloaterTuning::MPFloaterTuning(const LLSD& key) : LLFloater(key) { } @@ -45,32 +44,25 @@ void MPFloaterTuning::syncFromPreferenceSetting(void *user_data) MPFloaterTuning *self = static_cast<MPFloaterTuning*>(user_data); U32 fps = gSavedSettings.getU32("MaxFPS"); + if(fps==0) fps=132; + LLSliderCtrl* fpsSliderCtrl = self->getChild<LLSliderCtrl>("fpsSlider"); fpsSliderCtrl->setValue(fps,FALSE); - U32 optBuf = gSavedSettings.getU32("MPVBufferOptiMode"); - - if(optBuf == 0) - { - if(gGLManager.mIsApple) optBuf = 2; - else optBuf = 1; - } - - LLComboBox * optBufCtrl = self->getChild<LLComboBox>("MPVBuffModeComboBox"); - optBufCtrl->setCurrentByIndex(optBuf-1); - - LL_INFOS() << "syncFromPreferenceSetting optBuf=" << optBuf << LL_ENDL; + LLTextBox* fpsText = self->getChild<LLTextBox>("fpsText"); + if(fps>120) fpsText->setValue("no limit"); + else fpsText->setValue(std::to_string(fps)+" fps"); } bool MPFloaterTuning::postBuild() { LLSliderCtrl* fpsSliderCtrl = getChild<LLSliderCtrl>("fpsSlider"); - fpsSliderCtrl->setMinValue(0); - fpsSliderCtrl->setMaxValue(165); + fpsSliderCtrl->setMinValue(12); + fpsSliderCtrl->setMaxValue(132); fpsSliderCtrl->setSliderMouseUpCallback(boost::bind(&MPFloaterTuning::onFinalCommit,this)); - LLComboBox* optBufCtrl = getChild<LLComboBox>("MPVBuffModeComboBox"); - optBufCtrl->setCommitCallback(boost::bind(&MPFloaterTuning::onFinalCommit,this)); + LLTextBox* fpsText = getChild<LLTextBox>("fpsText"); + fpsText->setValue(""); syncFromPreferenceSetting(this); @@ -85,11 +77,9 @@ void MPFloaterTuning::onFinalCommit() U32 fps = (U32)fpsSliderCtrl->getValueF32(); gSavedSettings.setU32("MaxFPS",fps); - LLComboBox* optBufCtrl = getChild<LLComboBox>("MPVBuffModeComboBox"); - S16 optBuf = optBufCtrl->getCurrentIndex() + 1; - gSavedSettings.setU32("MPVBufferOptiMode",optBuf); - - //LLVertexBuffer::sMappingMode = optBuf; + LLTextBox* fpsText = getChild<LLTextBox>("fpsText"); + if(fps>120) fpsText->setValue("no limit"); + else fpsText->setValue(std::to_string(fps)+" fps"); } void MPFloaterTuning::onClose(bool app_quitting) 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 d943a13f66..1b5cf82dcb 100644 --- a/indra/newview/skins/default/xui/en/floater_mp_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_mp_performance.xml @@ -3,11 +3,11 @@ positioning="cascading" legacy_header_height="40" top="12" - right="-324" - height="120" + right="-334" + height="80" min_height="120" - width="320" - min_width="320" + width="330" + min_width="330" can_minimize="true" can_close="true" can_resize="false" @@ -16,85 +16,51 @@ single_instance="true" save_rect="true" save_visibility="true" - title="Megapahit Tuning"> + title="FPS Limiter"> <panel name="panel_fps" border="false" - width="300" - height="36" + width="320" + height="60" left="10" top="40" - follows="top|left" + follows="left|top|right|bottom" layout="topleft" > <slider - name="fpsSlider" - width="300" + follows="left|top" + width="240" height="15" + left="12" layout="topleft" + name="fpsSlider" enabled="true" control_name="fpsSlider" decimal_digits="0" - increment="5" + increment="12" initial_value="0" - label="Max FPS" + label="Max FPS:" label_width="50" - text_width="30" + text_width="2" can_edit_text="false" - show_text="true" + show_text="false" > </slider> - </panel> - - <panel - name="panel_mapping" - border="false" - width="300" - height="36" - left="10" - top="78" - follows="top|left" - layout="topleft" - > - - <text - name="MPVBuffModeLabel" - width="100" + <text + follows="left|top" + width="50" height="15" - left="2" - top="8"> - Optimisations: - (needs restart): - </text> - - <combo_box - control_name="MPVBuffModeControl" - name="MPVBuffModeComboBox" - width="150" - height="23" - left="130" - top="4" + left_delta="252" + layout="topleft" + type="string" + name="fpsText" > - <combo_box.item - enabled="true" - label="Normal" - name="Normal" - value="1" /> - <combo_box.item - enabled="true" - label="Apple GPU (smoothie)" - name="Megapahit Optimisations" - value="2" /> - <combo_box.item - enabled="true" - label="Apple GPU (LL)" - name="LL Optimisations" - value="3" /> - </combo_box> + no limit + </text> - </panel> +</panel> </floater> |