summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llcubemaparray.cpp6
-rw-r--r--indra/llrender/llcubemaparray.h2
-rw-r--r--indra/llrender/llfontfreetype.cpp25
-rw-r--r--indra/llrender/llfontfreetype.h2
-rw-r--r--indra/llrender/llrender.cpp22
5 files changed, 40 insertions, 17 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp
index 4e7fa7316e..253286fb1c 100644
--- a/indra/llrender/llcubemaparray.cpp
+++ b/indra/llrender/llcubemaparray.cpp
@@ -109,7 +109,7 @@ LLCubeMapArray::~LLCubeMapArray()
{
}
-void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips)
+void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool use_mips, bool hdr)
{
U32 texname = 0;
mWidth = resolution;
@@ -128,6 +128,10 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us
free_cur_tex_image();
U32 format = components == 4 ? GL_RGBA16F : GL_RGB16F;
+ if (!hdr)
+ {
+ format = components == 4 ? GL_RGBA8 : GL_RGB8;
+ }
U32 mip = 0;
U32 mip_resolution = resolution;
while (mip_resolution >= 1)
diff --git a/indra/llrender/llcubemaparray.h b/indra/llrender/llcubemaparray.h
index 675aaaf07c..bfc72a321d 100644
--- a/indra/llrender/llcubemaparray.h
+++ b/indra/llrender/llcubemaparray.h
@@ -52,7 +52,7 @@ public:
// components - number of components per pixel
// count - number of cube maps in the array
// use_mips - if true, mipmaps will be allocated for this cube map array and anisotropic filtering will be used
- void allocate(U32 res, U32 components, U32 count, bool use_mips = true);
+ void allocate(U32 res, U32 components, U32 count, bool use_mips = true, bool hdr = true);
void bind(S32 stage);
void unbind();
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index fa76669258..1ca4c8c079 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -554,7 +554,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
return NULL;
llassert(!mIsFallback);
- fontp->renderGlyph(requested_glyph_type, glyph_index);
+ fontp->renderGlyph(requested_glyph_type, glyph_index, wch);
EFontGlyphType bitmap_glyph_type = EFontGlyphType::Unspecified;
switch (fontp->mFTFace->glyph->bitmap.pixel_mode)
@@ -699,7 +699,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
}
}
-void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const
+void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, llwchar wch) const
{
if (mFTFace == NULL)
return;
@@ -714,11 +714,28 @@ void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) co
FT_Error error = FT_Load_Glyph(mFTFace, glyph_index, load_flags);
if (FT_Err_Ok != error)
{
+ if (error == FT_Err_Out_Of_Memory)
+ {
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ LL_ERRS() << "Out of memory loading glyph for character " << wch << LL_ENDL;
+ }
+
std::string message = llformat(
- "Error %d (%s) loading glyph %u: bitmap_type=%u, load_flags=%d",
- error, FT_Error_String(error), glyph_index, bitmap_type, load_flags);
+ "Error %d (%s) loading wchar %u glyph %u/%u: bitmap_type=%u, load_flags=%d",
+ error, FT_Error_String(error), wch, glyph_index, mFTFace->num_glyphs, bitmap_type, load_flags);
LL_WARNS_ONCE() << message << LL_ENDL;
error = FT_Load_Glyph(mFTFace, glyph_index, load_flags ^ FT_LOAD_COLOR);
+ if (FT_Err_Invalid_Outline == error
+ || FT_Err_Invalid_Composite == error
+ || (FT_Err_Ok != error && LLStringOps::isEmoji(wch)))
+ {
+ glyph_index = FT_Get_Char_Index(mFTFace, '?');
+ // if '?' is not present, potentially can use last index, that's supposed to be null glyph
+ if (glyph_index > 0)
+ {
+ error = FT_Load_Glyph(mFTFace, glyph_index, load_flags ^ FT_LOAD_COLOR);
+ }
+ }
llassert_always_msg(FT_Err_Ok == error, message.c_str());
}
diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h
index eba89f5def..1ad795060a 100644
--- a/indra/llrender/llfontfreetype.h
+++ b/indra/llrender/llfontfreetype.h
@@ -156,7 +156,7 @@ private:
bool hasGlyph(llwchar wch) const; // Has a glyph for this character
LLFontGlyphInfo* addGlyph(llwchar wch, EFontGlyphType glyph_type) const; // Add a new character to the font if necessary
LLFontGlyphInfo* addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index, EFontGlyphType bitmap_type) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found)
- void renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const;
+ void renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index, llwchar wch) const;
void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const;
std::string mName;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 37e15b96c3..9f3f42d6d5 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -751,9 +751,8 @@ void LLLightState::setPosition(const LLVector4& position)
++gGL.mLightHash;
mPosition = position;
//transform position by current modelview matrix
- glm::vec4 pos(glm::make_vec4(position.mV));
- const glm::mat4& mat = gGL.getModelviewMatrix();
- pos = mat * pos;
+ glm::vec4 pos(position);
+ pos = gGL.getModelviewMatrix() * pos;
mPosition.set(glm::value_ptr(pos));
}
@@ -808,7 +807,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
++gGL.mLightHash;
//transform direction by current modelview matrix
- glm::vec3 dir(glm::make_vec3(direction.mV));
+ glm::vec3 dir(direction);
const glm::mat3 mat(gGL.getModelviewMatrix());
dir = mat * dir;
@@ -2106,12 +2105,14 @@ void set_last_projection(const glm::mat4& mat)
glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)
{
- //const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
- //return glm::vec3(
- // (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w,
- // (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w,
- // (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w
- //);
+#if 1 // SIMD path results in strange crashes. Fall back to scalar for now.
+ const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
+ return glm::vec3(
+ (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w,
+ (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w,
+ (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w
+ );
+#else
LLVector4a x, y, z, s, t, p, q;
x.splat(vec.x);
@@ -2141,4 +2142,5 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)
res.setAdd(x, z);
res.div(q);
return glm::make_vec3(res.getF32ptr());
+#endif
}