Skip to content

Commit

Permalink
Merge remote-tracking branch 'FS-forever-fps/master' into ExtraFPS_pr…
Browse files Browse the repository at this point in the history
…eview
  • Loading branch information
beqjanus committed Feb 22, 2025
2 parents 358e129 + 097bbc7 commit c331056
Show file tree
Hide file tree
Showing 76 changed files with 1,250 additions and 518 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
needs: setup
strategy:
matrix:
runner: [windows-large, macos-12-large]
runner: [windows-large, macos-15-xlarge]
configuration: ${{ fromJSON(needs.setup.outputs.configurations) }}
runs-on: ${{ matrix.runner }}
outputs:
Expand All @@ -64,7 +64,7 @@ jobs:
# autobuild-package.xml.
AUTOBUILD_VCS_INFO: "true"
AUTOBUILD_VSVER: "170"
DEVELOPER_DIR: "/Applications/Xcode_14.0.1.app/Contents/Developer"
DEVELOPER_DIR: "/Applications/Xcode_16.1.app/Contents/Developer"
# Ensure that Linden viewer builds engage Bugsplat.
BUGSPLAT_DB: ${{ needs.setup.outputs.bugsplat_db }}
build_coverity: false
Expand Down
5 changes: 5 additions & 0 deletions indra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ else()
set( USE_AUTOBUILD_3P ON )
endif()

if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(Variables)
include(BuildVersion)

Expand Down
6 changes: 5 additions & 1 deletion indra/llcommon/fsyspath.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ class fsyspath: public std::filesystem::path
}

// shadow base-class string() method with UTF-8 aware method
std::string string() const { return super::u8string(); }
std::string string() const
{
auto u8 = super::u8string();
return std::string(u8.begin(), u8.end());
}
// On Posix systems, where value_type is already char, this operator
// std::string() method shadows the base class operator string_type()
// method. But on Windows, where value_type is wchar_t, the base class
Expand Down
4 changes: 2 additions & 2 deletions indra/llcommon/llqueuedthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ size_t LLQueuedThread::updateQueue(F32 max_time_ms)
// schedule a call to threadedUpdate for every call to updateQueue
if (!isQuitting())
{
mRequestQueue.post([=]()
mRequestQueue.post([=, this]()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_THREAD("qt - update");
mIdleThread = false;
Expand Down Expand Up @@ -497,7 +497,7 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req)
#else
using namespace std::chrono_literals;
// <FS:Beq> improve retry behaviour
// mRequestQueue.post([=]
// mRequestQueue.post([=, this]
// {
// LL_PROFILE_ZONE_NAMED("processRequest - retry");
// if (LL::WorkQueue::TimePoint::clock::now() < retry_time)
Expand Down
3 changes: 2 additions & 1 deletion indra/llinventory/llsettingssky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ const std::string LLSettingsSky::SETTING_REFLECTION_PROBE_AMBIANCE("reflection_p

const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("651510b8-5f4d-8991-1592-e7eeab2a5a06");

F32 LLSettingsSky::sAutoAdjustProbeAmbiance = 1.f;
const F32 LLSettingsSky::DEFAULT_AUTO_ADJUST_PROBE_AMBIANCE = 1.f;
F32 LLSettingsSky::sAutoAdjustProbeAmbiance = DEFAULT_AUTO_ADJUST_PROBE_AMBIANCE;

static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver
static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
Expand Down
1 change: 1 addition & 0 deletions indra/llinventory/llsettingssky.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class LLSettingsSky: public LLSettingsBase

static const LLUUID DEFAULT_ASSET_ID;

static const F32 DEFAULT_AUTO_ADJUST_PROBE_AMBIANCE;
static F32 sAutoAdjustProbeAmbiance;

typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> ptr_t;
Expand Down
2 changes: 1 addition & 1 deletion indra/llrender/llcubemaparray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
bind(0);
free_cur_tex_image();

U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
U32 format = components == 4 ? GL_RGBA16F : GL_R11F_G11F_B10F;
if (!hdr)
{
format = components == 4 ? GL_RGBA8 : GL_RGB8;
Expand Down
4 changes: 2 additions & 2 deletions indra/llrender/llfontbitmapcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
mBitmapHeight = image_height;

S32 num_components = getNumComponents(bitmap_type);
mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components));
mImageRawVec[bitmap_idx].emplace_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components));
bitmap_num = static_cast<U32>(mImageRawVec[bitmap_idx].size()) - 1;

LLImageRaw* image_raw = getImageRaw(bitmap_type, bitmap_num);
Expand All @@ -117,7 +117,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
}

// Make corresponding GL image.
mImageGLVec[bitmap_idx].push_back(new LLImageGL(image_raw, false, false));
mImageGLVec[bitmap_idx].emplace_back(new LLImageGL(image_raw, false, false));
LLImageGL* image_gl = getImageGL(bitmap_type, bitmap_num);

// Start at beginning of the new image.
Expand Down
2 changes: 1 addition & 1 deletion indra/llrender/llfontfreetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, ll
if (error == FT_Err_Out_Of_Memory)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Out of memory loading glyph for character " << wch << LL_ENDL;
LL_ERRS() << "Out of memory loading glyph for character " << llformat("U+%xu", U32(wch)) << LL_ENDL;
}

std::string message = llformat(
Expand Down
1 change: 1 addition & 0 deletions indra/llrender/llfontfreetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class LLFontFreetype : public LLRefCount

void setStyle(U8 style);
U8 getStyle() const;
S32 getAddedGlyphs() const { return mAddGlyphCount; }

private:
void resetBitmapCache();
Expand Down
22 changes: 21 additions & 1 deletion indra/llrender/llfontgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ F32 LLFontGL::sVertDPI = 96.f;
F32 LLFontGL::sHorizDPI = 96.f;
F32 LLFontGL::sScaleX = 1.f;
F32 LLFontGL::sScaleY = 1.f;
S32 LLFontGL::sResolutionGeneration = 0;
bool LLFontGL::sDisplayFont = true ;
std::string LLFontGL::sAppDir;

Expand Down Expand Up @@ -109,6 +110,11 @@ S32 LLFontGL::getNumFaces(const std::string& filename)
return mFontFreetype->getNumFaces(filename);
}

S32 LLFontGL::getKnownGlyphCount() const
{
return mFontFreetype ? mFontFreetype->getAddedGlyphs() : 0;
}

S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
ShadowType shadow, S32 max_chars, F32* right_x, bool use_ellipses, bool use_color) const
{
Expand Down Expand Up @@ -249,6 +255,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons

const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();

// This looks wrong, value is dynamic.
// LLFontBitmapCache::nextOpenPos can alter these values when
// new characters get added to cache, which affects whole string.
// Todo: Perhaps value should update after symbols were added?
F32 inv_width = 1.f / font_bitmap_cache->getBitmapWidth();
F32 inv_height = 1.f / font_bitmap_cache->getBitmapHeight();

Expand All @@ -270,6 +280,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons

const LLFontGlyphInfo* next_glyph = NULL;

// string can have more than one glyph per char (ex: bold or shadow),
// make sure that GLYPH_BATCH_SIZE won't end up with half a symbol.
// See drawGlyph.
// Ex: with shadows it's 6 glyps per char. 30 fits exactly 5 chars.
static constexpr S32 GLYPH_BATCH_SIZE = 30;
static thread_local LLVector4a vertices[GLYPH_BATCH_SIZE * 6];
static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 6];
Expand All @@ -282,6 +296,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons

std::pair<EFontGlyphType, S32> bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1);
S32 glyph_count = 0;
llwchar last_char = wstr[begin_offset];
for (i = begin_offset; i < begin_offset + length; i++)
{
llwchar wch = wstr[i];
Expand All @@ -299,7 +314,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
}
// Per-glyph bitmap texture.
std::pair<EFontGlyphType, S32> next_bitmap_entry = fgi->mBitmapEntry;
if (next_bitmap_entry != bitmap_entry)
if (next_bitmap_entry != bitmap_entry || last_char != wch)
{
// Actually draw the queued glyphs before switching their texture;
// otherwise the queued glyphs will be taken from wrong textures.
Expand All @@ -317,6 +332,11 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
bitmap_entry = next_bitmap_entry;
LLImageGL* font_image = font_bitmap_cache->getImageGL(bitmap_entry.first, bitmap_entry.second);
gGL.getTexUnit(0)->bind(font_image);

// For some reason it's not enough to compare by bitmap_entry.
// Issue hits emojis, japenese and chinese glyphs, only on first run.
// Todo: figure it out, there might be a bug with raw image data.
last_char = wch;
}

if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
Expand Down
2 changes: 2 additions & 0 deletions indra/llrender/llfontgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class LLFontGL
bool loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n);

S32 getNumFaces(const std::string& filename);
S32 getKnownGlyphCount() const;

S32 render(const LLWString &text, S32 begin_offset,
const LLRect& rect,
Expand Down Expand Up @@ -235,6 +236,7 @@ class LLFontGL
static F32 sHorizDPI;
static F32 sScaleX;
static F32 sScaleY;
static S32 sResolutionGeneration;
static bool sDisplayFont ;
static std::string sAppDir; // For loading fonts

Expand Down
6 changes: 5 additions & 1 deletion indra/llrender/llfontvertexbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ S32 LLFontVertexBuffer::render(
|| mLastScaleY != LLFontGL::sScaleY
|| mLastVertDPI != LLFontGL::sVertDPI
|| mLastHorizDPI != LLFontGL::sHorizDPI
|| mLastOrigin != LLFontGL::sCurOrigin)
|| mLastOrigin != LLFontGL::sCurOrigin
|| mLastResGeneration != LLFontGL::sResolutionGeneration
|| mLastFontGlyphCount != fontp->getKnownGlyphCount())
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
Expand Down Expand Up @@ -201,6 +203,8 @@ void LLFontVertexBuffer::genBuffers(
mLastVertDPI = LLFontGL::sVertDPI;
mLastHorizDPI = LLFontGL::sHorizDPI;
mLastOrigin = LLFontGL::sCurOrigin;
mLastResGeneration = LLFontGL::sResolutionGeneration;
mLastFontGlyphCount = fontp->getKnownGlyphCount();

if (right_x)
{
Expand Down
5 changes: 5 additions & 0 deletions indra/llrender/llfontvertexbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ class LLFontVertexBuffer
F32 mLastScaleY = 1.f;
F32 mLastVertDPI = 0.f;
F32 mLastHorizDPI = 0.f;
S32 mLastResGeneration = 0;
LLCoordGL mLastOrigin;

// Adding new characters to bitmap cache can alter value from getBitmapWidth();
// which alters whole string. So rerender when new characters were added to cache.
S32 mLastFontGlyphCount = 0;

static bool sEnableBufferCollection;
};

Expand Down
1 change: 1 addition & 0 deletions indra/llrender/llglslshader.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class LLShaderFeatures
bool attachNothing = false;
bool hasHeroProbes = false;
bool isPBRTerrain = false;
bool hasTonemap = false;
};

// ============= Structure for caching shader uniforms ===============
Expand Down
16 changes: 16 additions & 0 deletions indra/llrender/llgltexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ LLGLTexture::~LLGLTexture()
void LLGLTexture::init()
{
mBoostLevel = LLGLTexture::BOOST_NONE;
// <FS:minerjr>
// Added a previous boost level to allow for restorign boost after BOOST_SELECTED is applied
mPrevBoostLevel = LLGLTexture::BOOST_NONE;
// </FS:minerjr>

mFullWidth = 0;
mFullHeight = 0;
Expand Down Expand Up @@ -107,6 +111,18 @@ void LLGLTexture::setBoostLevel(S32 level)
}
}

// <FS:minerjr>
// Changes the current boost level to the previous value
void LLGLTexture::restoreBoostLevel()
{
mBoostLevel = mPrevBoostLevel;
}
// Stores the current boost level in a the previous boost.
void LLGLTexture::storeBoostLevel()
{
mPrevBoostLevel = mBoostLevel;
}
// </FS:minerjr>
void LLGLTexture::forceActive()
{
mTextureState = ACTIVE ;
Expand Down
8 changes: 8 additions & 0 deletions indra/llrender/llgltexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class LLGLTexture : public LLTexture

void setBoostLevel(S32 level);
S32 getBoostLevel() { return mBoostLevel; }
// <FS:minerjr>
void restoreBoostLevel(); // Now restores the mBoostLevel with the mPrevBoostLevel
void storeBoostLevel(); // Stores the current mBoostLevel in mPrevBoostLevel
// </FS:minerjr>

S32 getFullWidth() const { return mFullWidth; }
S32 getFullHeight() const { return mFullHeight; }
Expand Down Expand Up @@ -183,6 +187,10 @@ class LLGLTexture : public LLTexture

protected:
S32 mBoostLevel; // enum describing priority level
// <FS:minerjr>
// Added previous value to allow for restoring of BOOST_SELECTED overriding current state
S32 mPrevBoostLevel; // enum describing priority level (Previous Value for BOOST_SELECTION restore)
// </FS:minerjr>
U32 mFullWidth;
U32 mFullHeight;
bool mUseMipMaps;
Expand Down
3 changes: 2 additions & 1 deletion indra/llrender/llimagegl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
case GL_RGB: return 24;
case GL_SRGB: return 24;
case GL_RGB8: return 24;
case GL_R11F_G11F_B10F: return 32;
case GL_RGBA: return 32;
case GL_RGBA8: return 32;
case GL_RGB10_A2: return 32;
Expand Down Expand Up @@ -1773,7 +1774,7 @@ void LLImageGL::syncToMainThread(LLGLuint new_tex_name)
ref();
LL::WorkQueue::postMaybe(
mMainQueue,
[=]()
[=, this]()
{
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("cglt - delete callback");
syncTexName(new_tex_name);
Expand Down
9 changes: 9 additions & 0 deletions indra/llrender/llshadermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
}
}

if (features->hasTonemap)
{
if (!shader->attachFragmentObject("deferred/tonemapUtilF.glsl"))
{
return false;
}
}

// NOTE order of shader object attaching is VERY IMPORTANT!!!
if (features->hasAtmospherics)
{
Expand Down Expand Up @@ -1402,6 +1410,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("screenTex");
mReservedUniforms.push_back("screenDepth");
mReservedUniforms.push_back("refTex");
mReservedUniforms.push_back("exclusionTex");
mReservedUniforms.push_back("eyeVec");
mReservedUniforms.push_back("time");
mReservedUniforms.push_back("waveDir1");
Expand Down
3 changes: 3 additions & 0 deletions indra/llrender/llshadermgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class LLShaderMgr
LLShaderMgr();
virtual ~LLShaderMgr();

// Note: although you can use statically hashed strings to just bind a random uniform, it's generally preferably that you use this.
// Always document what the actual shader uniform is next to the shader uniform in this struct.
// clang-format off
typedef enum
{ // Shader uniform name, set in LLShaderMgr::initAttribsAndUniforms()
Expand Down Expand Up @@ -238,6 +240,7 @@ class LLShaderMgr
WATER_SCREENTEX, // "screenTex"
WATER_SCREENDEPTH, // "screenDepth"
WATER_REFTEX, // "refTex"
WATER_EXCLUSIONTEX, // "exclusionTex"
WATER_EYEVEC, // "eyeVec"
WATER_TIME, // "time"
WATER_WAVE_DIR1, // "waveDir1"
Expand Down
Loading

0 comments on commit c331056

Please sign in to comment.