diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 17 | ||||
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 44 | ||||
-rwxr-xr-x | indra/newview/llappviewer.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh.cpp | 171 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh.h | 19 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_sse.cpp | 114 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_sse2.cpp | 121 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_vec.cpp | 97 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 21 |
10 files changed, 6 insertions, 646 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fa74804314..0467a93dfe 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -540,9 +540,6 @@ set(viewer_SOURCE_FILES llviewerjoint.cpp llviewerjointattachment.cpp llviewerjointmesh.cpp - llviewerjointmesh_sse.cpp - llviewerjointmesh_sse2.cpp - llviewerjointmesh_vec.cpp llviewerjoystick.cpp llviewerkeyboard.cpp llviewerlayer.cpp @@ -624,20 +621,6 @@ set(viewer_SOURCE_FILES set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING "The name of the viewer executable to create.") -if (LINUX) - # We can't set these flags for Darwin, because they get passed to - # the PPC compiler. Ugh. - - set_source_files_properties( - llviewerjointmesh_sse.cpp - PROPERTIES COMPILE_FLAGS "-msse -mfpmath=sse" - ) - set_source_files_properties( - llviewerjointmesh_sse2.cpp - PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse" - ) -endif (LINUX) - set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d057323e51..d07efa6a37 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12202,50 +12202,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>VectorizeEnable</key> - <map> - <key>Comment</key> - <string>Enable general vector operations and data alignment.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>VectorizePerfTest</key> - <map> - <key>Comment</key> - <string>Test SSE/vectorization performance and choose fastest version.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> - <key>VectorizeProcessor</key> - <map> - <key>Comment</key> - <string>0=Compiler Default, 1=SSE, 2=SSE2, autodetected</string> - <key>Persist</key> - <integer>0</integer> - <key>Type</key> - <string>U32</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>VectorizeSkin</key> - <map> - <key>Comment</key> - <string>Enable vector operations for avatar skinning.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>1</integer> - </map> <key>VelocityInterpolate</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dfb677dc2c..bab99e8a54 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -558,42 +558,6 @@ static void settings_modify() gDebugGL = gSavedSettings.getBOOL("RenderDebugGL") || gDebugSession; gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); gAuditTexture = gSavedSettings.getBOOL("AuditTexture"); -#if LL_VECTORIZE - if (gSysCPU.hasAltivec()) - { - gSavedSettings.setBOOL("VectorizeEnable", TRUE ); - gSavedSettings.setU32("VectorizeProcessor", 0 ); - } - else - if (gSysCPU.hasSSE2()) - { - gSavedSettings.setBOOL("VectorizeEnable", TRUE ); - gSavedSettings.setU32("VectorizeProcessor", 2 ); - } - else - if (gSysCPU.hasSSE()) - { - gSavedSettings.setBOOL("VectorizeEnable", TRUE ); - gSavedSettings.setU32("VectorizeProcessor", 1 ); - } - else - { - // Don't bother testing or running if CPU doesn't support it. JC - gSavedSettings.setBOOL("VectorizePerfTest", FALSE ); - gSavedSettings.setBOOL("VectorizeEnable", FALSE ); - gSavedSettings.setU32("VectorizeProcessor", 0 ); - gSavedSettings.setBOOL("VectorizeSkin", FALSE); - } -#else - // This build target doesn't support SSE, don't test/run. - gSavedSettings.setBOOL("VectorizePerfTest", FALSE ); - gSavedSettings.setBOOL("VectorizeEnable", FALSE ); - gSavedSettings.setU32("VectorizeProcessor", 0 ); - gSavedSettings.setBOOL("VectorizeSkin", FALSE); - - // disable fullscreen mode, unsupported - //gSavedSettings.setBOOL("WindowFullScreen", FALSE); -#endif } class LLFastTimerLogThread : public LLThread @@ -877,8 +841,6 @@ bool LLAppViewer::init() LLAgent::parseTeleportMessages("teleport_strings.xml"); - LLViewerJointMesh::updateVectorize(); - // load MIME type -> media impl mappings std::string mime_types_name; #if LL_DARWIN diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 03d765eaee..73e4d11d7b 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -452,12 +452,6 @@ bool handleEffectColorChanged(const LLSD& newvalue) return true; } -bool handleVectorizeChanged(const LLSD& newvalue) -{ - LLViewerJointMesh::updateVectorize(); - return true; -} - bool handleHighResSnapshotChanged(const LLSD& newvalue) { // High Res Snapshot active, must uncheck RenderUIInSnapshot @@ -692,10 +686,6 @@ void settings_setup_listeners() gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _2)); gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _2)); gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(handleHighResSnapshotChanged, _2)); - gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); - gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); - gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); - gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 3e20abecb7..b18323bed0 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -766,7 +766,7 @@ BOOL LLViewerJointMesh::updateLOD(F32 pixel_area, BOOL activate) } // static -void LLViewerJointMesh::updateGeometryOriginal(LLFace *mFace, LLPolyMesh *mMesh) +void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh) { LLStrider<LLVector3> o_vertices; LLStrider<LLVector3> o_normals; @@ -832,50 +832,6 @@ static F64 sUpdateGeometryRunAvgOn[10]; static U32 sUpdateGeometryRunCount = 0 ; static U32 sUpdateGeometryCalls = 0 ; static U32 sUpdateGeometryLastProcessor = 0 ; -static BOOL sVectorizePerfTest = FALSE; -static U32 sVectorizeProcessor = 0; - -//static -void (*LLViewerJointMesh::sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh); - -//static -void LLViewerJointMesh::updateVectorize() -{ - sVectorizePerfTest = gSavedSettings.getBOOL("VectorizePerfTest"); - sVectorizeProcessor = gSavedSettings.getU32("VectorizeProcessor"); - BOOL vectorizeEnable = gSavedSettings.getBOOL("VectorizeEnable"); - BOOL vectorizeSkin = gSavedSettings.getBOOL("VectorizeSkin"); - - std::string vp; - switch(sVectorizeProcessor) - { - case 2: vp = "SSE2"; break; // *TODO: replace the magic #s - case 1: vp = "SSE"; break; - default: vp = "COMPILER DEFAULT"; break; - } - LL_INFOS("AppInit") << "Vectorization : " << ( vectorizeEnable ? "ENABLED" : "DISABLED" ) << LL_ENDL ; - LL_INFOS("AppInit") << "Vector Processor : " << vp << LL_ENDL ; - LL_INFOS("AppInit") << "Vectorized Skinning : " << ( vectorizeSkin ? "ENABLED" : "DISABLED" ) << LL_ENDL ; - if(vectorizeEnable && vectorizeSkin) - { - switch(sVectorizeProcessor) - { - case 2: - sUpdateGeometryFunc = &updateGeometrySSE2; - break; - case 1: - sUpdateGeometryFunc = &updateGeometrySSE; - break; - default: - sUpdateGeometryFunc = &updateGeometryVectorized; - break; - } - } - else - { - sUpdateGeometryFunc = &updateGeometryOriginal; - } -} void LLViewerJointMesh::updateJointGeometry() { @@ -889,129 +845,8 @@ void LLViewerJointMesh::updateJointGeometry() return; } - if (!sVectorizePerfTest) - { - // Once we've measured performance, just run the specified - // code version. - if(sUpdateGeometryFunc == updateGeometryOriginal) - uploadJointMatrices(); - sUpdateGeometryFunc(mFace, mMesh); - } - else - { - // At startup, measure the amount of time in skinning and choose - // the fastest one. - LLTimer ug_timer ; - - if (sUpdateGeometryCallPointer) - { - if(sUpdateGeometryFunc == updateGeometryOriginal) - uploadJointMatrices(); - // call accelerated version for this processor - sUpdateGeometryFunc(mFace, mMesh); - } - else - { - uploadJointMatrices(); - updateGeometryOriginal(mFace, mMesh); - } - - sUpdateGeometryElapsedTime += ug_timer.getElapsedTimeF64(); - ++sUpdateGeometryCalls; - if(0 != (sUpdateGeometryCalls & UPDATE_GEOMETRY_CALL_OVERFLOW)) - { - F64 time_since_app_start = ug_timer.getElapsedSeconds(); - if(sUpdateGeometryGlobalTime == 0.0 - || sUpdateGeometryLastProcessor != sVectorizeProcessor) - { - sUpdateGeometryGlobalTime = time_since_app_start; - sUpdateGeometryElapsedTime = 0; - sUpdateGeometryCalls = 0; - sUpdateGeometryRunCount = 0; - sUpdateGeometryLastProcessor = sVectorizeProcessor; - sUpdateGeometryCallPointer = false; - return; - } - F64 percent_time_in_function = - ( sUpdateGeometryElapsedTime * 100.0 ) / ( time_since_app_start - sUpdateGeometryGlobalTime ) ; - sUpdateGeometryGlobalTime = time_since_app_start; - if (!sUpdateGeometryCallPointer) - { - // First set of run data is with vectorization off. - sUpdateGeometryCallPointer = true; - llinfos << "profile (avg of " << sUpdateGeometryCalls << " samples) = " - << "vectorize off " << percent_time_in_function - << "% of time with " - << (sUpdateGeometryElapsedTime / (F64)sUpdateGeometryCalls) - << " seconds per call " - << llendl; - sUpdateGeometryRunAvgOff[sUpdateGeometryRunCount] = percent_time_in_function; - sUpdateGeometryElapsedTimeOff += sUpdateGeometryElapsedTime; - sUpdateGeometryCalls = 0; - } - else - { - // Second set of run data is with vectorization on. - sUpdateGeometryCallPointer = false; - llinfos << "profile (avg of " << sUpdateGeometryCalls << " samples) = " - << "VEC on " << percent_time_in_function - << "% of time with " - << (sUpdateGeometryElapsedTime / (F64)sUpdateGeometryCalls) - << " seconds per call " - << llendl; - sUpdateGeometryRunAvgOn[sUpdateGeometryRunCount] = percent_time_in_function ; - sUpdateGeometryElapsedTimeOn += sUpdateGeometryElapsedTime; - - sUpdateGeometryCalls = 0; - sUpdateGeometryRunCount++; - F64 a = 0.0, b = 0.0; - for(U32 i = 0; i<sUpdateGeometryRunCount; i++) - { - a += sUpdateGeometryRunAvgOff[i]; - b += sUpdateGeometryRunAvgOn[i]; - } - a /= sUpdateGeometryRunCount; - b /= sUpdateGeometryRunCount; - F64 perf_boost = ( sUpdateGeometryElapsedTimeOff - sUpdateGeometryElapsedTimeOn ) / sUpdateGeometryElapsedTimeOn; - llinfos << "run averages (" << (F64)sUpdateGeometryRunCount - << "/10) vectorize off " << a - << "% : vectorize type " << sVectorizeProcessor - << " " << b - << "% : performance boost " - << perf_boost * 100.0 - << "%" - << llendl ; - if(sUpdateGeometryRunCount == 10) - { - // In case user runs test again, force reset of data on - // next run. - sUpdateGeometryGlobalTime = 0.0; - - // We have data now on which version is faster. Switch to that - // code and save the data for next run. - gSavedSettings.setBOOL("VectorizePerfTest", FALSE); - - if (perf_boost > 0.0) - { - llinfos << "Vectorization improves avatar skinning performance, " - << "keeping on for future runs." - << llendl; - gSavedSettings.setBOOL("VectorizeSkin", TRUE); - } - else - { - // SIMD decreases performance, fall back to original code - llinfos << "Vectorization decreases avatar skinning performance, " - << "switching back to original code." - << llendl; - - gSavedSettings.setBOOL("VectorizeSkin", FALSE); - } - } - } - sUpdateGeometryElapsedTime = 0.0f; - } - } + uploadJointMatrices(); + updateGeometry(mFace, mMesh); } void LLViewerJointMesh::dump() diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index cab1205d61..0191f0cae8 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -143,23 +143,10 @@ public: /*virtual*/ BOOL isAnimatable() const { return FALSE; } - static void updateVectorize(); // Update globals when settings variables change - private: - // Avatar vertex skinning is a significant performance issue on computers - // with avatar vertex programs turned off (for example, most Macs). We - // therefore have custom versions that use SIMD instructions. - // - // These functions require compiler options for SSE2, SSE, or neither, and - // hence are contained in separate individual .cpp files. JC - static void updateGeometryOriginal(LLFace* face, LLPolyMesh* mesh); - // generic vector code, used for Altivec - static void updateGeometryVectorized(LLFace* face, LLPolyMesh* mesh); - static void updateGeometrySSE(LLFace* face, LLPolyMesh* mesh); - static void updateGeometrySSE2(LLFace* face, LLPolyMesh* mesh); - - // Use a fuction pointer to indicate which version we are running. - static void (*sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh); + + //copy mesh into given face's vertex buffer, applying current animation pose + static void updateGeometry(LLFace* face, LLPolyMesh* mesh); private: // Allocate skin data diff --git a/indra/newview/llviewerjointmesh_sse.cpp b/indra/newview/llviewerjointmesh_sse.cpp deleted file mode 100644 index 00ed47e091..0000000000 --- a/indra/newview/llviewerjointmesh_sse.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @file llviewerjointmesh_sse.cpp - * @brief SSE vectorized joint skinning code, only used when video card does - * not support avatar vertex programs. - * - * *NOTE: Disabled on Windows builds. See llv4math.h for details. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * 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. - * - * 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. - * - * 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 - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- - -#include "llviewerprecompiledheaders.h" - -#include "llviewerjointmesh.h" - -// project includes -#include "llface.h" -#include "llpolymesh.h" - -// library includes -#include "lldarray.h" -#include "llv4math.h" // for LL_VECTORIZE -#include "llv4matrix3.h" -#include "llv4matrix4.h" -#include "v3math.h" - - -#if LL_VECTORIZE - -inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j) -{ - m.mV[VX] = _mm_loadu_ps(w->mMatrix[VX]); - m.mV[VY] = _mm_loadu_ps(w->mMatrix[VY]); - m.mV[VZ] = _mm_loadu_ps(w->mMatrix[VZ]); - m.mV[VW] = _mm_loadu_ps(w->mMatrix[VW]); - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VX]), m.mV[VX])); // ( ax * vx ) + vw - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VY]), m.mV[VY])); - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VZ]), m.mV[VZ])); -} - -// static -void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh) -{ - // This cannot be a file-level static because it will be initialized - // before main() using SSE code, which will crash on non-SSE processors. - static LLV4Matrix4 sJointMat[32]; - LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; - - //upload joint pivots/matrices - for(S32 j = 0, jend = joint_data.count(); j < jend ; ++j ) - { - matrix_translate(sJointMat[j], joint_data[j]->mWorldMatrix, - joint_data[j]->mSkinJoint ? - joint_data[j]->mSkinJoint->mRootToJointSkinOffset - : joint_data[j+1]->mSkinJoint->mRootToParentJointSkinOffset); - } - - F32 weight = F32_MAX; - LLV4Matrix4 blend_mat; - - LLStrider<LLVector3> o_vertices; - LLStrider<LLVector3> o_normals; - - LLVertexBuffer *buffer = face->getVertexBuffer(); - buffer->getVertexStrider(o_vertices, mesh->mFaceVertexOffset); - buffer->getNormalStrider(o_normals, mesh->mFaceVertexOffset); - - const F32* weights = mesh->getWeights(); - const LLVector3* coords = (const LLVector3*)mesh->getCoords(); - const LLVector3* normals = (const LLVector3*)mesh->getNormals(); - for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index) - { - if( weight != weights[index]) - { - S32 joint = llfloor(weight = weights[index]); - blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint); - } - blend_mat.multiply(coords[index], o_vertices[index]); - ((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]); - } - - buffer->flush(); -} - -#else - -void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh) -{ - LLViewerJointMesh::updateGeometryVectorized(face, mesh); -} - -#endif diff --git a/indra/newview/llviewerjointmesh_sse2.cpp b/indra/newview/llviewerjointmesh_sse2.cpp deleted file mode 100644 index c2296dd569..0000000000 --- a/indra/newview/llviewerjointmesh_sse2.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file llviewerjointmesh_sse2.cpp - * @brief SSE vectorized joint skinning code, only used when video card does - * not support avatar vertex programs. - * - * *NOTE: Disabled on Windows builds. See llv4math.h for details. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * 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. - * - * 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. - * - * 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 - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Visual Studio required settings for this file: -// Precompiled Headers OFF -// Code Generation: SSE2 - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- - -#include "llviewerprecompiledheaders.h" - -#include "llviewerjointmesh.h" - -// project includes -#include "llface.h" -#include "llpolymesh.h" - -// library includes -#include "lldarray.h" -#include "llstrider.h" -#include "llv4math.h" // for LL_VECTORIZE -#include "llv4matrix3.h" -#include "llv4matrix4.h" -#include "m4math.h" -#include "v3math.h" - - -#if LL_VECTORIZE - - -inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j) -{ - m.mV[VX] = _mm_loadu_ps(w->mMatrix[VX]); - m.mV[VY] = _mm_loadu_ps(w->mMatrix[VY]); - m.mV[VZ] = _mm_loadu_ps(w->mMatrix[VZ]); - m.mV[VW] = _mm_loadu_ps(w->mMatrix[VW]); - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VX]), m.mV[VX])); // ( ax * vx ) + vw - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VY]), m.mV[VY])); - m.mV[VW] = _mm_add_ps(m.mV[VW], _mm_mul_ps(_mm_set1_ps(j.mV[VZ]), m.mV[VZ])); -} - -// static -void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh) -{ - // This cannot be a file-level static because it will be initialized - // before main() using SSE code, which will crash on non-SSE processors. - static LLV4Matrix4 sJointMat[32]; - LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; - - //upload joint pivots/matrices - for(S32 j = 0, jend = joint_data.count(); j < jend ; ++j ) - { - matrix_translate(sJointMat[j], joint_data[j]->mWorldMatrix, - joint_data[j]->mSkinJoint ? - joint_data[j]->mSkinJoint->mRootToJointSkinOffset - : joint_data[j+1]->mSkinJoint->mRootToParentJointSkinOffset); - } - - F32 weight = F32_MAX; - LLV4Matrix4 blend_mat; - - LLStrider<LLVector3> o_vertices; - LLStrider<LLVector3> o_normals; - - LLVertexBuffer *buffer = face->getVertexBuffer(); - buffer->getVertexStrider(o_vertices, mesh->mFaceVertexOffset); - buffer->getNormalStrider(o_normals, mesh->mFaceVertexOffset); - - const F32* weights = mesh->getWeights(); - const LLVector3* coords = (const LLVector3*)mesh->getCoords(); - const LLVector3* normals = (const LLVector3*)mesh->getNormals(); - for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index) - { - if( weight != weights[index]) - { - S32 joint = llfloor(weight = weights[index]); - blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint); - } - blend_mat.multiply(coords[index], o_vertices[index]); - ((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]); - } - - //setBuffer(0) called in LLVOAvatar::renderSkinned -} - -#else - -void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh) -{ - LLViewerJointMesh::updateGeometryVectorized(face, mesh); -} - -#endif diff --git a/indra/newview/llviewerjointmesh_vec.cpp b/indra/newview/llviewerjointmesh_vec.cpp deleted file mode 100644 index a8713b6f05..0000000000 --- a/indra/newview/llviewerjointmesh_vec.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @file llviewerjointmesh_vec.cpp - * @brief Compiler-generated vectorized joint skinning code, works well on - * Altivec processors (PowerPC Mac) - * - * *NOTE: See llv4math.h for notes on SSE/Altivec vector code. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * 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. - * - * 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. - * - * 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 - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" - -#include "llviewerjointmesh.h" - -#include "llface.h" -#include "llpolymesh.h" -#include "llv4math.h" -#include "llv4matrix3.h" -#include "llv4matrix4.h" - -// Generic vectorized code, uses compiler defaults, works well for Altivec -// on PowerPC. - -// static -void LLViewerJointMesh::updateGeometryVectorized(LLFace *face, LLPolyMesh *mesh) -{ -#if 0 - static LLV4Matrix4 sJointMat[32]; - LLDynamicArray<LLJointRenderData*>& joint_data = mesh->getReferenceMesh()->mJointRenderData; - S32 j, joint_num, joint_end = joint_data.count(); - LLV4Vector3 pivot; - - //upload joint pivots/matrices - for(j = joint_num = 0; joint_num < joint_end ; ++joint_num ) - { - LLSkinJoint *sj; - const LLMatrix4 * wm = joint_data[joint_num]->mWorldMatrix; - if (NULL == (sj = joint_data[joint_num]->mSkinJoint)) - { - sj = joint_data[++joint_num]->mSkinJoint; - ((LLV4Matrix3)(sJointMat[j] = *wm)).multiply(sj->mRootToParentJointSkinOffset, pivot); - sJointMat[j++].translate(pivot); - wm = joint_data[joint_num]->mWorldMatrix; - } - ((LLV4Matrix3)(sJointMat[j] = *wm)).multiply(sj->mRootToJointSkinOffset, pivot); - sJointMat[j++].translate(pivot); - } - - F32 weight = F32_MAX; - LLV4Matrix4 blend_mat; - - LLStrider<LLVector3> o_vertices; - LLStrider<LLVector3> o_normals; - - LLVertexBuffer *buffer = face->mVertexBuffer; - buffer->getVertexStrider(o_vertices, mesh->mFaceVertexOffset); - buffer->getNormalStrider(o_normals, mesh->mFaceVertexOffset); - - const F32* weights = mesh->getWeights(); - const LLVector3* coords = mesh->getCoords(); - const LLVector3* normals = mesh->getNormals(); - for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index) - { - if( weight != weights[index]) - { - S32 joint = llfloor(weight = weights[index]); - blend_mat.lerp(sJointMat[joint], sJointMat[joint+1], weight - joint); - } - blend_mat.multiply(coords[index], o_vertices[index]); - ((LLV4Matrix3)blend_mat).multiply(normals[index], o_normals[index]); - } - - buffer->flush(); -#endif -} diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 22d95563d8..9fbc28a5e1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1038,26 +1038,6 @@ class LLAdvancedCheckRandomizeFramerate : public view_listener_t } }; -void run_vectorize_perf_test(void *) -{ - gSavedSettings.setBOOL("VectorizePerfTest", TRUE); -} - - -//////////////////////////////// -// RUN Vectorized Perform Test// -//////////////////////////////// - - -class LLAdvancedVectorizePerfTest : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - run_vectorize_perf_test(NULL); - return true; - } -}; - /////////////////////////// //// PERIODIC SLOW FRAME // /////////////////////////// @@ -8117,7 +8097,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedCheckRandomizeFramerate(), "Advanced.CheckRandomizeFramerate"); view_listener_t::addMenu(new LLAdvancedTogglePeriodicSlowFrame(), "Advanced.TogglePeriodicSlowFrame"); view_listener_t::addMenu(new LLAdvancedCheckPeriodicSlowFrame(), "Advanced.CheckPeriodicSlowFrame"); - view_listener_t::addMenu(new LLAdvancedVectorizePerfTest(), "Advanced.VectorizePerfTest"); view_listener_t::addMenu(new LLAdvancedToggleFrameTest(), "Advanced.ToggleFrameTest"); view_listener_t::addMenu(new LLAdvancedCheckFrameTest(), "Advanced.CheckFrameTest"); view_listener_t::addMenu(new LLAdvancedHandleAttachedLightParticles(), "Advanced.HandleAttachedLightParticles"); |