summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-12 21:13:10 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-12 21:13:10 -0400
commit3d191c09b1b1eb6726fe67f6fdf5445d83536578 (patch)
treefa1c7e42b499638c0487b6af5c59ed048624f4a0 /indra/newview/llface.cpp
parentb8678d8fa3521f4496ddc569de391633711e46cb (diff)
parentccbd69bf6b287861b41fdb00e9d372746dfc2702 (diff)
Merge branch 'develop' into release/luau-scripting
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp83
1 files changed, 52 insertions, 31 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index ccfef09b09..48fddc32db 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1487,9 +1487,9 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
}
//TODO -- cache this (check profile marker above)?
- glh::matrix4f m((F32*) skin->mBindShapeMatrix.getF32ptr());
- m = m.inverse().transpose();
- mat_normal.loadu(m.m);
+ glm::mat4 m = glm::make_mat4((F32*)skin->mBindShapeMatrix.getF32ptr());
+ m = glm::transpose(glm::inverse(m));
+ mat_normal.loadu(glm::value_ptr(m));
}
else
{
@@ -1741,7 +1741,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
{ //bump mapped or has material, just do the whole expensive loop
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen default");
- std::vector<LLVector2> bump_tc;
+ LLStrider<LLVector2> bump_tc;
if (mat && !mat->getNormalID().isNull())
{ //writing out normal and specular texture coordinates, not bump offsets
@@ -1803,49 +1803,70 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
}
const bool do_xform = (xforms & xform_channel) != XFORM_NONE;
+ // hold onto strider to front of TC array for use later
+ bump_tc = dst;
- for (S32 i = 0; i < num_vertices; i++)
{
- LLVector2 tc(vf.mTexCoords[i]);
-
- LLVector4a& norm = vf.mNormals[i];
-
- LLVector4a& center = *(vf.mCenter);
-
- if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
+ // NOTE: split TEX_GEN_PLANAR implementation to reduce branchiness of inner loop
+ // These are per-vertex operations and every little bit counts
+ if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
{
- LLVector4a vec = vf.mPositions[i];
+ LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - planar");
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+ LLVector4a& norm = vf.mNormals[i];
+ LLVector4a& center = *(vf.mCenter);
+ LLVector4a vec = vf.mPositions[i];
- vec.mul(scalea);
+ vec.mul(scalea);
- if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
- {
planarProjection(tc, norm, center, vec);
- }
- }
- if (tex_mode && mTextureMatrix)
- {
- LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
- tmp = tmp * *mTextureMatrix;
- tc.mV[0] = tmp.mV[0];
- tc.mV[1] = tmp.mV[1];
+ if (tex_mode && mTextureMatrix)
+ {
+ LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
+ tmp = tmp * *mTextureMatrix;
+ tc.mV[0] = tmp.mV[0];
+ tc.mV[1] = tmp.mV[1];
+ }
+ else if (do_xform)
+ {
+ xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
+ }
+
+ *dst++ = tc;
+ }
}
- else if (do_xform)
+ else
{
- xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
- }
+ LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - transform");
- *dst++ = tc;
- if (do_bump)
- {
- bump_tc.push_back(tc);
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+
+ if (tex_mode && mTextureMatrix)
+ {
+ LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
+ tmp = tmp * *mTextureMatrix;
+ tc.mV[0] = tmp.mV[0];
+ tc.mV[1] = tmp.mV[1];
+ }
+ else if (do_xform)
+ {
+ xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
+ }
+
+ *dst++ = tc;
+ }
}
}
}
if ((!mat && !gltf_mat) && do_bump)
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - do bump");
mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount);
mVObjp->getVolume()->genTangents(face_index);