Skip to content

Commit b81f9e4

Browse files
committed
tr_model_skel: parallel MD5 model loading
1 parent 864083b commit b81f9e4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/engine/renderer/tr_model_skel.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
*/
2323
// tr_models.c -- model loading and caching
2424
#include "tr_local.h"
25+
#include "framework/Omp.h"
2526
#include "GLUtils.h"
2627

2728
bool R_AddTriangleToVBOTriangleList(
@@ -103,8 +104,6 @@ srfVBOMD5Mesh_t *R_GenerateMD5VBOSurface(
103104
Str::StringRef surfName, const std::vector<skelTriangle_t> &vboTriangles,
104105
md5Model_t *md5, md5Surface_t *surf, int skinIndex, int boneReferences[ MAX_BONES ] )
105106
{
106-
int j;
107-
108107
int vertexesNum;
109108

110109
int indexesNum;
@@ -133,7 +132,7 @@ srfVBOMD5Mesh_t *R_GenerateMD5VBOSurface(
133132
memset( vboSurf->boneRemap, 0, sizeof( vboSurf->boneRemap ) );
134133
memset( vboSurf->boneRemapInverse, 0, sizeof( vboSurf->boneRemapInverse ) );
135134

136-
for ( j = 0; j < MAX_BONES; j++ )
135+
for ( size_t j = 0; j < MAX_BONES; j++ )
137136
{
138137
if ( boneReferences[ j ] > 0 )
139138
{
@@ -154,7 +153,7 @@ srfVBOMD5Mesh_t *R_GenerateMD5VBOSurface(
154153
}
155154
}
156155

157-
for ( j = 0; j < vertexesNum; j++ )
156+
auto task = [&]( const size_t& j ) -> void
158157
{
159158
R_TBNtoQtangents( surf->verts[ j ].tangent, surf->verts[ j ].binormal,
160159
surf->verts[ j ].normal, qtangents[ j ] );
@@ -171,7 +170,9 @@ srfVBOMD5Mesh_t *R_GenerateMD5VBOSurface(
171170
boneFactors[ j ][ k ] = 0;
172171
}
173172
}
174-
}
173+
};
174+
175+
Omp::Tasker( task, vertexesNum );
175176

176177
// MD5 does not have color, but shaders always require the color vertex attribute, so we have
177178
// to provide this 0 color.

0 commit comments

Comments
 (0)