#2411 Allow disabling and enabling LLFontVertexBuffer

for testing purposes
master
Andrey Kleshchev 2024-09-26 18:09:32 +03:00 committed by Andrey Kleshchev
parent 49a2c136f9
commit 440c7b20da
5 changed files with 45 additions and 1 deletions

View File

@ -31,6 +31,8 @@
#include "llvertexbuffer.h"
bool LLFontVertexBuffer::sEnableBufferCollection = true;
LLFontVertexBuffer::LLFontVertexBuffer()
{
}
@ -119,6 +121,11 @@ S32 LLFontVertexBuffer::render(
{
return static_cast<S32>(text.length());
}
if (!sEnableBufferCollection)
{
// For debug purposes and performance testing
return fontp->render(text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
}
if (mBufferList.empty())
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,

View File

@ -78,6 +78,8 @@ public:
F32* right_x = NULL,
bool use_ellipses = false,
bool use_color = true);
static void enableBufferCollection(bool enable) { sEnableBufferCollection = enable; }
private:
void genBuffers(const LLFontGL* fontp,
@ -114,6 +116,8 @@ private:
F32 mLastScaleX = 1.f;
F32 mLastScaleY = 1.f;
LLCoordGL mLastOrigin;
static bool sEnableBufferCollection;
};
#endif

View File

@ -9564,6 +9564,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>CollectFontVertexBuffers</key>
<map>
<key>Comment</key>
<string>When enabled some UI elements with cache buffers generated by fonts and reuse them. When disabled general cahce will be used with a significant overhead for hash, but it regenerates vertices each frame so it's always up to date.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<real>1</real>
</map>
<key>ShowMyComplexityChanges</key>
<map>
<key>Comment</key>

View File

@ -35,6 +35,7 @@
#include "llviewercontrol.h"
#include "llfasttimer.h"
#include "llfontgl.h"
#include "llfontvertexbuffer.h"
#include "llnamevalue.h"
#include "llpointer.h"
#include "llprimitive.h"
@ -579,7 +580,16 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderMirrors");
connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate");
connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier");
gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit");
LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl("CollectFontVertexBuffers");
if (cntrl_ptr.notNull())
{
cntrl_ptr->getCommitSignal()->connect([](LLControlVariable* control, const LLSD& value, const LLSD& previous)
{
LLFontVertexBuffer::enableBufferCollection(control->getValue().asBoolean());
});
}
}
LLPipeline::~LLPipeline()
@ -1096,6 +1106,8 @@ void LLPipeline::refreshCachedSettings()
LLVOAvatar::sMaxNonImpostors = 1;
LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
}
LLFontVertexBuffer::enableBufferCollection(gSavedSettings.getBOOL("CollectFontVertexBuffers"));
}
void LLPipeline::releaseGLBuffers()

View File

@ -3435,6 +3435,16 @@ function="World.EnvPreset"
function="Advanced.HandleAttachedLightParticles"
parameter="RenderAttachedParticles" />
</menu_item_check>
<menu_item_check
label="Collect Font Vertex Buffer"
name="Collect Font Vertex Buffer">
<menu_item_check.on_check
function="CheckControl"
parameter="CollectFontVertexBuffers" />
<menu_item_check.on_click
function="ToggleControl"
parameter="CollectFontVertexBuffers" />
</menu_item_check>
<menu_item_separator />
<menu_item_check
label="Enable Shader Cache"