summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-09-02 13:46:13 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-04 10:16:46 +0300
commit57ab1a410f9cb3534bb403e034743505758579d8 (patch)
treeaa7077841e6027d1efaf2c358c635e9cea83e8f2 /indra/llrender
parent5c64e5e13d9a75cac510aac3128fc6ee780ab243 (diff)
viewer#2411 A bit more coverage for font buffer
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontgl.cpp3
-rw-r--r--indra/llrender/llfontvertexbuffer.cpp55
-rw-r--r--indra/llrender/llfontvertexbuffer.h26
-rw-r--r--indra/llrender/llrender.cpp1
-rw-r--r--indra/llrender/llvertexbuffer.cpp5
5 files changed, 87 insertions, 3 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 7d74bb3e46..9721b020c7 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -34,7 +34,6 @@
#include "llfontbitmapcache.h"
#include "llfontregistry.h"
#include "llgl.h"
-#include "llglslshader.h"
#include "llimagegl.h"
#include "llrender.h"
#include "llstl.h"
@@ -376,6 +375,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
cur_render_x = cur_x;
cur_render_y = cur_y;
}
+
gGL.begin(LLRender::QUADS);
{
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
@@ -503,6 +503,7 @@ F32 LLFontGL::getWidthF32(const std::string& utf8text, S32 begin_offset, S32 max
F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars, bool no_padding) const
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
F32 cur_x = 0;
diff --git a/indra/llrender/llfontvertexbuffer.cpp b/indra/llrender/llfontvertexbuffer.cpp
index 284762dc94..417bacd69d 100644
--- a/indra/llrender/llfontvertexbuffer.cpp
+++ b/indra/llrender/llfontvertexbuffer.cpp
@@ -50,6 +50,60 @@ S32 LLFontVertexBuffer::render(
const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
+ LLRect rect,
+ const LLColor4& color,
+ LLFontGL::HAlign halign, LLFontGL::VAlign valign,
+ U8 style,
+ LLFontGL::ShadowType shadow,
+ S32 max_chars, S32 max_pixels,
+ F32* right_x,
+ bool use_ellipses,
+ bool use_color)
+{
+ LLRectf rect_float((F32)rect.mLeft, (F32)rect.mTop, (F32)rect.mRight, (F32)rect.mBottom);
+ return render(fontp, text, begin_offset, rect_float, color, halign, valign, style, shadow, max_chars, right_x, use_ellipses, use_color);
+}
+
+S32 LLFontVertexBuffer::render(
+ const LLFontGL* fontp,
+ const LLWString& text,
+ S32 begin_offset,
+ LLRectf rect,
+ const LLColor4& color,
+ LLFontGL::HAlign halign, LLFontGL::VAlign valign,
+ U8 style,
+ LLFontGL::ShadowType shadow,
+ S32 max_chars,
+ F32* right_x,
+ bool use_ellipses,
+ bool use_color)
+{
+ F32 x = rect.mLeft;
+ F32 y = 0.f;
+
+ switch (valign)
+ {
+ case LLFontGL::TOP:
+ y = rect.mTop;
+ break;
+ case LLFontGL::VCENTER:
+ y = rect.getCenterY();
+ break;
+ case LLFontGL::BASELINE:
+ case LLFontGL::BOTTOM:
+ y = rect.mBottom;
+ break;
+ default:
+ y = rect.mBottom;
+ break;
+ }
+ return render(fontp, text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, (S32)rect.getWidth(), right_x, use_ellipses, use_color);
+}
+
+S32 LLFontVertexBuffer::render(
+ const LLFontGL* fontp,
+ const LLWString& text,
+ S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
@@ -117,6 +171,7 @@ void LLFontVertexBuffer::genBuffers(
bool use_ellipses,
bool use_color)
{
+ // todo: add a debug build assert if this triggers too often for to long?
mBufferList.clear();
gGL.beginList(&mBufferList);
diff --git a/indra/llrender/llfontvertexbuffer.h b/indra/llrender/llfontvertexbuffer.h
index 7c29e1097b..d41c6205ac 100644
--- a/indra/llrender/llfontvertexbuffer.h
+++ b/indra/llrender/llfontvertexbuffer.h
@@ -43,6 +43,32 @@ public:
S32 render(const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
+ LLRect rect,
+ const LLColor4& color,
+ LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
+ U8 style = LLFontGL::NORMAL,
+ LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
+ S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX,
+ F32* right_x = NULL,
+ bool use_ellipses = false,
+ bool use_color = true);
+
+ S32 render(const LLFontGL* fontp,
+ const LLWString& text,
+ S32 begin_offset,
+ LLRectf rect,
+ const LLColor4& color,
+ LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
+ U8 style = LLFontGL::NORMAL,
+ LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
+ S32 max_chars = S32_MAX,
+ F32* right_x = NULL,
+ bool use_ellipses = false,
+ bool use_color = true);
+
+ S32 render(const LLFontGL* fontp,
+ const LLWString& text,
+ S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 182f61f907..b906563b08 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1531,6 +1531,7 @@ void LLRender::clearErrors()
void LLRender::beginList(std::list<LLVertexBufferData> *list)
{
+ llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram);
flush();
sBufferDataList = list;
}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 11b41730aa..156e300853 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -574,8 +574,9 @@ void LLVertexBufferData::draw()
{
if (!mVB)
{
- // signal for pushUIMatrix
- return; // todo: find a better way?
+ llassert(false);
+ // Not supposed to happen, check buffer generation
+ return;
}
if (mTexName)