summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-09-10 16:12:38 -0700
committerBrad Linden <brad@lindenlab.com>2024-09-10 16:12:38 -0700
commit13e74a32871c7c8f7c7556c6fc08150fc6f27876 (patch)
tree240ae7434ad3f0701bac6f0f4f0a1b99cc16857a
parentce23e4a0c3e1e408afaef20887b619241225a8d2 (diff)
parent94453aecc352613f52fec0e59b23230314cffb32 (diff)
Merge remote-tracking branch 'origin/release/2024.08-DeltaFPS' into develop
-rw-r--r--indra/newview/llglsandbox.cpp53
-rwxr-xr-xindra/newview/llviewerregion.cpp11
-rw-r--r--indra/newview/llviewershadermgr.cpp89
-rw-r--r--indra/newview/llwearablelist.cpp17
4 files changed, 79 insertions, 91 deletions
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 930a8c28d9..0248f5710f 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -1121,57 +1121,6 @@ F32 gpu_benchmark()
LLGLSLShader::unbind();
- F32 time_passed = 0; // seconds
-
- { //run CPU timer benchmark
- glFinish();
- gBenchmarkProgram.bind();
- for (S32 c = -1; c < samples && time_passed < time_limit; ++c)
- {
- LLTimer timer;
- timer.start();
-
- for (U32 i = 0; i < count; ++i)
- {
- dest[i].bindTarget();
- texHolder.bind(i);
- buff->setBuffer();
- buff->drawArrays(LLRender::TRIANGLES, 0, 3);
- dest[i].flush();
- }
-
- //wait for current batch of copies to finish
- glFinish();
-
- F32 time = timer.getElapsedTimeF32();
- time_passed += time;
-
- if (c >= 0) // <-- ignore the first sample as it tends to be artificially slow
- {
- //store result in gigabytes per second
- F32 gb = (F32)((F64)(res * res * 8 * count)) / (1000000000);
- F32 gbps = gb / time;
- results.push_back(gbps);
- }
- }
- gBenchmarkProgram.unbind();
- }
-
- std::sort(results.begin(), results.end());
-
- F32 gbps = results[results.size()/2];
-
- LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to CPU timers, " << (F32)results.size() << " tests took " << time_passed << " seconds" << LL_ENDL;
-
-#if LL_DARWIN
- if (gbps > 512.f)
- {
- LL_WARNS("Benchmark") << "Memory bandwidth is improbably high and likely incorrect; discarding result." << LL_ENDL;
- //OSX is probably lying, discard result
- return -1.f;
- }
-#endif
-
// run GPU timer benchmark
{
ShaderProfileHelper initProfile;
@@ -1196,7 +1145,7 @@ F32 gpu_benchmark()
F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
F64 gpixels_drawn = samples_drawn / 1000000000.0;
F32 samples_sec = (F32)(gpixels_drawn/seconds);
- gbps = samples_sec*4; // 4 bytes per sample
+ F32 gbps = samples_sec*4; // 4 bytes per sample
LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 71add76dd2..d59dfb88a8 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2489,7 +2489,16 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
if (features.has("GLTFEnabled"))
{
bool enabled = features["GLTFEnabled"];
- gSavedSettings.setBOOL("GLTFEnabled", enabled);
+
+ // call setShaders the first time GLTFEnabled is received as true (causes GLTF specific shaders to be loaded)
+ if (enabled != gSavedSettings.getBOOL("GLTFEnabled"))
+ {
+ gSavedSettings.setBOOL("GLTFEnabled", enabled);
+ if (enabled)
+ {
+ LLViewerShaderMgr::instance()->setShaders();
+ }
+ }
}
else
{
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index a446be8b58..58b541b19b 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -439,13 +439,20 @@ void LLViewerShaderMgr::finalizeShaderList()
mShaderList.push_back(&gDeferredDiffuseProgram);
mShaderList.push_back(&gDeferredBumpProgram);
mShaderList.push_back(&gDeferredPBROpaqueProgram);
- mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram);
+
+ if (gSavedSettings.getBOOL("GLTFEnabled"))
+ {
+ mShaderList.push_back(&gGLTFPBRMetallicRoughnessProgram);
+ }
+
mShaderList.push_back(&gDeferredAvatarProgram);
mShaderList.push_back(&gDeferredTerrainProgram);
+
for (U32 paint_type = 0; paint_type < TERRAIN_PAINT_TYPE_COUNT; ++paint_type)
{
mShaderList.push_back(&gDeferredPBRTerrainProgram[paint_type]);
}
+
mShaderList.push_back(&gDeferredDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredNonIndexedDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredTreeProgram);
@@ -1340,26 +1347,29 @@ bool LLViewerShaderMgr::loadShadersDeferred()
llassert(success);
}
- if (success)
+ if (gSavedSettings.getBOOL("GLTFEnabled"))
{
- gGLTFPBRMetallicRoughnessProgram.mName = "GLTF PBR Metallic Roughness Shader";
- gGLTFPBRMetallicRoughnessProgram.mFeatures.hasSrgb = true;
+ if (success)
+ {
+ gGLTFPBRMetallicRoughnessProgram.mName = "GLTF PBR Metallic Roughness Shader";
+ gGLTFPBRMetallicRoughnessProgram.mFeatures.hasSrgb = true;
- gGLTFPBRMetallicRoughnessProgram.mShaderFiles.clear();
- gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessV.glsl", GL_VERTEX_SHADER));
- gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessF.glsl", GL_FRAGMENT_SHADER));
- gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gGLTFPBRMetallicRoughnessProgram.clearPermutations();
+ gGLTFPBRMetallicRoughnessProgram.mShaderFiles.clear();
+ gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessV.glsl", GL_VERTEX_SHADER));
+ gGLTFPBRMetallicRoughnessProgram.mShaderFiles.push_back(make_pair("gltf/pbrmetallicroughnessF.glsl", GL_FRAGMENT_SHADER));
+ gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ gGLTFPBRMetallicRoughnessProgram.clearPermutations();
- success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
+ success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
- //llassert(success);
- if (!success)
- {
- LL_WARNS() << "Failed to create GLTF PBR Metallic Roughness Shader, disabling!" << LL_ENDL;
- gSavedSettings.setBOOL("RenderCanUseGLTFPBROpaqueShaders", false);
- // continue as if this shader never happened
- success = true;
+ //llassert(success);
+ if (!success)
+ {
+ LL_WARNS() << "Failed to create GLTF PBR Metallic Roughness Shader, disabling!" << LL_ENDL;
+ gSavedSettings.setBOOL("RenderCanUseGLTFPBROpaqueShaders", false);
+ // continue as if this shader never happened
+ success = true;
+ }
}
}
@@ -3140,29 +3150,32 @@ bool LLViewerShaderMgr::loadShadersInterface()
success = gCopyDepthProgram.createShader();
}
- if (success)
+ if (gSavedSettings.getBOOL("LocalTerrainPaintEnabled"))
{
- LLGLSLShader* shader = &gPBRTerrainBakeProgram;
- U32 bit_depth = gSavedSettings.getU32("TerrainPaintBitDepth");
- // LLTerrainPaintMap currently uses an RGB8 texture internally
- bit_depth = llclamp(bit_depth, 1, 8);
- shader->mName = llformat("Terrain Bake Shader RGB%o", bit_depth);
- shader->mFeatures.isPBRTerrain = true;
-
- shader->mShaderFiles.clear();
- shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeV.glsl", GL_VERTEX_SHADER));
- shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeF.glsl", GL_FRAGMENT_SHADER));
- shader->mShaderLevel = mShaderLevel[SHADER_INTERFACE];
- const U32 value_range = (1 << bit_depth) - 1;
- shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range));
- success = success && shader->createShader();
- //llassert(success);
- if (!success)
+ if (success)
{
- LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL;
- gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false);
- // continue as if this shader never happened
- success = true;
+ LLGLSLShader* shader = &gPBRTerrainBakeProgram;
+ U32 bit_depth = gSavedSettings.getU32("TerrainPaintBitDepth");
+ // LLTerrainPaintMap currently uses an RGB8 texture internally
+ bit_depth = llclamp(bit_depth, 1, 8);
+ shader->mName = llformat("Terrain Bake Shader RGB%o", bit_depth);
+ shader->mFeatures.isPBRTerrain = true;
+
+ shader->mShaderFiles.clear();
+ shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeV.glsl", GL_VERTEX_SHADER));
+ shader->mShaderFiles.push_back(make_pair("interface/pbrTerrainBakeF.glsl", GL_FRAGMENT_SHADER));
+ shader->mShaderLevel = mShaderLevel[SHADER_INTERFACE];
+ const U32 value_range = (1 << bit_depth) - 1;
+ shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range));
+ success = success && shader->createShader();
+ //llassert(success);
+ if (!success)
+ {
+ LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL;
+ gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false);
+ // continue as if this shader never happened
+ success = true;
+ }
}
}
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index 76348d4ea1..2d59712142 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -36,6 +36,7 @@
#include "llnotificationsutil.h"
#include "llinventorymodel.h"
#include "lltrans.h"
+#include "llappviewer.h"
// Callback struct
struct LLWearableArrivedData
@@ -97,6 +98,22 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara
// static
void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID& uuid, void* userdata, S32 status, LLExtStat ext_status )
{
+ if (!LLCoros::on_main_coro())
+ {
+ // if triggered from a coroutine, dispatch to main thread before accessing app state
+ std::string filename_in = filename;
+ LLUUID uuid_in = uuid;
+
+ LLAppViewer::instance()->postToMainCoro([=]()
+ {
+ processGetAssetReply(filename_in.c_str(), uuid_in, userdata, status, ext_status);
+ });
+
+ return;
+ }
+
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+
bool isNewWearable = false;
LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
LLViewerWearable* wearable = NULL; // NULL indicates failure