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

# Conflicts:
#	indra/newview/llviewercontrol.cpp
#	indra/newview/skins/default/xui/en/notifications.xml
master
Ansariel 2024-12-15 21:44:14 +01:00
commit c53bc7e74f
18 changed files with 147 additions and 103 deletions

View File

@ -55,7 +55,7 @@ void* ll_tracy_new(size_t size)
{
throw std::bad_alloc();
}
TracyAlloc(ptr, size);
LL_PROFILE_ALLOC(ptr, size);
return ptr;
}
@ -71,7 +71,7 @@ void* operator new[](std::size_t count)
void ll_tracy_delete(void* ptr)
{
TracyFree(ptr);
LL_PROFILE_FREE(ptr);
if (gProfilerEnabled)
{
//LL_PROFILE_ZONE_SCOPED_CATEGORY_MEMORY;
@ -103,13 +103,13 @@ void operator delete[](void* ptr) noexcept
void *tracy_aligned_malloc(size_t size, size_t alignment)
{
auto ptr = ll_aligned_malloc_fallback(size, alignment);
if (ptr) TracyAlloc(ptr, size);
if (ptr) LL_PROFILE_ALLOC(ptr, size);
return ptr;
}
void tracy_aligned_free(void *memblock)
{
TracyFree(memblock);
LL_PROFILE_FREE(memblock);
ll_aligned_free_fallback(memblock);
}

View File

@ -222,7 +222,7 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r
ll_aligned_free_16(ptr);
}
#endif
LL_PROFILE_ALLOC(ptr, size);
LL_PROFILE_ALLOC(ret, size);
return ret;
}

View File

@ -5208,7 +5208,10 @@ bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a
void LLVolumeFace::remap()
{
// Generate a remap buffer
std::vector<unsigned int> remap(mNumVertices);
// Documentation for meshopt_generateVertexRemapMulti claims that remap should use vertice count
// but all examples use indice count. There are out of bounds crashes when using vertice count.
// To be on the safe side use bigger of the two.
std::vector<unsigned int> remap(llmax(mNumIndices, mNumVertices));
S32 remap_vertices_count = static_cast<S32>(LLMeshOptimizer::generateRemapMultiU16(&remap[0],
mIndices,
mNumIndices,

View File

@ -1052,7 +1052,7 @@ U32 type_width_from_pixtype(U32 pixtype)
bool should_stagger_image_set(bool compressed)
{
#if LL_DARWIN
return false;
return !compressed && on_main_thread() && gGLManager.mIsAMD;
#else
// glTexSubImage2D doesn't work with compressed textures on select tested Nvidia GPUs on Windows 10 -Cosmic,2023-03-08
// Setting media textures off-thread seems faster when not using sub_image_lines (Nvidia/Windows 10) -Cosmic,2023-03-31
@ -1270,37 +1270,37 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures)
}
}
constexpr int DELETE_DELAY = 3; // number of frames to wait before deleting textures
static std::vector<U32> sFreeList[DELETE_DELAY+1];
// static
void LLImageGL::updateClass()
{
sFrameCount++;
// wait a few frames before actually deleting the textures to avoid
// synchronization issues with the GPU
U32 idx = (sFrameCount+DELETE_DELAY) % (DELETE_DELAY+1);
if (!sFreeList[idx].empty())
{
free_tex_images((GLsizei) sFreeList[idx].size(), sFreeList[idx].data());
glDeleteTextures((GLsizei)sFreeList[idx].size(), sFreeList[idx].data());
sFreeList[idx].resize(0);
}
}
// static
void LLImageGL::deleteTextures(S32 numTextures, const U32 *textures)
{
// wait a few frames before actually deleting the textures to avoid
// synchronization issues with the GPU
static std::vector<U32> sFreeList[4];
if (gGLManager.mInited)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
U32 idx = sFrameCount % 4;
U32 idx = sFrameCount % (DELETE_DELAY+1);
for (S32 i = 0; i < numTextures; ++i)
{
sFreeList[idx].push_back(textures[i]);
}
idx = (sFrameCount + 3) % 4;
if (!sFreeList[idx].empty())
{
free_tex_images((GLsizei) sFreeList[idx].size(), sFreeList[idx].data());
glDeleteTextures((GLsizei)sFreeList[idx].size(), sFreeList[idx].data());
sFreeList[idx].resize(0);
}
}
}

View File

@ -79,7 +79,7 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
//////////////////////////////////////
// NOTE order of shader object attaching is VERY IMPORTANT!!!
if (features->calculatesAtmospherics)
if (features->calculatesAtmospherics || features->hasGamma || features->isDeferred)
{
if (!shader->attachVertexObject("windlight/atmosphericsVarsV.glsl"))
{

View File

@ -72,6 +72,41 @@ namespace
bool LLWindowMacOSX::sUseMultGL = false;
//static
void LLWindowMacOSX::setUseMultGL(bool use_mult_gl)
{
bool was_enabled = sUseMultGL;
sUseMultGL = use_mult_gl;
if (gGLManager.mInited)
{
CGLContextObj ctx = CGLGetCurrentContext();
//enable multi-threaded OpenGL (whether or not sUseMultGL actually changed)
if (sUseMultGL)
{
CGLError cgl_err;
cgl_err = CGLEnable( ctx, kCGLCEMPEngine);
if (cgl_err != kCGLNoError )
{
LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
sUseMultGL = false;
}
else
{
LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
}
}
else if (was_enabled)
{
CGLDisable( ctx, kCGLCEMPEngine);
LL_INFOS("GLInit") << "Multi-threaded OpenGL disabled." << LL_ENDL;
}
}
}
// Cross-platform bits:
bool check_for_card(const char* RENDERER, const char* bad_card)
@ -713,23 +748,8 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
// Disable vertical sync for swap
toggleVSync(enable_vsync);
//enable multi-threaded OpenGL
if (sUseMultGL)
{
CGLError cgl_err;
CGLContextObj ctx = CGLGetCurrentContext();
setUseMultGL(sUseMultGL);
cgl_err = CGLEnable( ctx, kCGLCEMPEngine);
if (cgl_err != kCGLNoError )
{
LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
}
else
{
LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
}
}
makeFirstResponder(mWindow, mGLView);
return true;

View File

@ -149,6 +149,9 @@ public:
void toggleVSync(bool enable_vsync) override;
// enable or disable multithreaded GL
static void setUseMultGL(bool use_mult_gl);
protected:
LLWindowMacOSX(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,

View File

@ -1,4 +1,4 @@
version 68
version 71
// The version number above should be incremented IF AND ONLY IF some
// change has been made that is sufficiently important to justify
// resetting the graphics preferences of all users to the recommended
@ -67,9 +67,9 @@ RenderFSAAType 1 2
RenderFSAASamples 1 3
RenderMaxTextureIndex 1 16
RenderGLContextCoreProfile 1 1
RenderGLMultiThreadedTextures 1 0
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
RenderGLMultiThreadedTextures 1 1
RenderGLMultiThreadedMedia 1 1
RenderAppleUseMultGL 1 1
RenderReflectionsEnabled 1 1
RenderReflectionProbeDetail 1 2
RenderScreenSpaceReflections 1 1
@ -111,7 +111,7 @@ RenderShadowDetail 1 0
WLSkyDetail 1 96
RenderFSAAType 1 0
RenderFSAASamples 1 0
RenderReflectionsEnabled 1 1
RenderReflectionsEnabled 1 0
RenderReflectionProbeDetail 1 0
RenderScreenSpaceReflections 1 0
RenderReflectionProbeLevel 1 0
@ -405,20 +405,30 @@ list TexUnit16orLess
RenderTerrainPBRDetail 1 -1
list AMD
RenderDeferredSSAO 1 0
UseOcclusion 1 0
RenderGLMultiThreadedTextures 1 0
list NVIDIA
RenderGLMultiThreadedTextures 1 0
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
list Intel
RenderAnisotropic 1 0
RenderFSAASamples 1 0
RenderGLMultiThreadedTextures 1 0
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
// AppleGPU and NonAppleGPU can be thought of as Apple silicon vs Intel Mac
list AppleGPU
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
RenderGLMultiThreadedTextures 1 0
RenderGLMultiThreadedMedia 1 0
list NonAppleGPU
RenderGLMultiThreadedMedia 1 0
RenderAppleUseMultGL 1 0
RenderDeferredSSAO 1 0
list GL3
RenderFSAASamples 0 0

View File

@ -2552,7 +2552,12 @@ bool LLAppViewer::initThreads()
// get the number of concurrent threads that can run
S32 cores = std::thread::hardware_concurrency();
#if LL_DARWIN
if (!gGLManager.mIsApple)
{
cores /= 2;
}
#endif
U32 max_cores = gSavedSettings.getU32("EmulateCoreCount");
if (max_cores != 0)
{

View File

@ -2335,8 +2335,14 @@ LLPanelEstateInfo::LLPanelEstateInfo()
mEstateID(0) // invalid
{
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
mEstateInfoCommitConnection = estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
mEstateInfoUpdateConnection = estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
}
LLPanelEstateInfo::~LLPanelEstateInfo()
{
mEstateInfoCommitConnection.disconnect();
mEstateInfoUpdateConnection.disconnect();
}
// static

View File

@ -350,7 +350,7 @@ public:
bool onMessageCommit(const LLSD& notification, const LLSD& response);
LLPanelEstateInfo();
~LLPanelEstateInfo() {}
~LLPanelEstateInfo();
void updateControls(LLViewerRegion* region);
@ -382,6 +382,8 @@ protected:
bool checkSunHourSlider(LLUICtrl* child_ctrl);
U32 mEstateID;
boost::signals2::connection mEstateInfoCommitConnection;
boost::signals2::connection mEstateInfoUpdateConnection;
};
/////////////////////////////////////////////////////////////////////////////

View File

@ -359,12 +359,14 @@ void LLPanelEnvironmentInfo::refresh()
void LLPanelEnvironmentInfo::refreshFromEstate()
{
LLViewerRegion *pRegion = gAgent.getRegion();
bool oldAO = mAllowOverride;
mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride();
if (oldAO != mAllowOverride)
refresh();
LLViewerRegion* pRegion = gAgent.getRegion();
if (pRegion)
{
bool oldAO = mAllowOverride;
mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride();
if (oldAO != mAllowOverride)
refresh();
}
}
std::string LLPanelEnvironmentInfo::getNameForTrackIndex(U32 index)

View File

@ -404,6 +404,13 @@ void LLReflectionMapManager::update()
{
closestDynamic = probe;
}
if (sLevel == 0)
{
// only update default probe when coverage is set to none
llassert(probe == mDefaultProbe);
break;
}
}
if (realtime && closestDynamic != nullptr)
@ -713,6 +720,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
}
else
{
llassert(gSavedSettings.getS32("RenderReflectionProbeLevel") > 0); // should never update a probe that's not the default probe if reflection coverage is none
probe->update(mRenderTarget.getWidth(), face);
}

View File

@ -2396,11 +2396,15 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
// Update material locally
objectp->setRenderMaterialID(te, asset_id, false /*wait for LLGLTFMaterialList update*/);
LLGLTFMaterial* material = new LLGLTFMaterial(*nodep->mSavedGLTFOverrideMaterials[te]);
objectp->setTEGLTFMaterialOverride(te, material);
LLGLTFMaterial* material = nodep->mSavedGLTFOverrideMaterials[te];
if (material)
{
material = new LLGLTFMaterial(*material);
objectp->setTEGLTFMaterialOverride(te, material);
}
// Enqueue update to server
if (asset_id.notNull())
if (asset_id.notNull() && material)
{
// Restore overrides and base material
LLGLTFMaterialList::queueApply(objectp, te, asset_id, material);

View File

@ -1464,9 +1464,10 @@ void LLToolDragAndDrop::dropTexture(LLViewerObject* hit_obj,
}
LLTextureEntry* te = hit_obj->getTE(hit_face);
if (te && !remove_pbr)
LLGLTFMaterial * override_mat = nullptr;
if (te && !remove_pbr && (override_mat = te->getGLTFMaterialOverride()))
{
LLGLTFMaterial* copy = new LLGLTFMaterial(*te->getGLTFMaterialOverride());
LLGLTFMaterial* copy = new LLGLTFMaterial(*override_mat);
nodep->mSavedGLTFOverrideMaterials[hit_face] = copy;
}
else

View File

@ -92,6 +92,10 @@
#include "rlvcommon.h"
// [/RLVa:KB]
#if LL_DARWIN
#include "llwindowmacosx.h"
#endif
// Firestorm inclues
#include "fsfloatercontacts.h"
#include "fsfloaterim.h"
@ -580,6 +584,17 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue)
return true;
}
#if LL_DARWIN
static bool handleAppleUseMultGLChanged(const LLSD& newvalue)
{
if (gGLManager.mInited)
{
LLWindowMacOSX::setUseMultGL(newvalue.asBoolean());
}
return true;
}
#endif
static bool handleHeroProbeResolutionChanged(const LLSD &newvalue)
{
if (gPipeline.isInit())
@ -1301,6 +1316,9 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeLevel", handleReflectionProbeDetailChanged);
setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged);
// setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionsEnabled); // <FS:Beq/> FIRE-33659 better way to enable/disable reflections
#if LL_DARWIN
setting_setup_signal_listener(gSavedSettings, "RenderAppleUseMultGL", handleAppleUseMultGLChanged);
#endif
setting_setup_signal_listener(gSavedSettings, "RenderScreenSpaceReflections", handleReflectionProbeDetailChanged);
setting_setup_signal_listener(gSavedSettings, "RenderMirrors", handleReflectionProbeDetailChanged);
setting_setup_signal_listener(gSavedSettings, "RenderHeroProbeResolution", handleHeroProbeResolutionChanged);

View File

@ -6593,6 +6593,8 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
camera->setUserClipPlane(clipPlane);
}
gPipeline.pushRenderTypeMask();
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
U32 dynamic_render_types[] = {
@ -6681,16 +6683,7 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
}
}
if (!dynamic_render)
{
for (int i = 0; i < dynamic_render_type_count; ++i)
{
if (prev_dynamic_render_type[i])
{
gPipeline.toggleRenderType(dynamic_render_types[i]);
}
}
}
gPipeline.popRenderTypeMask();
if (hide_hud)
{

View File

@ -14514,37 +14514,6 @@ This will replace the items in the selected outfit with the items you are wearin
yestext="OK"/>
</notification>
<notification
icon="notify.tga"
name="TextureDiscardBackgrounded"
type="notify">
<unique>
<context>DELAY</context>
</unique>
To improve system performance, [APP_NAME] has reduced texture memory usage after being in the background for [DELAY] seconds. It may take some time for texture image quality to return to normal.
<usetemplate
ignoretext="Ask me about background texture memory usage and recovery"
name="okcancelignore"
yestext="OK"
notext="Disable"/>
</notification>
<notification
icon="notify.tga"
name="TextureDiscardMinimized"
type="notify">
<unique>
<context>DELAY</context>
</unique>
To improve system performance, [APP_NAME] has reduced texture memory usage after being minimized for [DELAY] seconds. It may take some time for texture image quality to return to normal.
<usetemplate
ignoretext="Ask me about minimized texture memory usage and recovery"
name="okcancelignore"
yestext="OK"
notext="Disable"/>
</notification>
<notification
icon="alertmodal.tga"
name="EnableAutoFPSWarning"