diff options
-rw-r--r-- | indra/llmath/llv4math.h | 22 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_sse.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_sse2.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewerjointmesh_vec.cpp | 17 |
4 files changed, 43 insertions, 23 deletions
diff --git a/indra/llmath/llv4math.h b/indra/llmath/llv4math.h index 4a299716b1..f064b39947 100644 --- a/indra/llmath/llv4math.h +++ b/indra/llmath/llv4math.h @@ -9,6 +9,25 @@ #ifndef LL_LLV4MATH_H #define LL_LLV4MATH_H +// *NOTE: We do not support SSE acceleration on Windows builds. +// Our minimum specification for the viewer includes 1 GHz Athlon processors, +// which covers the Athlon Thunderbird series that does not support SSE. +// +// Our header files include statements like this +// const F32 HAVOK_TIMESTEP = 1.f / 45.f; +// This creates "globals" that are included in each .obj file. If a single +// .cpp file has SSE code generation turned on (eg, llviewerjointmesh_sse.cpp) +// these globals will be initialized using SSE instructions. This causes SL +// to crash before main() on processors without SSE. Untangling all these +// headers/variables is too much work for the small performance gains of +// vectorization. +// +// Therefore we only support vectorization on builds where the everything is +// built with SSE or Altivec. See https://jira.secondlife.com/browse/VWR-1610 +// and https://jira.lindenlab.com/browse/SL-47720 for details. +// +// Sorry the code is such a mess. JC + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // LLV4MATH - GNUC @@ -46,6 +65,9 @@ typedef float V4F32 __attribute__((vector_size(16))); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +// Only vectorize if the entire Windows build uses SSE. +// _M_IX86_FP is set when SSE code generation is turned on, and I have +// confirmed this in VS2003, VS2003 SP1, and VS2005. JC #if LL_MSVC && _M_IX86_FP #define LL_VECTORIZE 1 diff --git a/indra/newview/llviewerjointmesh_sse.cpp b/indra/newview/llviewerjointmesh_sse.cpp index c4f8ff4fa8..579c5d2687 100644 --- a/indra/newview/llviewerjointmesh_sse.cpp +++ b/indra/newview/llviewerjointmesh_sse.cpp @@ -1,6 +1,9 @@ /** - * @file llviewerjointmesh.cpp - * @brief LLV4 class implementation with LLViewerJointMesh class + * @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. * * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. * $License$ @@ -10,9 +13,7 @@ // Header Files //----------------------------------------------------------------------------- -// Do not use precompiled headers, because we need to build this file with -// SSE support, but not the precompiled header file. JC -#include "linden_common.h" +#include "llviewerprecompiledheaders.h" #include "llviewerjointmesh.h" @@ -27,7 +28,6 @@ #include "llv4matrix4.h" #include "v3math.h" -// *NOTE: SSE must be enabled for this module #if LL_VECTORIZE @@ -88,7 +88,6 @@ void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh) void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh) { LLViewerJointMesh::updateGeometryVectorized(face, mesh); - return; } #endif diff --git a/indra/newview/llviewerjointmesh_sse2.cpp b/indra/newview/llviewerjointmesh_sse2.cpp index cae602ac14..9ef2b4692a 100644 --- a/indra/newview/llviewerjointmesh_sse2.cpp +++ b/indra/newview/llviewerjointmesh_sse2.cpp @@ -1,6 +1,9 @@ /** - * @file llviewerjointmesh.cpp - * @brief LLV4 class implementation with LLViewerJointMesh class + * @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. * * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. * $License$ @@ -10,9 +13,7 @@ // Header Files //----------------------------------------------------------------------------- -// Do not use precompiled headers, because we need to build this file with -// SSE support, but not the precompiled header file. JC -#include "linden_common.h" +#include "llviewerprecompiledheaders.h" #include "llviewerjointmesh.h" @@ -29,10 +30,10 @@ #include "m4math.h" #include "v3math.h" -// *NOTE: SSE2 must be enabled for this module #if LL_VECTORIZE + static LLV4Matrix4 sJointMat[32]; inline void matrix_translate(LLV4Matrix4& m, const LLMatrix4* w, const LLVector3& j) @@ -90,7 +91,6 @@ void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh) void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh) { LLViewerJointMesh::updateGeometryVectorized(face, mesh); - return; } #endif diff --git a/indra/newview/llviewerjointmesh_vec.cpp b/indra/newview/llviewerjointmesh_vec.cpp index adc602bdaf..69ddad63fc 100644 --- a/indra/newview/llviewerjointmesh_vec.cpp +++ b/indra/newview/llviewerjointmesh_vec.cpp @@ -1,8 +1,11 @@ /** - * @file llviewerjointmesh.cpp - * @brief LLV4 math class implementation with LLViewerJointMesh class + * @file llviewerjointmesh_vec.cpp + * @brief Compiler-generated vectorized joint skinning code, works well on + * Altivec processors (PowerPC Mac) * - * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. + * *NOTE: See llv4math.h for notes on SSE/Altivec vector code. + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. * $License$ */ @@ -19,12 +22,8 @@ #include "llv4matrix3.h" #include "llv4matrix4.h" -// *NOTE: This is the fallback code for vectorized joint mesh skinning. -// For builds that must support non-SSE x86 code (Windows, perhaps Linux) -// SSE code generation should be disabled for this file. -// -// For builds that run on processors that always have SSE (Mac), -// SSE code generation can be enabled. JC +// Generic vectorized code, uses compiler defaults, works well for Altivec +// on PowerPC. static LLV4Matrix4 sJointMat[32]; |