From 25bbeb0ba54884f9896696ed1fa8441622b98b3b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 14 Jun 2014 01:09:05 +0200 Subject: [PATCH] SSE2: Replace prefetch --- code/nel/src/3d/mesh_mrm_skin_template.cpp | 38 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/mesh_mrm_skin_template.cpp b/code/nel/src/3d/mesh_mrm_skin_template.cpp index 1958cae90..4a9e11106 100644 --- a/code/nel/src/3d/mesh_mrm_skin_template.cpp +++ b/code/nel/src/3d/mesh_mrm_skin_template.cpp @@ -39,7 +39,23 @@ static void applyArraySkinNormalT(uint numMatrixes, uint32 *infPtr, CMesh::CSkin { /* Prefetch all vertex/normal before, it is to be faster. */ -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#ifdef NL_HAS_SSE2 + { + uint nInfTmp= nInf; + uint32 *infTmpPtr= infPtr; + for(;nInfTmp>0;nInfTmp--, infTmpPtr++) + { + uint index= *infTmpPtr; + CMesh::CSkinWeight *srcSkin= srcSkinPtr + index; + CVector *srcVertex= srcVertexPtr + index; + CVector *srcNormal= srcNormalPtr + index; + + _mm_prefetch((const char *)(void *)srcSkin, _MM_HINT_T1); + _mm_prefetch((const char *)(void *)srcVertex, _MM_HINT_T1); + _mm_prefetch((const char *)(void *)srcNormal, _MM_HINT_T1); + } + } +#elif defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) { uint nInfTmp= nInf; uint32 *infTmpPtr= infPtr; @@ -176,7 +192,25 @@ static void applyArraySkinTangentSpaceT(uint numMatrixes, uint32 *infPtr, CMesh: { /* Prefetch all vertex/normal/tgSpace before, it is faster. */ -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#ifdef NL_HAS_SSE2 + { + uint nInfTmp= nInf; + uint32 *infTmpPtr= infPtr; + for(;nInfTmp>0;nInfTmp--, infTmpPtr++) + { + uint index= *infTmpPtr; + CMesh::CSkinWeight *srcSkin= srcSkinPtr + index; + CVector *srcVertex= srcVertexPtr + index; + CVector *srcNormal= srcNormalPtr + index; + CVector *srcTgSpace= tgSpacePtr + index; + + _mm_prefetch((const char *)(void *)srcSkin, _MM_HINT_T1); + _mm_prefetch((const char *)(void *)srcVertex, _MM_HINT_T1); + _mm_prefetch((const char *)(void *)srcNormal, _MM_HINT_T1); + _mm_prefetch((const char *)(void *)srcTgSpace, _MM_HINT_T1); + } + } +#elif defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) { uint nInfTmp= nInf; uint32 *infTmpPtr= infPtr;