Vectorize LLRender UI scale and offset stack to resolve perf hotspot on arm
parent
4a56738e4f
commit
0f4aa87cac
|
|
@ -118,7 +118,7 @@ static const GLenum sGLBlendFactor[] =
|
|||
|
||||
LLTexUnit::LLTexUnit(S32 index)
|
||||
: mCurrTexType(TT_NONE),
|
||||
mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0),
|
||||
mCurrTexture(0),
|
||||
mHasMipMaps(false),
|
||||
mIndex(index)
|
||||
{
|
||||
|
|
@ -600,26 +600,6 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha)
|
|||
}
|
||||
}
|
||||
|
||||
void LLTexUnit::setColorScale(S32 scale)
|
||||
{
|
||||
if (mCurrColorScale != scale || gGL.mDirty)
|
||||
{
|
||||
mCurrColorScale = scale;
|
||||
gGL.flush();
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale );
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexUnit::setAlphaScale(S32 scale)
|
||||
{
|
||||
if (mCurrAlphaScale != scale || gGL.mDirty)
|
||||
{
|
||||
mCurrAlphaScale = scale;
|
||||
gGL.flush();
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale );
|
||||
}
|
||||
}
|
||||
|
||||
// Useful for debugging that you've manually assigned a texture operation to the correct
|
||||
// texture unit based on the currently set active texture in opengl.
|
||||
void LLTexUnit::debugTextureUnit(void)
|
||||
|
|
@ -1283,9 +1263,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z)
|
|||
LL_ERRS() << "Need to push a UI translation frame before offsetting" << LL_ENDL;
|
||||
}
|
||||
|
||||
mUIOffset.back().mV[0] += x;
|
||||
mUIOffset.back().mV[1] += y;
|
||||
mUIOffset.back().mV[2] += z;
|
||||
mUIOffset.back().add(LLVector4a(x, y, z));
|
||||
}
|
||||
|
||||
void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
||||
|
|
@ -1295,14 +1273,14 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
|||
LL_ERRS() << "Need to push a UI transformation frame before scaling." << LL_ENDL;
|
||||
}
|
||||
|
||||
mUIScale.back().scaleVec(LLVector3(x,y,z));
|
||||
mUIScale.back().mul(LLVector4a(x, y, z));
|
||||
}
|
||||
|
||||
void LLRender::pushUIMatrix()
|
||||
{
|
||||
if (mUIOffset.empty())
|
||||
{
|
||||
mUIOffset.emplace_back(0.f,0.f,0.f);
|
||||
mUIOffset.emplace_back(0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1311,7 +1289,7 @@ void LLRender::pushUIMatrix()
|
|||
|
||||
if (mUIScale.empty())
|
||||
{
|
||||
mUIScale.emplace_back(1.f,1.f,1.f);
|
||||
mUIScale.emplace_back(1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1333,18 +1311,20 @@ LLVector3 LLRender::getUITranslation()
|
|||
{
|
||||
if (mUIOffset.empty())
|
||||
{
|
||||
return LLVector3(0,0,0);
|
||||
return LLVector3::zero;
|
||||
}
|
||||
return mUIOffset.back();
|
||||
|
||||
return LLVector3(mUIOffset.back().getF32ptr());
|
||||
}
|
||||
|
||||
LLVector3 LLRender::getUIScale()
|
||||
{
|
||||
if (mUIScale.empty())
|
||||
{
|
||||
return LLVector3(1,1,1);
|
||||
return LLVector3::all_one;
|
||||
}
|
||||
return mUIScale.back();
|
||||
|
||||
return LLVector3(mUIScale.back().getF32ptr());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1354,8 +1334,9 @@ void LLRender::loadUIIdentity()
|
|||
{
|
||||
LL_ERRS() << "Need to push UI translation frame before clearing offset." << LL_ENDL;
|
||||
}
|
||||
mUIOffset.back().setVec(0,0,0);
|
||||
mUIScale.back().setVec(1,1,1);
|
||||
|
||||
mUIOffset.back().clear();
|
||||
mUIScale.back().splat(1);
|
||||
}
|
||||
|
||||
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||
|
|
@ -1783,8 +1764,10 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
|||
}
|
||||
else
|
||||
{
|
||||
LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||
mVerticesp[mCount].set(vert.mV[VX], vert.mV[VY], vert.mV[VZ]);
|
||||
LLVector4a vert(x, y, z);
|
||||
vert.add(mUIOffset.back());
|
||||
vert.mul(mUIScale.back());
|
||||
mVerticesp[mCount] = vert;
|
||||
}
|
||||
|
||||
mCount++;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "llglheaders.h"
|
||||
#include "llmatrix4a.h"
|
||||
#include "glm/mat4x4.hpp"
|
||||
#include <boost/align/aligned_allocator.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <list>
|
||||
|
|
@ -227,13 +228,9 @@ protected:
|
|||
S32 mIndex;
|
||||
U32 mCurrTexture;
|
||||
eTextureType mCurrTexType;
|
||||
S32 mCurrColorScale;
|
||||
S32 mCurrAlphaScale;
|
||||
bool mHasMipMaps;
|
||||
|
||||
void debugTextureUnit(void);
|
||||
void setColorScale(S32 scale);
|
||||
void setAlphaScale(S32 scale);
|
||||
GLint getTextureSource(eTextureBlendSrc src);
|
||||
GLint getTextureSourceType(eTextureBlendSrc src, bool isAlpha = false);
|
||||
};
|
||||
|
|
@ -526,8 +523,8 @@ private:
|
|||
eBlendFactor mCurrBlendAlphaSFactor;
|
||||
eBlendFactor mCurrBlendAlphaDFactor;
|
||||
|
||||
std::vector<LLVector3> mUIOffset;
|
||||
std::vector<LLVector3> mUIScale;
|
||||
std::vector<LLVector4a, boost::alignment::aligned_allocator<LLVector4a, 16> > mUIOffset;
|
||||
std::vector<LLVector4a, boost::alignment::aligned_allocator<LLVector4a, 16> > mUIScale;
|
||||
};
|
||||
|
||||
extern F32 gGLModelView[16];
|
||||
|
|
|
|||
Loading…
Reference in New Issue