Merge branch 'release/2024.09-ExtraFPS' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llrender/llimagegl.cpp
#	indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
master
Ansariel 2024-10-22 23:39:09 +02:00
commit 668bf8e52c
6 changed files with 61 additions and 69 deletions

View File

@ -239,15 +239,15 @@ void LLSettingsWater::blend(LLSettingsBase::ptr_t &end, F64 blendf)
{ {
mSettingFlags |= other->mSettingFlags; mSettingFlags |= other->mSettingFlags;
mBlurMultiplier = lerp((F32)blendf, mBlurMultiplier, other->mBlurMultiplier); mBlurMultiplier = lerp(mBlurMultiplier, other->mBlurMultiplier, (F32)blendf);
lerpColor(mWaterFogColor, other->mWaterFogColor, (F32)blendf); lerpColor(mWaterFogColor, other->mWaterFogColor, (F32)blendf);
mWaterFogDensity = lerp((F32)blendf, mWaterFogDensity, other->mWaterFogDensity); mWaterFogDensity = lerp(mWaterFogDensity, other->mWaterFogDensity, (F32)blendf);
mFogMod = lerp((F32)blendf, mFogMod, other->mFogMod); mFogMod = lerp(mFogMod, other->mFogMod, (F32)blendf);
mFresnelOffset = lerp((F32)blendf, mFresnelOffset, other->mFresnelOffset); mFresnelOffset = lerp(mFresnelOffset, other->mFresnelOffset, (F32)blendf);
mFresnelScale = lerp((F32)blendf, mFresnelScale, other->mFresnelScale); mFresnelScale = lerp(mFresnelScale, other->mFresnelScale, (F32)blendf);
lerpVector3(mNormalScale, other->mNormalScale, (F32)blendf); lerpVector3(mNormalScale, other->mNormalScale, (F32)blendf);
mScaleAbove = lerp((F32)blendf, mScaleAbove, other->mScaleAbove); mScaleAbove = lerp(mScaleAbove, other->mScaleAbove, (F32)blendf);
mScaleBelow = lerp((F32)blendf, mScaleBelow, other->mScaleBelow); mScaleBelow = lerp(mScaleBelow, other->mScaleBelow, (F32)blendf);
lerpVector2(mWave1Dir, other->mWave1Dir, (F32)blendf); lerpVector2(mWave1Dir, other->mWave1Dir, (F32)blendf);
lerpVector2(mWave2Dir, other->mWave2Dir, (F32)blendf); lerpVector2(mWave2Dir, other->mWave2Dir, (F32)blendf);

View File

@ -51,6 +51,7 @@ extern LL_COMMON_API bool on_main_thread();
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const F32 MIN_TEXTURE_LIFETIME = 10.f; const F32 MIN_TEXTURE_LIFETIME = 10.f;
const F32 CONVERSION_SCRATCH_BUFFER_GL_VERSION = 3.29f;
//which power of 2 is i? //which power of 2 is i?
//assumes i is a power of 2 > 0 //assumes i is a power of 2 > 0
@ -160,6 +161,7 @@ S32 LLImageGL::sMaxCategories = 1 ;
bool LLImageGL::sSkipAnalyzeAlpha; bool LLImageGL::sSkipAnalyzeAlpha;
U32 LLImageGL::sScratchPBO = 0; U32 LLImageGL::sScratchPBO = 0;
U32 LLImageGL::sScratchPBOSize = 0; U32 LLImageGL::sScratchPBOSize = 0;
U32* LLImageGL::sManualScratch = nullptr;
//------------------------ //------------------------
@ -262,6 +264,22 @@ void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyz
} }
} }
void LLImageGL::allocateConversionBuffer()
{
if (gGLManager.mGLVersion < CONVERSION_SCRATCH_BUFFER_GL_VERSION)
{
try
{
sManualScratch = new U32[MAX_IMAGE_AREA];
}
catch (std::bad_alloc&)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate sManualScratch" << LL_ENDL;
}
}
}
//static //static
void LLImageGL::cleanupClass() void LLImageGL::cleanupClass()
{ {
@ -273,6 +291,8 @@ void LLImageGL::cleanupClass()
sScratchPBO = 0; sScratchPBO = 0;
sScratchPBOSize = 0; sScratchPBOSize = 0;
} }
delete[] sManualScratch;
} }
@ -1287,11 +1307,10 @@ void LLImageGL::deleteTextures(S32 numTextures, const U32 *textures)
void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void* pixels, bool allow_compression) void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void* pixels, bool allow_compression)
{ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
std::unique_ptr<U32[]> scratch;
if (LLRender::sGLCoreProfile) if (LLRender::sGLCoreProfile)
{ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
if (gGLManager.mGLVersion >= 3.29f) if (gGLManager.mGLVersion >= CONVERSION_SCRATCH_BUFFER_GL_VERSION)
{ {
if (pixformat == GL_ALPHA) if (pixformat == GL_ALPHA)
{ //GL_ALPHA is deprecated, convert to RGBA { //GL_ALPHA is deprecated, convert to RGBA
@ -1323,30 +1342,15 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
{ //GL_ALPHA is deprecated, convert to RGBA { //GL_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr) if (pixels != nullptr)
{ {
try
{
scratch.reset(new U32[width * height]);
}
catch (std::bad_alloc)
{
LLError::LLUserWarningMsg::showOutOfMemory();
// <FS:Beq> FIRE-34374 - OOM Crash 80% of which are in render debug text
//LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
LL_WARNS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height
<< " Pixformat: GL_ALPHA, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL;
return;
}
U32 pixel_count = (U32)(width * height); U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++) for (U32 i = 0; i < pixel_count; i++)
{ {
U8* pix = (U8*)&scratch[i]; U8* pix = (U8*)&sManualScratch[i];
pix[0] = pix[1] = pix[2] = 0; pix[0] = pix[1] = pix[2] = 0;
pix[3] = ((U8*)pixels)[i]; pix[3] = ((U8*)pixels)[i];
} }
pixels = scratch.get(); pixels = sManualScratch;
} }
pixformat = GL_RGBA; pixformat = GL_RGBA;
@ -1357,33 +1361,18 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA { //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
if (pixels != nullptr) if (pixels != nullptr)
{ {
try
{
scratch.reset(new U32[width * height]);
}
catch (std::bad_alloc)
{
LLError::LLUserWarningMsg::showOutOfMemory();
// <FS:Beq> FIRE-34374 - OOM Crash 80% of which are in render debug text
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
LL_WARNS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height
<< " Pixformat: GL_LUMINANCE_ALPHA, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL;
return;
}
U32 pixel_count = (U32)(width * height); U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++) for (U32 i = 0; i < pixel_count; i++)
{ {
U8 lum = ((U8*)pixels)[i * 2 + 0]; U8 lum = ((U8*)pixels)[i * 2 + 0];
U8 alpha = ((U8*)pixels)[i * 2 + 1]; U8 alpha = ((U8*)pixels)[i * 2 + 1];
U8* pix = (U8*)&scratch[i]; U8* pix = (U8*)&sManualScratch[i];
pix[0] = pix[1] = pix[2] = lum; pix[0] = pix[1] = pix[2] = lum;
pix[3] = alpha; pix[3] = alpha;
} }
pixels = scratch.get(); pixels = sManualScratch;
} }
pixformat = GL_RGBA; pixformat = GL_RGBA;
@ -1394,32 +1383,17 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB { //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
if (pixels != nullptr) if (pixels != nullptr)
{ {
try
{
scratch.reset(new U32[width * height]);
}
catch (std::bad_alloc)
{
LLError::LLUserWarningMsg::showOutOfMemory();
// <FS:Beq> FIRE-34374 - OOM Crash 80% of which are in render debug text
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
LL_WARNS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height
<< " Pixformat: GL_LUMINANCE, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL;
return;
}
U32 pixel_count = (U32)(width * height); U32 pixel_count = (U32)(width * height);
for (U32 i = 0; i < pixel_count; i++) for (U32 i = 0; i < pixel_count; i++)
{ {
U8 lum = ((U8*)pixels)[i]; U8 lum = ((U8*)pixels)[i];
U8* pix = (U8*)&scratch[i]; U8* pix = (U8*)&sManualScratch[i];
pix[0] = pix[1] = pix[2] = lum; pix[0] = pix[1] = pix[2] = lum;
pix[3] = 255; pix[3] = 255;
} }
pixels = scratch.get(); pixels = sManualScratch;
} }
pixformat = GL_RGBA; pixformat = GL_RGBA;
intformat = GL_RGB8; intformat = GL_RGB8;

View File

@ -301,6 +301,7 @@ public:
public: public:
static void initClass(LLWindow* window, S32 num_catagories, bool skip_analyze_alpha = false, bool thread_texture_loads = false, bool thread_media_updates = false); static void initClass(LLWindow* window, S32 num_catagories, bool skip_analyze_alpha = false, bool thread_texture_loads = false, bool thread_media_updates = false);
static void allocateConversionBuffer();
static void cleanupClass() ; static void cleanupClass() ;
private: private:
@ -308,6 +309,7 @@ private:
static bool sSkipAnalyzeAlpha; static bool sSkipAnalyzeAlpha;
static U32 sScratchPBO; static U32 sScratchPBO;
static U32 sScratchPBOSize; static U32 sScratchPBOSize;
static U32* sManualScratch;
//the flag to allow to call readBackRaw(...). //the flag to allow to call readBackRaw(...).
//can be removed if we do not use that function at all. //can be removed if we do not use that function at all.

View File

@ -12552,7 +12552,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key> <key>Type</key>
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>1</real> <real>1.5</real>
</map> </map>
<key>RenderReflectionProbeDrawDistance</key> <key>RenderReflectionProbeDrawDistance</key>
@ -13414,7 +13414,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key> <key>Type</key>
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>1.0</real> <real>0.7</real>
</map> </map>
<key>RenderTonemapType</key> <key>RenderTonemapType</key>
<map> <map>
@ -13425,7 +13425,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key> <key>Type</key>
<string>U32</string> <string>U32</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>1</integer>
</map> </map>
<key>ReplaySession</key> <key>ReplaySession</key>
<map> <map>

View File

@ -48,6 +48,7 @@
#include "llappviewer.h" #include "llappviewer.h"
#include "llcallbacklist.h" #include "llcallbacklist.h"
#include "llviewercontrol.h"
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
#include "llinventorymodel.h" #include "llinventorymodel.h"
@ -939,19 +940,29 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay()
S32Hours hourofday(secondofday); S32Hours hourofday(secondofday);
S32Seconds secondofhour(secondofday - hourofday); S32Seconds secondofhour(secondofday - hourofday);
S32Minutes minutesofhour(secondofhour); S32Minutes minutesofhour(secondofhour);
static bool use_24h = gSavedSettings.getBOOL("Use24HourClock");
bool am_pm(hourofday.value() >= 12); bool am_pm(hourofday.value() >= 12);
if (hourofday.value() < 1) if (!use_24h)
hourofday = S32Hours(12); {
if (hourofday.value() > 12) if (hourofday.value() < 1)
hourofday -= S32Hours(12); hourofday = S32Hours(12);
if (hourofday.value() > 12)
hourofday -= S32Hours(12);
}
std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString()); std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString());
mLabelApparentTime->setTextArg("[HH]", LLSD(hourofday.value()).asString()); mLabelApparentTime->setTextArg("[HH]", LLSD(hourofday.value()).asString());
mLabelApparentTime->setTextArg("[MM]", lblminute); mLabelApparentTime->setTextArg("[MM]", lblminute);
mLabelApparentTime->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); if (use_24h)
{
mLabelApparentTime->setTextArg("[AP]", std::string());
}
else
{
mLabelApparentTime->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM"));
}
mLabelApparentTime->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); mLabelApparentTime->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString());
} }

View File

@ -2043,6 +2043,11 @@ LLViewerWindow::LLViewerWindow(const Params& p)
} }
LLFontManager::initClass(); LLFontManager::initClass();
// fonts use an GL_UNSIGNED_BYTE image format,
// so they need convertion, init buffers if needed
LLImageGL::allocateConversionBuffer();
// Init font system, load default fonts and generate basic glyphs // Init font system, load default fonts and generate basic glyphs
// currently it takes aprox. 0.5 sec and we would load these fonts anyway // currently it takes aprox. 0.5 sec and we would load these fonts anyway
// before login screen. // before login screen.