Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis (Alchemy Viewer)

master
Ansariel 2017-03-05 13:18:13 +01:00
parent a3f5dbde12
commit 2a1d8b4632
6 changed files with 61 additions and 18 deletions

View File

@ -2128,15 +2128,26 @@ bool LLVertexBuffer::getWeightStrider(LLStrider<F32>& strider, S32 index, S32 co
return VertexBufferStrider<F32,TYPE_WEIGHT>::get(*this, strider, index, count, map_range);
}
bool LLVertexBuffer::getWeight4Strider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//bool LLVertexBuffer::getWeight4Strider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
//{
// return VertexBufferStrider<LLVector4,TYPE_WEIGHT4>::get(*this, strider, index, count, map_range);
//}
//
//bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
//{
// return VertexBufferStrider<LLVector4,TYPE_CLOTHWEIGHT>::get(*this, strider, index, count, map_range);
//}
bool LLVertexBuffer::getWeight4Strider(LLStrider<LLVector4a>& strider, S32 index, S32 count, bool map_range)
{
return VertexBufferStrider<LLVector4,TYPE_WEIGHT4>::get(*this, strider, index, count, map_range);
return VertexBufferStrider<LLVector4a,TYPE_WEIGHT4>::get(*this, strider, index, count, map_range);
}
bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 index, S32 count, bool map_range)
{
return VertexBufferStrider<LLVector4,TYPE_CLOTHWEIGHT>::get(*this, strider, index, count, map_range);
return VertexBufferStrider<LLVector4a,TYPE_CLOTHWEIGHT>::get(*this, strider, index, count, map_range);
}
// </FS:Ansariel>
//----------------------------------------------------------------------------

View File

@ -258,8 +258,12 @@ public:
bool getTextureIndexStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
//bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeight4Strider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
// </FS:Ansariel>
bool useVBOs() const;

View File

@ -503,7 +503,10 @@ U16 LLFace::getGeometryAvatar(
LLStrider<LLVector3> &normals,
LLStrider<LLVector2> &tex_coords,
LLStrider<F32> &vertex_weights,
LLStrider<LLVector4> &clothing_weights)
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> &clothing_weights)
LLStrider<LLVector4a> &clothing_weights)
// </FS:Ansariel>
{
if (mVertexBuffer.notNull())
{
@ -1189,11 +1192,15 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf)
if (vf.mWeights)
{
LLStrider<LLVector4> f_wght;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> f_wght;
LLStrider<LLVector4a> f_wght;
buff->getWeight4Strider(f_wght);
for (U32 i = 0; i < vf.mNumVertices; ++i)
{
(*f_wght++).set(vf.mWeights[i].getF32ptr());
// <FS:Ansariel> 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<LLColor4U> colors;
LLStrider<LLVector3> tangent;
LLStrider<U16> indicesp;
LLStrider<LLVector4> wght;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> wght;
LLStrider<LLVector4a> 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));
// <FS:Ansariel> 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];
}
// </FS:Ansariel>
if (map_range)
{
mVertexBuffer->flush();

View File

@ -174,7 +174,9 @@ public:
LLStrider<LLVector3> &normals,
LLStrider<LLVector2> &texCoords,
LLStrider<F32> &vertex_weights,
LLStrider<LLVector4> &clothing_weights);
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> &clothing_weights);
LLStrider<LLVector4a> &clothing_weights);
// For volumes, etc.
U16 getGeometry(LLStrider<LLVector3> &vertices,

View File

@ -3428,7 +3428,9 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
LLStrider<LLVector3> normal_strider;
LLStrider<LLVector2> tc_strider;
LLStrider<U16> index_strider;
LLStrider<LLVector4> weights_strider;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> weights_strider;
LLStrider<LLVector4a> 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;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//*(weights_strider++) = w;
(*(weights_strider++)).loadua(w.mV);
}
}
@ -4186,7 +4190,9 @@ BOOL LLModelPreview::render()
LLStrider<LLVector3> position;
buffer->getVertexStrider(position);
LLStrider<LLVector4> weight;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> weight;
LLStrider<LLVector4a> 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;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//F32 *wptr = weight[j].mV;
F32 *wptr = weight[j].getF32ptr();
// </FS:Ansariel>
LLSkinningUtil::getPerVertexSkinMatrix(wptr, mat, true, final_mat, max_joints);
//VECTORIZE THIS

View File

@ -405,7 +405,9 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
LLStrider<LLVector3> normalsp;
LLStrider<LLVector2> tex_coordsp;
LLStrider<F32> vertex_weightsp;
LLStrider<LLVector4> clothing_weightsp;
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
//LLStrider<LLVector4> clothing_weightsp;
LLStrider<LLVector4a> clothing_weightsp;
LLStrider<U16> indicesp;
// Copy data into the faces from the polymesh data.