summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-08-29 13:32:34 -0700
committerBrad Linden <brad@lindenlab.com>2024-08-29 13:32:34 -0700
commitecf3002a4623ebed0ed31bcc11f743000deeac84 (patch)
treea15d60759afba2596f1f159d3011e4502514ce1f
parente2809755c5e4a6a6d3c8f27911865efe4020d679 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'origin/release/2024.08-DeltaFPS' into develop
-rw-r--r--indra/llcommon/llerror.cpp16
-rw-r--r--indra/llcommon/llerror.h11
-rw-r--r--indra/llrender/llimagegl.cpp10
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/gltfscenemanager.cpp8
-rw-r--r--indra/newview/llface.cpp12
-rw-r--r--indra/newview/llviewermenu.cpp15
-rw-r--r--indra/newview/llviewershadermgr.cpp9
-rw-r--r--indra/newview/llvovolume.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
10 files changed, 72 insertions, 35 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 41c69ba194..ad35bc84f2 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1641,19 +1641,3 @@ namespace LLError
sLocalizedOutOfMemoryWarning = message;
}
}
-
-void crashdriver(void (*callback)(int*))
-{
- // The LLERROR_CRASH macro used to have inline code of the form:
- //int* make_me_crash = NULL;
- //*make_me_crash = 0;
-
- // But compilers are getting smart enough to recognize that, so we must
- // assign to an address supplied by a separate source file. We could do
- // the assignment here in crashdriver() -- but then BugSplat would group
- // all LL_ERRS() crashes as the fault of this one function, instead of
- // identifying the specific LL_ERRS() source line. So instead, do the
- // assignment in a lambda in the caller's source. We just provide the
- // nullptr target.
- callback(nullptr);
-}
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 6176ce0d1d..8a143ff30a 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -408,9 +408,11 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_NEWLINE '\n'
// Use this only in LL_ERRS or in a place that LL_ERRS may not be used
-#define LLERROR_CRASH \
-{ \
- crashdriver([](int* ptr){ *ptr = 0; exit(*ptr); }); \
+#define LLERROR_CRASH \
+{ \
+ int* make_me_crash = (int*)0xDEADBEEFDEADBEEFUL; \
+ *make_me_crash = 0; \
+ exit(*make_me_crash); \
}
#define LL_ENDL \
@@ -512,7 +514,4 @@ LL_DEBUGS("SomeTag") performs the locking and map-searching ONCE, then caches
the result in a static variable.
*/
-// used by LLERROR_CRASH
-void crashdriver(void (*)(int*));
-
#endif // LL_LLERROR_H
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 03ac10c00a..68c20048ec 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -70,6 +70,7 @@ static U64 sTextureBytes = 0;
void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 intformat, U32 count)
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
+ llassert(texUnit == 0); // allocations should always be done on tex unit 0
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
U64 size = LLImageGL::dataFormatBytes(intformat, width, height);
size *= count;
@@ -77,6 +78,8 @@ void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 intformat, U32
llassert(size >= 0);
sTexMemMutex.lock();
+
+ // it is a precondition that no existing allocation exists for this texture
llassert(sTextureAllocs.find(texName) == sTextureAllocs.end());
sTextureAllocs[texName] = size;
@@ -90,7 +93,7 @@ void LLImageGLMemory::free_tex_image(U32 texName)
{
sTexMemMutex.lock();
auto iter = sTextureAllocs.find(texName);
- if (iter != sTextureAllocs.end())
+ if (iter != sTextureAllocs.end()) // sometimes a texName will be "freed" before allocated (e.g. first call to setManualImage for a given texName)
{
llassert(iter->second <= sTextureBytes); // sTextureBytes MUST NOT go below zero
@@ -115,6 +118,7 @@ void LLImageGLMemory::free_tex_images(U32 count, const U32* texNames)
void LLImageGLMemory::free_cur_tex_image()
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
+ llassert(texUnit == 0); // frees should always be done on tex unit 0
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
free_tex_image(texName);
}
@@ -1240,8 +1244,8 @@ void LLImageGL::deleteTextures(S32 numTextures, const U32 *textures)
if (!sFreeList[idx].empty())
{
- glDeleteTextures((GLsizei) sFreeList[idx].size(), sFreeList[idx].data());
free_tex_images((GLsizei) sFreeList[idx].size(), sFreeList[idx].data());
+ glDeleteTextures((GLsizei)sFreeList[idx].size(), sFreeList[idx].data());
sFreeList[idx].resize(0);
}
}
@@ -2461,7 +2465,7 @@ bool LLImageGL::scaleDown(S32 desired_discard)
{ // use a PBO to downscale the texture
U64 size = getBytes(desired_discard);
llassert(size <= 2048 * 2048 * 4); // we shouldn't be using this method to downscale huge textures, but it'll work
- gGL.getTexUnit(0)->bind(this);
+ gGL.getTexUnit(0)->bind(this, false, true);
if (sScratchPBO == 0)
{
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ec06582d90..6b8f698b0b 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7172,6 +7172,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderCanUseGLTFPBROpaqueShaders</key>
+ <map>
+ <key>Comment</key>
+ <string>Hardware has support for GLTF scene shaders</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>RenderClass1MemoryBandwidth</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index 086f41c1cb..e55d630940 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -45,6 +45,7 @@
#include "llfloaterreg.h"
#include "llagentbenefits.h"
#include "llfilesystem.h"
+#include "llviewercontrol.h"
#include "boost/json.hpp"
#define GLTF_SIM_SUPPORT 1
@@ -618,6 +619,13 @@ void GLTFSceneManager::render(Asset& asset, U8 variant)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF;
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (!can_use_shaders)
+ {
+ // user should already have been notified of unsupported hardware
+ return;
+ }
+
for (U32 ds = 0; ds < 2; ++ds)
{
RenderData& rd = asset.mRenderData[ds];
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index df08dcf503..ccfef09b09 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -573,12 +573,14 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
if (LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial())
{
vertex_buffer = mVertexBufferGLTF.get();
- vertex_buffer->unmapBuffer();
}
}
// Draw the selection marker using the correctly chosen vertex buffer
- vertex_buffer->setBuffer();
- vertex_buffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex);
+ if (vertex_buffer)
+ {
+ vertex_buffer->setBuffer();
+ vertex_buffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex);
+ }
}
gGL.popMatrix();
@@ -1217,7 +1219,8 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
mVertexBufferGLTF = new LLVertexBuffer(mVertexBuffer->getTypeMask());
}
- // Clone the existing vertex buffer into the temporary one
+ // Clone the existing vertex buffer into the temporary one
+ // TODO: factor out the need for mVertexBufferGLTF and make selection highlight shader work with the existing vertex buffer
mVertexBuffer->clone(*mVertexBufferGLTF);
// Recursive call the same function with the argument rebuild_for_gltf set to true
@@ -1225,6 +1228,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
mVertexBufferGLTF.swap(mVertexBufferGLTF, mVertexBuffer);
getGeometryVolume(volume, face_index, mat_vert_in, mat_norm_in, index_offset, force_rebuild, no_debug_assert, true);
mVertexBufferGLTF.swap(mVertexBufferGLTF, mVertexBuffer);
+ mVertexBufferGLTF->unmapBuffer();
}
else if (!tep->isSelected() && mVertexBufferGLTF.notNull())
{
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 97d5781566..e1664752e7 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3414,7 +3414,9 @@ bool enable_os_exception()
bool enable_gltf()
{
static LLCachedControl<bool> enablegltf(gSavedSettings, "GLTFEnabled", false);
- return enablegltf;
+ static LLCachedControl<bool> can_use(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+
+ return enablegltf && can_use;
}
bool enable_gltf_save_as()
@@ -8207,7 +8209,16 @@ class LLAdvancedClickGLTFOpen: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LL::GLTFSceneManager::instance().load();
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (can_use_shaders)
+ {
+ LL::GLTFSceneManager::instance().load();
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoSupportGLTFShader");
+ }
+
return true;
}
};
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index d1dea16bc0..5ddc00f3a0 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1339,7 +1339,14 @@ bool LLViewerShaderMgr::loadShadersDeferred()
success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
- llassert(success);
+ //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;
+ }
}
if (success)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index b7738b9135..7da4358f86 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5766,9 +5766,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
continue;
}
- if (facep->hasGeometry() &&
- (rigged || // <-- HACK FIXME -- getPixelArea might be incorrect for rigged objects
- facep->getPixelArea() > FORCE_CULL_AREA)) // <-- don't render tiny faces
+ if (facep->hasGeometry())
{
cur_total += facep->getGeomCount();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 4a9dd62666..848d9aca7c 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12557,4 +12557,15 @@ are wearing now.
yestext="OK"/>
</notification>
+ <notification
+ icon="alertmodal.tga"
+ name="NoSupportGLTFShader"
+ type="notify">
+ GLTF scenes are not yet supported on your graphics hardware.
+ <tag>fail</tag>
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
</notifications>