From 724e45baebd98f840fce0e3dfbd6edd5741e43cb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Apr 2010 13:00:01 -0500 Subject: Optimize LLViewerJointMesh::updateFaceData (transplanted from 365d7fdcd6a16d2b2cc4cbb0d721b4011487f33b) --- indra/newview/llviewerjointmesh.cpp | 88 +++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 19 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 7225aa1523..b125c79f61 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -667,6 +667,8 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- // updateFaceData() //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); + void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) { mFace = face; @@ -676,6 +678,8 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w return; } + LLFastTimer t(FTM_AVATAR_FACE); + LLStrider verticesp; LLStrider normalsp; LLStrider tex_coordsp; @@ -694,30 +698,76 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w face->mVertexBuffer->getIndexStrider(indicesp); stop_glerror(); - for (U16 i = 0; i < mMesh->getNumVertices(); i++) + verticesp += mMesh->mFaceVertexOffset; + tex_coordsp += mMesh->mFaceVertexOffset; + normalsp += mMesh->mFaceVertexOffset; + vertex_weightsp += mMesh->mFaceVertexOffset; + clothing_weightsp += mMesh->mFaceVertexOffset; + + U32* __restrict v = (U32*) verticesp.get(); + const U32 vert_skip = verticesp.getSkip()/sizeof(U32); + + U32* __restrict tc = (U32*) tex_coordsp.get(); + const U32 tc_skip = tex_coordsp.getSkip()/sizeof(U32); + + U32* __restrict n = (U32*) normalsp.get(); + const U32 n_skip = normalsp.getSkip()/sizeof(U32); + + U32* __restrict vw = (U32*) vertex_weightsp.get(); + const U32 vw_skip = vertex_weightsp.getSkip()/sizeof(U32); + + + U32* __restrict cw = (U32*) clothing_weightsp.get(); + const U32 cw_skip = vertex_weightsp.getSkip()/sizeof(U32); + + const U32* __restrict coords = (U32*) mMesh->getCoords(); + const U32* __restrict tex_coords = (U32*) mMesh->getTexCoords(); + const U32* __restrict normals = (U32*) mMesh->getNormals(); + const U32* __restrict weights = (U32*) mMesh->getWeights(); + const U32* __restrict cloth_weights = (U32*) mMesh->getClothingWeights(); + + const U32 num_verts = mMesh->getNumVertices(); + + U32 i = 0; + do { - verticesp[mMesh->mFaceVertexOffset + i] = *(mMesh->getCoords() + i); - tex_coordsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getTexCoords() + i); - normalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getNormals() + i); - vertex_weightsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getWeights() + i); - if (damp_wind) - { - clothing_weightsp[mMesh->mFaceVertexOffset + i] = LLVector4(0,0,0,0); - } - else - { - clothing_weightsp[mMesh->mFaceVertexOffset + i] = (*(mMesh->getClothingWeights() + i)); - } + v[0] = *(coords++); + v[1] = *(coords++); + v[2] = *(coords++); + v += vert_skip; + + tc[0] = *(tex_coords++); + tc[1] = *(tex_coords++); + tc += tc_skip; + + n[0] = *(normals++); + n[1] = *(normals++); + n[2] = *(normals++); + n += n_skip; + + vw[0] = *(weights++); + vw += vw_skip; + + cw[0] = *(cloth_weights++); + cw[1] = *(cloth_weights++); + cw[2] = *(cloth_weights++); + cw[3] = *(cloth_weights++); + cw += cw_skip; } + while (++i < num_verts); + + const U32 idx_count = mMesh->getNumFaces()*3; - for (S32 i = 0; i < mMesh->getNumFaces(); i++) + U16* __restrict idx = indicesp.get(); + S32* __restrict src_idx = (S32*) mMesh->getFaces(); + + i = 0; + + do { - for (U32 j = 0; j < 3; j++) - { - U32 k = i*3+j+mMesh->mFaceIndexOffset; - indicesp[k] = mMesh->getFaces()[i][j] + mMesh->mFaceVertexOffset; - } + *(idx++) = *(src_idx++); } + while (++i < idx_count); } } } -- cgit v1.2.3 From d568dbd840f8d4c7c87863abfd523054acfa2e2c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Apr 2010 15:53:26 -0500 Subject: Fix for busted optimizations. (transplanted from 6fae1a167f287f23a0cdc5dac8dfa2b74444efcf) --- indra/newview/llviewerjointmesh.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index b125c79f61..c65946a574 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -758,14 +758,18 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w const U32 idx_count = mMesh->getNumFaces()*3; + indicesp += mMesh->mFaceIndexOffset; + U16* __restrict idx = indicesp.get(); S32* __restrict src_idx = (S32*) mMesh->getFaces(); i = 0; + const S32 offset = (S32) mMesh->mFaceVertexOffset; + do { - *(idx++) = *(src_idx++); + *(idx++) = *(src_idx++)+offset; } while (++i < idx_count); } -- cgit v1.2.3 From daabccebf4a488d4704172013678e44718016a2f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Apr 2010 23:33:34 -0500 Subject: Remove foot shadows from llvoavatar and add terse update to LLViewerJointMesh::updateFaceData. (transplanted from 14545d24820e032279c81cb386dd043eeee625f7) --- indra/newview/llviewerjointmesh.cpp | 121 +++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 51 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index c65946a574..6be7c442ef 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -669,7 +669,7 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); -void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) +void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) { mFace = face; @@ -704,22 +704,6 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w vertex_weightsp += mMesh->mFaceVertexOffset; clothing_weightsp += mMesh->mFaceVertexOffset; - U32* __restrict v = (U32*) verticesp.get(); - const U32 vert_skip = verticesp.getSkip()/sizeof(U32); - - U32* __restrict tc = (U32*) tex_coordsp.get(); - const U32 tc_skip = tex_coordsp.getSkip()/sizeof(U32); - - U32* __restrict n = (U32*) normalsp.get(); - const U32 n_skip = normalsp.getSkip()/sizeof(U32); - - U32* __restrict vw = (U32*) vertex_weightsp.get(); - const U32 vw_skip = vertex_weightsp.getSkip()/sizeof(U32); - - - U32* __restrict cw = (U32*) clothing_weightsp.get(); - const U32 cw_skip = vertex_weightsp.getSkip()/sizeof(U32); - const U32* __restrict coords = (U32*) mMesh->getCoords(); const U32* __restrict tex_coords = (U32*) mMesh->getTexCoords(); const U32* __restrict normals = (U32*) mMesh->getNormals(); @@ -729,49 +713,84 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w const U32 num_verts = mMesh->getNumVertices(); U32 i = 0; - do + + const U32 skip = verticesp.getSkip()/sizeof(U32); + + U32* __restrict v = (U32*) verticesp.get(); + U32* __restrict n = (U32*) normalsp.get(); + + if (terse_update) { - v[0] = *(coords++); - v[1] = *(coords++); - v[2] = *(coords++); - v += vert_skip; - - tc[0] = *(tex_coords++); - tc[1] = *(tex_coords++); - tc += tc_skip; - - n[0] = *(normals++); - n[1] = *(normals++); - n[2] = *(normals++); - n += n_skip; - - vw[0] = *(weights++); - vw += vw_skip; - - cw[0] = *(cloth_weights++); - cw[1] = *(cloth_weights++); - cw[2] = *(cloth_weights++); - cw[3] = *(cloth_weights++); - cw += cw_skip; + for (S32 i = num_verts; i > 0; --i) + { + //morph target application only, only update positions and normals + v[0] = coords[0]; + v[1] = coords[1]; + v[2] = coords[2]; + coords += 3; + v += skip; + } + + for (S32 i = num_verts; i > 0; --i) + { + n[0] = normals[0]; + n[1] = normals[1]; + n[2] = normals[2]; + normals += 3; + n += skip; + } } - while (++i < num_verts); + else + { - const U32 idx_count = mMesh->getNumFaces()*3; + U32* __restrict tc = (U32*) tex_coordsp.get(); + U32* __restrict vw = (U32*) vertex_weightsp.get(); + U32* __restrict cw = (U32*) clothing_weightsp.get(); + + do + { + v[0] = *(coords++); + v[1] = *(coords++); + v[2] = *(coords++); + v += skip; + + tc[0] = *(tex_coords++); + tc[1] = *(tex_coords++); + tc += skip; + + n[0] = *(normals++); + n[1] = *(normals++); + n[2] = *(normals++); + n += skip; + + vw[0] = *(weights++); + vw += skip; + + cw[0] = *(cloth_weights++); + cw[1] = *(cloth_weights++); + cw[2] = *(cloth_weights++); + cw[3] = *(cloth_weights++); + cw += skip; + } + while (++i < num_verts); - indicesp += mMesh->mFaceIndexOffset; + const U32 idx_count = mMesh->getNumFaces()*3; - U16* __restrict idx = indicesp.get(); - S32* __restrict src_idx = (S32*) mMesh->getFaces(); + indicesp += mMesh->mFaceIndexOffset; - i = 0; + U16* __restrict idx = indicesp.get(); + S32* __restrict src_idx = (S32*) mMesh->getFaces(); - const S32 offset = (S32) mMesh->mFaceVertexOffset; + i = 0; - do - { - *(idx++) = *(src_idx++)+offset; + const S32 offset = (S32) mMesh->mFaceVertexOffset; + + do + { + *(idx++) = *(src_idx++)+offset; + } + while (++i < idx_count); } - while (++i < idx_count); } } } -- cgit v1.2.3 From 06b0d72efa96b6a0ed665f7cd46f358c48929e7b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 13 Aug 2010 07:24:57 -0400 Subject: Change license from GPL to LGPL (version 2.1) --- indra/newview/llviewerjointmesh.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 7225aa1523..d2c29adf27 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -2,31 +2,25 @@ * @file llviewerjointmesh.cpp * @brief Implementation of LLViewerJointMesh class * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From 98cc2365034a93c69704daa69efb389799cc9627 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 24 Aug 2010 18:44:39 +0100 Subject: Backed out changeset a62bf7c0af21 Backing out this merge that I pushed (prematurely) to the wrong place. --- indra/newview/llviewerjointmesh.cpp | 103 ++++++------------------------------ 1 file changed, 15 insertions(+), 88 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index ae2aa41b3a..d2c29adf27 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -661,9 +661,7 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- // updateFaceData() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); - -void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) +void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) { mFace = face; @@ -672,8 +670,6 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w return; } - LLFastTimer t(FTM_AVATAR_FACE); - LLStrider verticesp; LLStrider normalsp; LLStrider tex_coordsp; @@ -692,98 +688,29 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w face->mVertexBuffer->getIndexStrider(indicesp); stop_glerror(); - verticesp += mMesh->mFaceVertexOffset; - tex_coordsp += mMesh->mFaceVertexOffset; - normalsp += mMesh->mFaceVertexOffset; - vertex_weightsp += mMesh->mFaceVertexOffset; - clothing_weightsp += mMesh->mFaceVertexOffset; - - const U32* __restrict coords = (U32*) mMesh->getCoords(); - const U32* __restrict tex_coords = (U32*) mMesh->getTexCoords(); - const U32* __restrict normals = (U32*) mMesh->getNormals(); - const U32* __restrict weights = (U32*) mMesh->getWeights(); - const U32* __restrict cloth_weights = (U32*) mMesh->getClothingWeights(); - - const U32 num_verts = mMesh->getNumVertices(); - - U32 i = 0; - - const U32 skip = verticesp.getSkip()/sizeof(U32); - - U32* __restrict v = (U32*) verticesp.get(); - U32* __restrict n = (U32*) normalsp.get(); - - if (terse_update) + for (U16 i = 0; i < mMesh->getNumVertices(); i++) { - for (S32 i = num_verts; i > 0; --i) + verticesp[mMesh->mFaceVertexOffset + i] = *(mMesh->getCoords() + i); + tex_coordsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getTexCoords() + i); + normalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getNormals() + i); + vertex_weightsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getWeights() + i); + if (damp_wind) { - //morph target application only, only update positions and normals - v[0] = coords[0]; - v[1] = coords[1]; - v[2] = coords[2]; - coords += 3; - v += skip; + clothing_weightsp[mMesh->mFaceVertexOffset + i] = LLVector4(0,0,0,0); } - - for (S32 i = num_verts; i > 0; --i) + else { - n[0] = normals[0]; - n[1] = normals[1]; - n[2] = normals[2]; - normals += 3; - n += skip; + clothing_weightsp[mMesh->mFaceVertexOffset + i] = (*(mMesh->getClothingWeights() + i)); } } - else - { - U32* __restrict tc = (U32*) tex_coordsp.get(); - U32* __restrict vw = (U32*) vertex_weightsp.get(); - U32* __restrict cw = (U32*) clothing_weightsp.get(); - - do - { - v[0] = *(coords++); - v[1] = *(coords++); - v[2] = *(coords++); - v += skip; - - tc[0] = *(tex_coords++); - tc[1] = *(tex_coords++); - tc += skip; - - n[0] = *(normals++); - n[1] = *(normals++); - n[2] = *(normals++); - n += skip; - - vw[0] = *(weights++); - vw += skip; - - cw[0] = *(cloth_weights++); - cw[1] = *(cloth_weights++); - cw[2] = *(cloth_weights++); - cw[3] = *(cloth_weights++); - cw += skip; - } - while (++i < num_verts); - - const U32 idx_count = mMesh->getNumFaces()*3; - - indicesp += mMesh->mFaceIndexOffset; - - U16* __restrict idx = indicesp.get(); - S32* __restrict src_idx = (S32*) mMesh->getFaces(); - - i = 0; - - const S32 offset = (S32) mMesh->mFaceVertexOffset; - - do + for (S32 i = 0; i < mMesh->getNumFaces(); i++) + { + for (U32 j = 0; j < 3; j++) { - *(idx++) = *(src_idx++)+offset; + U32 k = i*3+j+mMesh->mFaceIndexOffset; + indicesp[k] = mMesh->getFaces()[i][j] + mMesh->mFaceVertexOffset; } - while (++i < idx_count); } } } -- cgit v1.2.3 From 36d942b30c32aeffaf734bd084bd407e5efa4102 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Apr 2010 13:00:01 -0500 Subject: Optimize LLViewerJointMesh::updateFaceData (transplanted from 365d7fdcd6a16d2b2cc4cbb0d721b4011487f33b) --- indra/newview/llviewerjointmesh.cpp | 124 ++++++++++++++++++++++++++---------- 1 file changed, 90 insertions(+), 34 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index d2c29adf27..b125c79f61 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -2,25 +2,31 @@ * @file llviewerjointmesh.cpp * @brief Implementation of LLViewerJointMesh class * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -661,6 +667,8 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- // updateFaceData() //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); + void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) { mFace = face; @@ -670,6 +678,8 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w return; } + LLFastTimer t(FTM_AVATAR_FACE); + LLStrider verticesp; LLStrider normalsp; LLStrider tex_coordsp; @@ -688,30 +698,76 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w face->mVertexBuffer->getIndexStrider(indicesp); stop_glerror(); - for (U16 i = 0; i < mMesh->getNumVertices(); i++) + verticesp += mMesh->mFaceVertexOffset; + tex_coordsp += mMesh->mFaceVertexOffset; + normalsp += mMesh->mFaceVertexOffset; + vertex_weightsp += mMesh->mFaceVertexOffset; + clothing_weightsp += mMesh->mFaceVertexOffset; + + U32* __restrict v = (U32*) verticesp.get(); + const U32 vert_skip = verticesp.getSkip()/sizeof(U32); + + U32* __restrict tc = (U32*) tex_coordsp.get(); + const U32 tc_skip = tex_coordsp.getSkip()/sizeof(U32); + + U32* __restrict n = (U32*) normalsp.get(); + const U32 n_skip = normalsp.getSkip()/sizeof(U32); + + U32* __restrict vw = (U32*) vertex_weightsp.get(); + const U32 vw_skip = vertex_weightsp.getSkip()/sizeof(U32); + + + U32* __restrict cw = (U32*) clothing_weightsp.get(); + const U32 cw_skip = vertex_weightsp.getSkip()/sizeof(U32); + + const U32* __restrict coords = (U32*) mMesh->getCoords(); + const U32* __restrict tex_coords = (U32*) mMesh->getTexCoords(); + const U32* __restrict normals = (U32*) mMesh->getNormals(); + const U32* __restrict weights = (U32*) mMesh->getWeights(); + const U32* __restrict cloth_weights = (U32*) mMesh->getClothingWeights(); + + const U32 num_verts = mMesh->getNumVertices(); + + U32 i = 0; + do { - verticesp[mMesh->mFaceVertexOffset + i] = *(mMesh->getCoords() + i); - tex_coordsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getTexCoords() + i); - normalsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getNormals() + i); - vertex_weightsp[mMesh->mFaceVertexOffset + i] = *(mMesh->getWeights() + i); - if (damp_wind) - { - clothing_weightsp[mMesh->mFaceVertexOffset + i] = LLVector4(0,0,0,0); - } - else - { - clothing_weightsp[mMesh->mFaceVertexOffset + i] = (*(mMesh->getClothingWeights() + i)); - } + v[0] = *(coords++); + v[1] = *(coords++); + v[2] = *(coords++); + v += vert_skip; + + tc[0] = *(tex_coords++); + tc[1] = *(tex_coords++); + tc += tc_skip; + + n[0] = *(normals++); + n[1] = *(normals++); + n[2] = *(normals++); + n += n_skip; + + vw[0] = *(weights++); + vw += vw_skip; + + cw[0] = *(cloth_weights++); + cw[1] = *(cloth_weights++); + cw[2] = *(cloth_weights++); + cw[3] = *(cloth_weights++); + cw += cw_skip; } + while (++i < num_verts); - for (S32 i = 0; i < mMesh->getNumFaces(); i++) + const U32 idx_count = mMesh->getNumFaces()*3; + + U16* __restrict idx = indicesp.get(); + S32* __restrict src_idx = (S32*) mMesh->getFaces(); + + i = 0; + + do { - for (U32 j = 0; j < 3; j++) - { - U32 k = i*3+j+mMesh->mFaceIndexOffset; - indicesp[k] = mMesh->getFaces()[i][j] + mMesh->mFaceVertexOffset; - } + *(idx++) = *(src_idx++); } + while (++i < idx_count); } } } -- cgit v1.2.3 From a20546a5dd82d16410b2c8d88c3f38d0833b6d3e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Apr 2010 15:53:26 -0500 Subject: Fix for busted optimizations. (transplanted from 6fae1a167f287f23a0cdc5dac8dfa2b74444efcf) --- indra/newview/llviewerjointmesh.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index b125c79f61..c65946a574 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -758,14 +758,18 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w const U32 idx_count = mMesh->getNumFaces()*3; + indicesp += mMesh->mFaceIndexOffset; + U16* __restrict idx = indicesp.get(); S32* __restrict src_idx = (S32*) mMesh->getFaces(); i = 0; + const S32 offset = (S32) mMesh->mFaceVertexOffset; + do { - *(idx++) = *(src_idx++); + *(idx++) = *(src_idx++)+offset; } while (++i < idx_count); } -- cgit v1.2.3 From e9da44aa093305de76417e62319119e7e478c726 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Apr 2010 23:33:34 -0500 Subject: Remove foot shadows from llvoavatar and add terse update to LLViewerJointMesh::updateFaceData. (transplanted from 14545d24820e032279c81cb386dd043eeee625f7) --- indra/newview/llviewerjointmesh.cpp | 121 +++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 51 deletions(-) (limited to 'indra/newview/llviewerjointmesh.cpp') diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index c65946a574..6be7c442ef 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -669,7 +669,7 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); -void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) +void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) { mFace = face; @@ -704,22 +704,6 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w vertex_weightsp += mMesh->mFaceVertexOffset; clothing_weightsp += mMesh->mFaceVertexOffset; - U32* __restrict v = (U32*) verticesp.get(); - const U32 vert_skip = verticesp.getSkip()/sizeof(U32); - - U32* __restrict tc = (U32*) tex_coordsp.get(); - const U32 tc_skip = tex_coordsp.getSkip()/sizeof(U32); - - U32* __restrict n = (U32*) normalsp.get(); - const U32 n_skip = normalsp.getSkip()/sizeof(U32); - - U32* __restrict vw = (U32*) vertex_weightsp.get(); - const U32 vw_skip = vertex_weightsp.getSkip()/sizeof(U32); - - - U32* __restrict cw = (U32*) clothing_weightsp.get(); - const U32 cw_skip = vertex_weightsp.getSkip()/sizeof(U32); - const U32* __restrict coords = (U32*) mMesh->getCoords(); const U32* __restrict tex_coords = (U32*) mMesh->getTexCoords(); const U32* __restrict normals = (U32*) mMesh->getNormals(); @@ -729,49 +713,84 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w const U32 num_verts = mMesh->getNumVertices(); U32 i = 0; - do + + const U32 skip = verticesp.getSkip()/sizeof(U32); + + U32* __restrict v = (U32*) verticesp.get(); + U32* __restrict n = (U32*) normalsp.get(); + + if (terse_update) { - v[0] = *(coords++); - v[1] = *(coords++); - v[2] = *(coords++); - v += vert_skip; - - tc[0] = *(tex_coords++); - tc[1] = *(tex_coords++); - tc += tc_skip; - - n[0] = *(normals++); - n[1] = *(normals++); - n[2] = *(normals++); - n += n_skip; - - vw[0] = *(weights++); - vw += vw_skip; - - cw[0] = *(cloth_weights++); - cw[1] = *(cloth_weights++); - cw[2] = *(cloth_weights++); - cw[3] = *(cloth_weights++); - cw += cw_skip; + for (S32 i = num_verts; i > 0; --i) + { + //morph target application only, only update positions and normals + v[0] = coords[0]; + v[1] = coords[1]; + v[2] = coords[2]; + coords += 3; + v += skip; + } + + for (S32 i = num_verts; i > 0; --i) + { + n[0] = normals[0]; + n[1] = normals[1]; + n[2] = normals[2]; + normals += 3; + n += skip; + } } - while (++i < num_verts); + else + { - const U32 idx_count = mMesh->getNumFaces()*3; + U32* __restrict tc = (U32*) tex_coordsp.get(); + U32* __restrict vw = (U32*) vertex_weightsp.get(); + U32* __restrict cw = (U32*) clothing_weightsp.get(); + + do + { + v[0] = *(coords++); + v[1] = *(coords++); + v[2] = *(coords++); + v += skip; + + tc[0] = *(tex_coords++); + tc[1] = *(tex_coords++); + tc += skip; + + n[0] = *(normals++); + n[1] = *(normals++); + n[2] = *(normals++); + n += skip; + + vw[0] = *(weights++); + vw += skip; + + cw[0] = *(cloth_weights++); + cw[1] = *(cloth_weights++); + cw[2] = *(cloth_weights++); + cw[3] = *(cloth_weights++); + cw += skip; + } + while (++i < num_verts); - indicesp += mMesh->mFaceIndexOffset; + const U32 idx_count = mMesh->getNumFaces()*3; - U16* __restrict idx = indicesp.get(); - S32* __restrict src_idx = (S32*) mMesh->getFaces(); + indicesp += mMesh->mFaceIndexOffset; - i = 0; + U16* __restrict idx = indicesp.get(); + S32* __restrict src_idx = (S32*) mMesh->getFaces(); - const S32 offset = (S32) mMesh->mFaceVertexOffset; + i = 0; - do - { - *(idx++) = *(src_idx++)+offset; + const S32 offset = (S32) mMesh->mFaceVertexOffset; + + do + { + *(idx++) = *(src_idx++)+offset; + } + while (++i < idx_count); } - while (++i < idx_count); } } } -- cgit v1.2.3