diff options
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r-- | indra/newview/llface.cpp | 323 |
1 files changed, 136 insertions, 187 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index f1b64a5899..d0c26bc43b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -56,6 +56,7 @@ #include "llviewertexture.h" #include "llvoavatar.h" #include "llsculptidsize.h" +#include "llmeshrepository.h" #if LL_LINUX // Work-around spurious used before init warning on Vector4a @@ -71,6 +72,7 @@ static LLStaticHashedString sColorIn("color_in"); BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE + #define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]) /* @@ -127,6 +129,7 @@ void planarProjection(LLVector2 &tc, const LLVector4a& normal, void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; mLastUpdateTime = gFrameTimeSeconds; mLastMoveTime = 0.f; mLastSkinTime = gFrameTimeSeconds; @@ -196,14 +199,7 @@ void LLFace::destroy() if (mDrawPoolp) { - if (this->isState(LLFace::RIGGED) && (mDrawPoolp->getType() == LLDrawPool::POOL_CONTROL_AV || mDrawPoolp->getType() == LLDrawPool::POOL_AVATAR)) - { - ((LLDrawPoolAvatar*) mDrawPoolp)->removeRiggedFace(this); - } - else - { - mDrawPoolp->removeFace(this); - } + mDrawPoolp->removeFace(this); mDrawPoolp = NULL; } @@ -241,6 +237,8 @@ void LLFace::setPool(LLFacePool* pool) void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + if (!new_pool) { LL_ERRS() << "Setting pool to null!" << LL_ENDL; @@ -320,6 +318,8 @@ void LLFace::setSpecularMap(LLViewerTexture* tex) void LLFace::dirtyTexture() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + LLDrawable* drawablep = getDrawable(); if (mVObjp.notNull() && mVObjp->getVolume()) @@ -535,6 +535,8 @@ void LLFace::updateCenterAgent() void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + if (mDrawablep == NULL || mDrawablep->getSpatialGroup() == NULL) { return; @@ -585,6 +587,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords); } gGL.syncMatrices(); + LL_PROFILER_GPU_ZONEC( "gl.DrawElements", 0x00FF00 ); glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } @@ -605,6 +608,8 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) void renderFace(LLDrawable* drawable, LLFace *face) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + LLVOVolume* vobj = drawable->getVOVolume(); if (vobj) { @@ -648,7 +653,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); glFogfv(GL_FOG_COLOR, fogCol.mV); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); { gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); renderFace(mDrawablep, this); @@ -891,6 +896,8 @@ bool less_than_max_mag(const LLVector4a& vec) BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, const LLMatrix4& mat_vert_in, BOOL global_volume) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + //get bounding box if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED)) { @@ -1165,6 +1172,11 @@ bool LLFace::canRenderAsMask() return true; } + if (isState(LLFace::RIGGED)) + { // never auto alpha-mask rigged faces + return false; + } + const LLTextureEntry* te = getTextureEntry(); if( !te || !getViewerObject() || !getTexture() ) { @@ -1202,12 +1214,10 @@ bool LLFace::canRenderAsMask() } -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_VOLUME("Volume VB Cache"); - //static void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_VOLUME); + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_NORMAL; @@ -1269,41 +1279,13 @@ void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count) } } -static LLTrace::BlockTimerStatHandle FTM_FACE_GET_GEOM("Face Geom"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_POSITION("Position"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_NORMAL("Normal"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_TEXTURE("Texture"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_COLOR("Color"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_EMISSIVE("Emissive"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_WEIGHTS("Weights"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_TANGENT("Binormal"); - -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK("Face Feedback"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_POSITION("Feedback Position"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_NORMAL("Feedback Normal"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_TEXTURE("Feedback Texture"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_COLOR("Feedback Color"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_EMISSIVE("Feedback Emissive"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_BINORMAL("Feedback Binormal"); - -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_INDEX("Index"); -static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_INDEX_TAIL("Tail"); -static LLTrace::BlockTimerStatHandle FTM_FACE_POSITION_STORE("Pos"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEXTURE_INDEX_STORE("TexIdx"); -static LLTrace::BlockTimerStatHandle FTM_FACE_POSITION_PAD("Pad"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_DEFAULT("Default"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK("Quick"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_NO_XFORM("No Xform"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_XFORM("Xform"); -static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_PLANAR("Quick Planar"); - BOOL LLFace::getGeometryVolume(const LLVolume& volume, const S32 &f, const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in, const U16 &index_offset, bool force_rebuild) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GET_GEOM); + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; llassert(verify()); if (volume.getNumVolumeFaces() <= f) { @@ -1311,7 +1293,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, return FALSE; } - const LLVolumeFace &vf = volume.getVolumeFace(f); + bool rigged = isState(RIGGED); + + const LLVolumeFace &vf = volume.getVolumeFace(f); S32 num_vertices = (S32)vf.mNumVertices; S32 num_indices = (S32) vf.mNumIndices; @@ -1444,7 +1428,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, // INDICES if (full_rebuild) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_INDEX); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices"); mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range); volatile __m128i* dst = (__m128i*) indicesp.get(); @@ -1460,7 +1444,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_INDEX_TAIL); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices tail"); U16* idx = (U16*) dst; for (S32 i = end*8; i < num_indices; ++i) @@ -1475,9 +1459,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - LLMatrix4a mat_normal; - mat_normal.loadu(mat_norm_in); - F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0; bool do_xform = false; if (rebuild_tcoord) @@ -1512,6 +1493,45 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } + const LLMeshSkinInfo* skin = nullptr; + LLMatrix4a mat_vert; + LLMatrix4a mat_normal; + + // prepare mat_vert + if (rebuild_pos) + { + if (rigged) + { //override with bind shape matrix if rigged + skin = mSkinInfo; + mat_vert = skin->mBindShapeMatrix; + } + else + { + mat_vert.loadu(mat_vert_in); + } + } + + if (rebuild_normal || rebuild_tangent) + { //override mat_normal with inverse of skin->mBindShapeMatrix + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - norm mat override"); + if (rigged) + { + if (skin == nullptr) + { + skin = mSkinInfo; + } + + //TODO -- cache this (check profile marker above)? + glh::matrix4f m((F32*) skin->mBindShapeMatrix.getF32ptr()); + m = m.inverse().transpose(); + mat_normal.loadu(m.m); + } + else + { + mat_normal.loadu(mat_norm_in); + } + } + static LLCachedControl<bool> use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false); #ifdef GL_TRANSFORM_FEEDBACK_BUFFER @@ -1523,7 +1543,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, !volume.isUnique()) //source volume is NOT flexi { //use transform feedback to pack vertex buffer //gGLDebugLoggingEnabled = TRUE; - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK); + + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - transform feedback"); LLGLEnable discard(GL_RASTERIZER_DISCARD); LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); @@ -1541,7 +1562,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_pos) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_POSITION); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf position"); gTransformPositionProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount); @@ -1566,7 +1587,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_COLOR); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf color"); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount); @@ -1582,7 +1603,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_emissive) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_EMISSIVE); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf emissive"); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount); @@ -1603,7 +1624,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_normal) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_NORMAL); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf normal"); gTransformNormalProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount); @@ -1616,7 +1637,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tangent) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf tangent"); gTransformTangentProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TANGENT, mGeomIndex, mGeomCount); @@ -1629,7 +1650,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_TEXTURE); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tf tcoord"); gTransformTexCoordProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount); @@ -1668,7 +1689,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TEXTURE); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tcoord"); //bump setup LLVector4a binormal_dir( -sin_ang, cos_ang, 0.f ); @@ -1764,7 +1785,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, do_xform = false; } - if (getVirtualSize() >= MIN_TEX_ANIM_SIZE || isState(LLFace::RIGGED)) + if (getVirtualSize() >= MIN_TEX_ANIM_SIZE) // || isState(LLFace::RIGGED)) { //don't override texture transform during tc bake tex_mode = 0; } @@ -1791,18 +1812,18 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (texgen != LLTextureEntry::TEX_GEN_PLANAR) { - LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen"); if (!do_tex_mat) { if (!do_xform) { - LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_NO_XFORM); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("ggv - texgen 1"); S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; LLVector4a::memcpyNonAliased16((F32*) tex_coords0.get(), (F32*) vf.mTexCoords, tc_size); } else { - LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_XFORM); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("ggv - texgen 2"); F32* dst = (F32*) tex_coords0.get(); LLVector4a* src = (LLVector4a*) vf.mTexCoords; @@ -1842,9 +1863,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, for (S32 i = 0; i < num_vertices; i++) { LLVector2 tc(vf.mTexCoords[i]); - //LLVector4a& norm = vf.mNormals[i]; - //LLVector4a& center = *(vf.mCenter); - + LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); tmp = tmp * *mTextureMatrix; tc.mV[0] = tmp.mV[0]; @@ -1855,7 +1874,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { //no bump, tex gen planar - LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_PLANAR); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen planar"); if (do_tex_mat) { for (S32 i = 0; i < num_vertices; i++) @@ -1900,7 +1919,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { //bump mapped or has material, just do the whole expensive loop - LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_DEFAULT); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen default"); std::vector<LLVector2> bump_tc; @@ -2058,14 +2077,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a* end = src+num_vertices; //LLVector4a* end_64 = end-4; - //LL_RECORD_TIME_BLOCK(FTM_FACE_GEOM_POSITION); llassert(num_vertices > 0); mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range); - LLMatrix4a mat_vert; - mat_vert.loadu(mat_vert_in); - + F32* dst = (F32*) vert.get(); F32* end_f32 = dst+mGeomCount*4; @@ -2095,53 +2111,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a tmp; - { - //LL_RECORD_TIME_BLOCK(FTM_FACE_POSITION_STORE); - - /*if (num_vertices > 4) - { //more than 64 bytes - while (src < end_64) - { - _mm_prefetch((char*)src + 64, _MM_HINT_T0); - _mm_prefetch((char*)dst + 64, _MM_HINT_T0); - - mat_vert.affineTransform(*src, res0); - tmp.setSelectWithMask(mask, texIdx, res0); - tmp.store4a((F32*) dst); - - mat_vert.affineTransform(*(src+1), res1); - tmp.setSelectWithMask(mask, texIdx, res1); - tmp.store4a((F32*) dst+4); - - mat_vert.affineTransform(*(src+2), res2); - tmp.setSelectWithMask(mask, texIdx, res2); - tmp.store4a((F32*) dst+8); - - mat_vert.affineTransform(*(src+3), res3); - tmp.setSelectWithMask(mask, texIdx, res3); - tmp.store4a((F32*) dst+12); - - dst += 16; - src += 4; - } - }*/ - - while (src < end) - { - mat_vert.affineTransform(*src++, res0); - tmp.setSelectWithMask(mask, texIdx, res0); - tmp.store4a((F32*) dst); - dst += 4; - } + + while (src < end) + { + mat_vert.affineTransform(*src++, res0); + tmp.setSelectWithMask(mask, texIdx, res0); + tmp.store4a((F32*) dst); + dst += 4; } - + + while (dst < end_f32) { - //LL_RECORD_TIME_BLOCK(FTM_FACE_POSITION_PAD); - while (dst < end_f32) - { - res0.store4a((F32*) dst); - dst += 4; - } + res0.store4a((F32*) dst); + dst += 4; } if (map_range) @@ -2150,10 +2132,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - if (rebuild_normal) { - //LL_RECORD_TIME_BLOCK(FTM_FACE_GEOM_NORMAL); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - normal"); + mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range); F32* normals = (F32*) norm.get(); LLVector4a* src = vf.mNormals; @@ -2175,7 +2157,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tangent) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tangent"); mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); F32* tangents = (F32*) tangent.get(); @@ -2208,7 +2190,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_weights && vf.mWeights) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_WEIGHTS); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - weight"); mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); F32* weights = (F32*) wght.get(); LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); @@ -2220,7 +2202,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) ) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_COLOR); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - color"); mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, map_range); LLVector4a src; @@ -2251,7 +2233,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_emissive) { - LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_EMISSIVE); + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - emissive"); LLStrider<LLColor4U> emissive; mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range); @@ -2382,12 +2364,35 @@ F32 LLFace::getTextureVirtualSize() BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; + //VECTORIZE THIS //get area of circle around face - LLVector4a center; - center.load3(getPositionAgent().mV); - LLVector4a size; - size.setSub(mExtents[1], mExtents[0]); + + LLVector4a center; + LLVector4a size; + + + if (isState(LLFace::RIGGED)) + { + //override with avatar bounding box + LLVOAvatar* avatar = mVObjp->getAvatar(); + if (avatar && avatar->mDrawable) + { + center.load3(avatar->getPositionAgent().mV); + const LLVector4a* exts = avatar->mDrawable->getSpatialExtents(); + size.setSub(exts[1], exts[0]); + } + else + { + return false; + } + } + else + { + center.load3(getPositionAgent().mV); + size.setSub(mExtents[1], mExtents[0]); + } size.mul(0.5f); LLViewerCamera* camera = LLViewerCamera::getInstance(); @@ -2661,6 +2666,8 @@ const LLMatrix4& LLFace::getRenderMatrix() const S32 LLFace::renderElements(const U16 *index_array) const { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + S32 ret = 0; if (isState(GLOBAL)) @@ -2680,6 +2687,8 @@ S32 LLFace::renderElements(const U16 *index_array) const S32 LLFace::renderIndexed() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + if(mDrawablep == NULL || mDrawPoolp == NULL) { return 0; @@ -2690,6 +2699,8 @@ S32 LLFace::renderIndexed() S32 LLFace::renderIndexed(U32 mask) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + if (mVertexBuffer.isNull()) { return 0; @@ -2767,56 +2778,6 @@ void LLFace::clearVertexBuffer() mVertexBuffer = NULL; } -//static -U32 LLFace::getRiggedDataMask(U32 type) -{ - static const U32 rigged_data_mask[] = { - LLDrawPoolAvatar::RIGGED_MATERIAL_MASK, - LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_VMASK, - LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_MASK_MASK, - LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_EMISSIVE_MASK, - LLDrawPoolAvatar::RIGGED_SPECMAP_VMASK, - LLDrawPoolAvatar::RIGGED_SPECMAP_BLEND_MASK, - LLDrawPoolAvatar::RIGGED_SPECMAP_MASK_MASK, - LLDrawPoolAvatar::RIGGED_SPECMAP_EMISSIVE_MASK, - LLDrawPoolAvatar::RIGGED_NORMMAP_VMASK, - LLDrawPoolAvatar::RIGGED_NORMMAP_BLEND_MASK, - LLDrawPoolAvatar::RIGGED_NORMMAP_MASK_MASK, - LLDrawPoolAvatar::RIGGED_NORMMAP_EMISSIVE_MASK, - LLDrawPoolAvatar::RIGGED_NORMSPEC_VMASK, - LLDrawPoolAvatar::RIGGED_NORMSPEC_BLEND_MASK, - LLDrawPoolAvatar::RIGGED_NORMSPEC_MASK_MASK, - LLDrawPoolAvatar::RIGGED_NORMSPEC_EMISSIVE_MASK, - LLDrawPoolAvatar::RIGGED_SIMPLE_MASK, - LLDrawPoolAvatar::RIGGED_FULLBRIGHT_MASK, - LLDrawPoolAvatar::RIGGED_SHINY_MASK, - LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY_MASK, - LLDrawPoolAvatar::RIGGED_GLOW_MASK, - LLDrawPoolAvatar::RIGGED_ALPHA_MASK, - LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA_MASK, - LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP_MASK, - LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE_MASK, - }; - - llassert(type < sizeof(rigged_data_mask)/sizeof(U32)); - - return rigged_data_mask[type]; -} - -U32 LLFace::getRiggedVertexBufferDataMask() const -{ - U32 data_mask = 0; - for (U32 i = 0; i < mRiggedIndex.size(); ++i) - { - if (mRiggedIndex[i] > -1) - { - data_mask |= LLFace::getRiggedDataMask(i); - } - } - - return data_mask; -} - S32 LLFace::getRiggedIndex(U32 type) const { if (mRiggedIndex.empty()) @@ -2829,19 +2790,7 @@ S32 LLFace::getRiggedIndex(U32 type) const return mRiggedIndex[type]; } -void LLFace::setRiggedIndex(U32 type, S32 index) +U64 LLFace::getSkinHash() { - if (mRiggedIndex.empty()) - { - mRiggedIndex.resize(LLDrawPoolAvatar::NUM_RIGGED_PASSES); - for (U32 i = 0; i < mRiggedIndex.size(); ++i) - { - mRiggedIndex[i] = -1; - } - } - - llassert(type < mRiggedIndex.size()); - - mRiggedIndex[type] = index; + return mSkinInfo ? mSkinInfo->mHash : 0; } - |