summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-04-19 21:14:33 +0800
committerErik Kundiman <erik@megapahit.org>2025-04-19 21:14:33 +0800
commit9595a3dee48eb8b7f10cad02b4ebdda5f596664e (patch)
treeaadbfc379b2028e1f22662d38b1094c745064ad9 /indra/llrender
parentad9c801edb13568657c0964ebfb74257da6d9e00 (diff)
parent9a333e65c4019540d5675e72ac57ef5ab106aab0 (diff)
Merge tag 'Second_Life_Release#9a333e65-2025.04' into 2025.04
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontfreetype.cpp27
-rw-r--r--indra/llrender/llgl.cpp19
-rw-r--r--indra/llrender/llglslshader.cpp27
3 files changed, 45 insertions, 28 deletions
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 2d8b8a0fee..41d0a1af31 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -656,7 +656,14 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_glyph_type, bitmap_num);
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_glyph_type, bitmap_num);
- image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
+ if (image_gl && image_raw)
+ {
+ image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
+ }
+ else
+ {
+ llassert(false); //images were just inserted by nextOpenPos, they shouldn't be missing
+ }
return gi;
}
@@ -840,7 +847,12 @@ bool LLFontFreetype::setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U1
{
LLImageRaw* image_raw = mFontBitmapCachep->getImageRaw(EFontGlyphType::Color, bitmap_num);
llassert(!mIsFallback);
- llassert(image_raw && (image_raw->getComponents() == 4));
+ if (!image_raw)
+ {
+ llassert(false);
+ return false;
+ }
+ llassert(image_raw->getComponents() == 4);
// NOTE: inspired by LLImageRaw::setSubImage()
U32* image_data = (U32*)image_raw->getData();
@@ -868,10 +880,17 @@ bool LLFontFreetype::setSubImageBGRA(U32 x, U32 y, U32 bitmap_num, U16 width, U1
void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 width, U32 height, U8 *data, S32 stride) const
{
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(EFontGlyphType::Grayscale, bitmap_num);
- LLImageDataLock lock(image_raw);
llassert(!mIsFallback);
- llassert(image_raw && (image_raw->getComponents() == 2));
+ if (!image_raw)
+ {
+ llassert(false);
+ return;
+ }
+
+ LLImageDataLock lock(image_raw);
+
+ llassert(image_raw->getComponents() == 2);
U8 *target = image_raw->getData();
llassert(target);
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 3b506d6965..70a28a1740 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1233,28 +1233,9 @@ bool LLGLManager::initGL()
}
#endif
-#if LL_WINDOWS
- if (mVRAM < 256)
- {
- // Something likely went wrong using the above extensions
- // try WMI first and fall back to old method (from dxdiag) if all else fails
- // Function will check all GPUs WMI knows of and will pick up the one with most
- // memory. We need to check all GPUs because system can switch active GPU to
- // weaker one, to preserve power when not under load.
- U32 mem = LLDXHardware::getMBVideoMemoryViaWMI();
- if (mem != 0)
- {
- mVRAM = mem;
- LL_WARNS("RenderInit") << "VRAM Detected (WMI):" << mVRAM<< LL_ENDL;
- }
- }
-#endif
-
if (mVRAM < 256 && old_vram > 0)
{
// fall back to old method
- // Note: on Windows value will be from LLDXHardware.
- // Either received via dxdiag or via WMI by id from dxdiag.
mVRAM = old_vram;
}
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 3d7bf500f1..e0c2db058a 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -1285,23 +1285,40 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode)
llassert(false);
return -1;
}
+
S32 index = mTexture[uniform];
- if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE)
+ if (index < 0)
+ {
+ // Invalid texture index - nothing to disable
+ return index;
+ }
+
+ LLTexUnit* tex_unit = gGL.getTexUnit(index);
+ if (!tex_unit)
{
- if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode)
+ // Invalid texture unit
+ LL_WARNS_ONCE("Shader") << "Invalid texture unit at index: " << index << LL_ENDL;
+ return index;
+ }
+
+ LLTexUnit::eTextureType curr_type = tex_unit->getCurrType();
+ if (curr_type != LLTexUnit::TT_NONE)
+ {
+ if (gDebugGL && curr_type != mode)
{
if (gDebugSession)
{
- gFailLog << "Texture channel " << index << " texture type corrupted." << std::endl;
+ gFailLog << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << std::endl;
ll_fail("LLGLSLShader::disableTexture failed");
}
else
{
- LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL;
+ LL_ERRS() << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << LL_ENDL;
}
}
- gGL.getTexUnit(index)->disable();
+ tex_unit->disable();
}
+
return index;
}