diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 0b017dfd03..bdd14614bd 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -2128,15 +2128,26 @@ bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index, S32 co return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) +// Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis +//bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) +//{ +// return VertexBufferStrider::get(*this, strider, index, count, map_range); +//} +// +//bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) +//{ +// return VertexBufferStrider::get(*this, strider, index, count, map_range); +//} +bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) +bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } +// //---------------------------------------------------------------------------- diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 74c8d09b1f..8b0ae27296 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -258,8 +258,12 @@ public: bool getTextureIndexStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getEmissiveStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + //bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + // bool useVBOs() const; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ea116b4b68..92c387dcf7 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -503,7 +503,10 @@ U16 LLFace::getGeometryAvatar( LLStrider &normals, LLStrider &tex_coords, LLStrider &vertex_weights, - LLStrider &clothing_weights) + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider &clothing_weights) + LLStrider &clothing_weights) + // { if (mVertexBuffer.notNull()) { @@ -1189,11 +1192,15 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) if (vf.mWeights) { - LLStrider f_wght; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider f_wght; + LLStrider f_wght; buff->getWeight4Strider(f_wght); for (U32 i = 0; i < vf.mNumVertices; ++i) { - (*f_wght++).set(vf.mWeights[i].getF32ptr()); + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //(*f_wght++).set(vf.mWeights[i].getF32ptr()); + (*f_wght++) = vf.mWeights[i]; } } @@ -1316,7 +1323,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLStrider colors; LLStrider tangent; LLStrider indicesp; - LLStrider wght; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider wght; + LLStrider wght; BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME); @@ -2185,8 +2194,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_WEIGHTS); mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); - F32* weights = (F32*) wght.get(); - LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //F32* weights = (F32*) wght.get(); + //LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); + for (S32 i = 0; i < num_vertices; ++i) + { + *(wght++) = vf.mWeights[i]; + } + // if (map_range) { mVertexBuffer->flush(); diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 35cfdc1f8b..5e3a83bcfd 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -174,7 +174,9 @@ public: LLStrider &normals, LLStrider &texCoords, LLStrider &vertex_weights, - LLStrider &clothing_weights); + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider &clothing_weights); + LLStrider &clothing_weights); // For volumes, etc. U16 getGeometry(LLStrider &vertices, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e17e8067a4..49c59e1620 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3428,7 +3428,9 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) LLStrider normal_strider; LLStrider tc_strider; LLStrider index_strider; - LLStrider weights_strider; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider weights_strider; + LLStrider weights_strider; vb->getVertexStrider(vertex_strider); vb->getIndexStrider(index_strider); @@ -3474,7 +3476,9 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) //should not cause floating point precision issues. } - *(weights_strider++) = w; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //*(weights_strider++) = w; + (*(weights_strider++)).loadua(w.mV); } } @@ -4186,7 +4190,9 @@ BOOL LLModelPreview::render() LLStrider position; buffer->getVertexStrider(position); - LLStrider weight; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider weight; + LLStrider weight; buffer->getWeight4Strider(weight); //quick 'n dirty software vertex skinning @@ -4204,7 +4210,10 @@ BOOL LLModelPreview::render() for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; - F32 *wptr = weight[j].mV; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //F32 *wptr = weight[j].mV; + F32 *wptr = weight[j].getF32ptr(); + // LLSkinningUtil::getPerVertexSkinMatrix(wptr, mat, true, final_mat, max_joints); //VECTORIZE THIS diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 43a81ada49..f858ed7afb 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -405,7 +405,9 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w LLStrider normalsp; LLStrider tex_coordsp; LLStrider vertex_weightsp; - LLStrider clothing_weightsp; + // Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis + //LLStrider clothing_weightsp; + LLStrider clothing_weightsp; LLStrider indicesp; // Copy data into the faces from the polymesh data.