viewer#2411 Cleanup

master
Andrey Kleshchev 2024-09-02 22:14:42 +03:00 committed by Andrey Kleshchev
parent 57ab1a410f
commit 4cc0edb189
9 changed files with 7 additions and 140 deletions

View File

@ -31,8 +31,7 @@
#include "llvertexbuffer.h"
LLFontVertexBuffer::LLFontVertexBuffer(bool track_changes)
: mTrackStringChanges(track_changes)
LLFontVertexBuffer::LLFontVertexBuffer()
{
}
@ -141,11 +140,6 @@ S32 LLFontVertexBuffer::render(
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
}
else if (mTrackStringChanges && mLastStringHash != sStringHasher._Do_hash(text))
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
}
else
{
renderBuffers();
@ -183,7 +177,6 @@ void LLFontVertexBuffer::genBuffers(
mLastOffset = begin_offset;
mLastMaxChars = max_chars;
mLastMaxPixels = max_pixels;
mLastStringHash = sStringHasher._Do_hash(text);
mLastX = x;
mLastY = y;
mLastColor = color;

View File

@ -35,7 +35,7 @@ class LLVertexBufferData;
class LLFontVertexBuffer
{
public:
LLFontVertexBuffer(bool track_changes = true);
LLFontVertexBuffer();
~LLFontVertexBuffer();
void reset();
@ -101,7 +101,6 @@ private:
S32 mLastOffset = 0;
S32 mLastMaxChars = 0;
S32 mLastMaxPixels = 0;
size_t mLastStringHash = 0;
F32 mLastX = 0.f;
F32 mLastY = 0.f;
LLColor4 mLastColor;
@ -115,10 +114,6 @@ private:
F32 mLastScaleX = 1.f;
F32 mLastScaleY = 1.f;
LLCoordGL mLastOrigin;
bool mTrackStringChanges = true;
static std::hash<LLWString> sStringHasher;
};
#endif

View File

@ -1592,50 +1592,6 @@ void LLRender::end()
}
}
LLVertexBuffer* LLRender::beginNoCache(const GLuint& mode, S32& count)
{
if (mode != mMode)
{
if (mode == LLRender::QUADS)
{
mQuadCycle = 1;
}
if (mMode == LLRender::QUADS ||
mMode == LLRender::LINES ||
mMode == LLRender::TRIANGLES ||
mMode == LLRender::POINTS)
{
return getBuffer(count);
}
else if (mCount != 0)
{
LL_ERRS() << "gGL.begin() called redundantly." << LL_ENDL;
}
mMode = mode;
}
return nullptr;
}
LLVertexBuffer* LLRender::endNoCache(S32& count)
{
if (mCount == 0)
{
return nullptr;
//IMM_ERRS << "GL begin and end called with no vertices specified." << LL_ENDL;
}
if ((mMode != LLRender::QUADS &&
mMode != LLRender::LINES &&
mMode != LLRender::TRIANGLES &&
mMode != LLRender::POINTS) ||
mCount > 2048)
{
return getBuffer(count);
}
return nullptr;
}
void LLRender::flush()
{
STOP_GLERROR;
@ -1844,76 +1800,6 @@ void LLRender::resetStriders(S32 count)
mCount = 0;
}
LLVertexBuffer* LLRender::getBuffer(S32 & count)
{
STOP_GLERROR;
LLVertexBuffer *vb;
if (mCount > 0)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
llassert(LLGLSLShader::sCurBoundShaderPtr != nullptr);
if (!mUIOffset.empty())
{
sUICalls++;
sUIVerts += mCount;
}
//store mCount in a local variable to avoid re-entrance (drawArrays may call flush)
count = mCount;
if (mMode == LLRender::QUADS && !sGLCoreProfile)
{
if (mCount % 4 != 0)
{
count -= (mCount % 4);
LL_WARNS() << "Incomplete quad requested." << LL_ENDL;
}
}
if (mMode == LLRender::TRIANGLES)
{
if (mCount % 3 != 0)
{
count -= (mCount % 3);
LL_WARNS() << "Incomplete triangle requested." << LL_ENDL;
}
}
if (mMode == LLRender::LINES)
{
if (mCount % 2 != 0)
{
count -= (mCount % 2);
LL_WARNS() << "Incomplete line requested." << LL_ENDL;
}
}
mCount = 0;
if (mBuffer)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache miss");
U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask;
vb = genBuffer(attribute_mask, count);
drawBuffer(vb, mMode, count);
}
else
{
// mBuffer is present in main thread and not present in an image thread
LL_ERRS() << "A flush call from outside main rendering thread" << LL_ENDL;
}
resetStriders(count);
}
else
{
count = 0;
}
return vb;
}
void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
{
//the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095]

View File

@ -45,6 +45,7 @@
#include "glh/glh_linear.h"
#include <array>
#include <list>
class LLVertexBuffer;
class LLCubeMap;
@ -423,9 +424,6 @@ public:
void begin(const GLuint& mode);
void end();
LLVertexBuffer* beginNoCache(const GLuint& mode, S32& count);
LLVertexBuffer* endNoCache(S32& count);
LLVertexBuffer* getBuffer(S32& count);
U8 getMode() const { return mMode; }
void vertex2i(const GLint& x, const GLint& y);

View File

@ -105,7 +105,6 @@ LLBadge::LLBadge(const LLBadge::Params& p)
, mPaddingVert(p.padding_vert)
, mParentScroller(NULL)
, mDrawAtParentTop(false)
, mFontBuffer(false)
{
if (mImage.isNull())
{

View File

@ -124,7 +124,6 @@ LLButton::Params::Params()
LLButton::LLButton(const LLButton::Params& p)
: LLUICtrl(p),
LLBadgeOwner(getHandle()),
mFontBuffer(false),
mMouseDownFrame(0),
mMouseHeldDownCount(0),
mFlashing( false ),

View File

@ -253,8 +253,8 @@ public:
void setDisabledLabelColor(const LLUIColor& c);
void setFont(const LLFontGL* font);
const LLFontGL* getFont() const { return mGLFont; }
const std::string& getText() const { return getCurrentLabel().getString(); }
const LLFontGL* getFont() const override { return mGLFont; }
const std::string& getText() const override { return getCurrentLabel().getString(); }
S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; }
bool labelIsTruncated() const;
@ -392,7 +392,7 @@ private:
LLFontVertexBuffer mFontBuffer;
protected:
virtual std::string _getSearchText() const
virtual std::string _getSearchText() const override
{
return getLabelUnselected() + getToolTip();
}

View File

@ -256,7 +256,6 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
mText(p.label.isProvided() ? p.label() : p.value().asString()),
mAltText(p.alt_value().asString()),
mFont(p.font),
mFontBuffer(false),
mColor(p.color),
mUseColor(p.color.isProvided()),
mFontAlignment(p.font_halign),

View File

@ -59,9 +59,7 @@ protected:
: mColor(color),
mStyle(style),
mText(text),
mFont(font),
mFontBufferLabel(false),
mFontBufferText(false)
mFont(font)
{}
F32 getWidth(const LLFontGL* font);
const LLWString& getText() const { return mText; }