Skip to content

Commit e33cc45

Browse files
committed
Merge remote-tracking branch 'origin/release/2024.12-ForeverFPS' into brad/develop
# Conflicts: # indra/newview/llviewertexture.cpp
2 parents 10867bc + 9159922 commit e33cc45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+318
-341
lines changed

indra/llrender/llcubemaparray.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ LLCubeMapArray::~LLCubeMapArray()
109109
{
110110
}
111111

112-
void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips)
112+
void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips, bool hdr)
113113
{
114114
U32 texname = 0;
115115
mWidth = resolution;
@@ -128,6 +128,10 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
128128
free_cur_tex_image();
129129

130130
U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
131+
if (!hdr)
132+
{
133+
format = components == 4 ? GL_RGBA8 : GL_RGB8;
134+
}
131135
U32 mip = 0;
132136
U32 mip_resolution = resolution;
133137
while (mip_resolution >= 1)

indra/llrender/llcubemaparray.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class LLCubeMapArray : public LLRefCount
5252
// components - number of components per pixel
5353
// count - number of cube maps in the array
5454
// use_mips - if true, mipmaps will be allocated for this cube map array and anisotropic filtering will be used
55-
void allocate(U32 res, U32 components, U32 count, bool use_mips = true);
55+
void allocate(U32 res, U32 components, U32 count, bool use_mips = true, bool hdr = true);
5656
void bind(S32 stage);
5757
void unbind();
5858

indra/llrender/llfontfreetype.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
482482
return nullptr;
483483

484484
llassert(!mIsFallback);
485-
fontp->renderGlyph(requested_glyph_type, glyph_index);
485+
fontp->renderGlyph(requested_glyph_type, glyph_index, wch);
486486

487487
EFontGlyphType bitmap_glyph_type = EFontGlyphType::Unspecified;
488488
switch (fontp->mFTFace->glyph->bitmap.pixel_mode)
@@ -627,7 +627,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
627627
}
628628
}
629629

630-
void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const
630+
void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, llwchar wch) const
631631
{
632632
if (mFTFace == nullptr)
633633
return;
@@ -642,11 +642,28 @@ void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) co
642642
FT_Error error = FT_Load_Glyph(mFTFace, glyph_index, load_flags);
643643
if (FT_Err_Ok != error)
644644
{
645+
if (error == FT_Err_Out_Of_Memory)
646+
{
647+
LLError::LLUserWarningMsg::showOutOfMemory();
648+
LL_ERRS() << "Out of memory loading glyph for character " << wch << LL_ENDL;
649+
}
650+
645651
std::string message = llformat(
646-
"Error %d (%s) loading glyph %u: bitmap_type=%u, load_flags=%d",
647-
error, FT_Error_String(error), glyph_index, bitmap_type, load_flags);
652+
"Error %d (%s) loading wchar %u glyph %u/%u: bitmap_type=%u, load_flags=%d",
653+
error, FT_Error_String(error), wch, glyph_index, mFTFace->num_glyphs, bitmap_type, load_flags);
648654
LL_WARNS_ONCE() << message << LL_ENDL;
649655
error = FT_Load_Glyph(mFTFace, glyph_index, load_flags ^ FT_LOAD_COLOR);
656+
if (FT_Err_Invalid_Outline == error
657+
|| FT_Err_Invalid_Composite == error
658+
|| (FT_Err_Ok != error && LLStringOps::isEmoji(wch)))
659+
{
660+
glyph_index = FT_Get_Char_Index(mFTFace, '?');
661+
// if '?' is not present, potentially can use last index, that's supposed to be null glyph
662+
if (glyph_index > 0)
663+
{
664+
error = FT_Load_Glyph(mFTFace, glyph_index, load_flags ^ FT_LOAD_COLOR);
665+
}
666+
}
650667
llassert_always_msg(FT_Err_Ok == error, message.c_str());
651668
}
652669

indra/llrender/llfontfreetype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class LLFontFreetype : public LLRefCount
164164
bool hasGlyph(llwchar wch) const; // Has a glyph for this character
165165
LLFontGlyphInfo* addGlyph(llwchar wch, EFontGlyphType glyph_type) const; // Add a new character to the font if necessary
166166
LLFontGlyphInfo* addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index, EFontGlyphType bitmap_type) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found)
167-
void renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const;
167+
void renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, llwchar wch) const;
168168
void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const;
169169

170170
std::string mName;

indra/llui/llstyle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ LLStyle::Params::Params()
3939
readonly_color("readonly_color", LLColor4::black),
4040
selected_color("selected_color", LLColor4::black),
4141
alpha("alpha", 1.f),
42-
font("font", LLFontGL::getFontMonospace()),
42+
font("font", LLStyle::getDefaultFont()),
4343
image("image"),
4444
link_href("href"),
4545
is_link("is_link")
@@ -87,6 +87,11 @@ const LLFontGL* LLStyle::getFont() const
8787
return mFont;
8888
}
8989

90+
const LLFontGL* LLStyle::getDefaultFont()
91+
{
92+
return LLFontGL::getFontMonospace();
93+
}
94+
9095
void LLStyle::setLinkHREF(const std::string& href)
9196
{
9297
mLink = href;

indra/llui/llstyle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class LLStyle : public LLRefCount
7979

8080
void setFont(const LLFontGL* font);
8181
const LLFontGL* getFont() const;
82+
static const LLFontGL* getDefaultFont();
8283

8384
const std::string& getLinkHREF() const { return mLink; }
8485
void setLinkHREF(const std::string& href);

indra/llui/lltextbase.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,8 @@ void LLTextBase::onVisibilityChange( bool new_visibility )
14611461
//virtual
14621462
void LLTextBase::setValue(const LLSD& value )
14631463
{
1464-
setText(value.asString());
1464+
static const LLStyle::Params input_params = LLStyle::Params();
1465+
setText(value.asString(), input_params);
14651466
}
14661467

14671468
//virtual
@@ -3930,8 +3931,7 @@ bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& w
39303931
if (mForceNewLine)
39313932
{
39323933
// Chat, string can't be smaller then font height even if it is empty
3933-
LLStyleSP s(new LLStyle(LLStyle::Params().visible(true)));
3934-
height = s->getFont()->getLineHeight();
3934+
height = LLStyle::getDefaultFont()->getLineHeight();
39353935

39363936
return true; // new line
39373937
}
@@ -3995,9 +3995,7 @@ void LLInlineViewSegment::linkToDocument(LLTextBase* editor)
39953995

39963996
LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1)
39973997
{
3998-
LLStyleSP s( new LLStyle(LLStyle::Params().visible(true)));
3999-
4000-
mFontHeight = s->getFont()->getLineHeight();
3998+
mFontHeight = LLStyle::getDefaultFont()->getLineHeight();
40013999
}
40024000
LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1)
40034001
{

indra/llui/lltextbox.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ LLSD LLTextBox::getValue() const
159159
bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text )
160160
{
161161
mText.setArg(key, text);
162-
LLTextBase::setText(mText.getString());
162+
static const LLStyle::Params input_params = LLStyle::Params();
163+
LLTextBase::setText(mText.getString(), input_params);
163164

164165
return true;
165166
}

indra/llwindow/llwindowwin32.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "llstring.h"
4646
#include "lldir.h"
4747
#include "llsdutil.h"
48+
#include "llsys.h"
4849
#include "llglslshader.h"
4950
#include "llthreadsafequeue.h"
5051
#include "stringize.h"
@@ -4669,6 +4670,23 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem()
46694670

46704671
// Alternatively use GetDesc from below to get adapter's memory
46714672
UINT64 budget_mb = info.Budget / (1024 * 1024);
4673+
if (gGLManager.mIsIntel)
4674+
{
4675+
U32Megabytes phys_mb = gSysMemory.getPhysicalMemoryKB();
4676+
LL_WARNS() << "Physical memory: " << phys_mb << " MB" << LL_ENDL;
4677+
4678+
if (phys_mb > 0)
4679+
{
4680+
// Intel uses 'shared' vram, cap it to 25% of total memory
4681+
// Todo: consider caping all adapters at least to 50% ram
4682+
budget_mb = llmin(budget_mb, (UINT64)(phys_mb * 0.25));
4683+
}
4684+
else
4685+
{
4686+
// if no data available, cap to 2Gb
4687+
budget_mb = llmin(budget_mb, (UINT64)2048);
4688+
}
4689+
}
46724690
if (gGLManager.mVRAM < (S32)budget_mb)
46734691
{
46744692
gGLManager.mVRAM = (S32)budget_mb;

indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
150150
float amb_da = 0.0;//ambiance;
151151
if (da > 0)
152152
{
153-
lit = max(da * dist_atten,0.0);
153+
lit = clamp(da * dist_atten, 0.0, 1.0);
154154
col = lit * light_col * diffuse;
155155
amb_da += (da*0.5+0.5) * ambiance;
156156
}

0 commit comments

Comments
 (0)