Skip to content

Commit 7e7418d

Browse files
committed
tr_model_iqm: parallel IQM model loading
1 parent 67ed90a commit 7e7418d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/engine/renderer/tr_model_iqm.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Maryland 20850 USA.
3333
*/
3434

3535
#include "tr_local.h"
36+
#include "framework/Omp.h"
3637
#include "GeometryOptimiser.h"
3738

3839
/* Flags -O2, -O3 and -0s produce SIGBUS in R_LoadIQModel() on armhf,
@@ -833,12 +834,15 @@ bool R_LoadIQModel( model_t *mod, const void *buffer, int filesize,
833834
i16vec4_t *qtangentbuf = static_cast<i16vec4_t *>(
834835
ri.Hunk_AllocateTempMemory( sizeof( i16vec4_t ) * IQModel->num_vertexes ) );
835836

836-
for(int i = 0; i < IQModel->num_vertexes; i++ ) {
837+
auto task = [&]( const size_t& i ) -> void
838+
{
837839
R_TBNtoQtangents( &IQModel->tangents[ 3 * i ],
838840
&IQModel->bitangents[ 3 * i ],
839841
&IQModel->normals[ 3 * i ],
840842
qtangentbuf[ i ] );
841-
}
843+
};
844+
845+
Omp::Tasker( task, IQModel->num_vertexes );
842846

843847
const vertexAttributeSpec_t attrs[] {
844848
{ ATTR_INDEX_BONE_FACTORS, GL_UNSIGNED_SHORT, GL_UNSIGNED_SHORT, boneFactorBuf, 4, sizeof( u16vec4_t ), 0 },

0 commit comments

Comments
 (0)