@@ -43,8 +43,7 @@ use the shader system.
4343
4444static transform_t bones[ MAX_BONES ];
4545
46- // Do not multithread loops not calling R_TBNtoQtangents().
47- #define NO_MT_IF_NO_TBNTOQ 1
46+ Cvar::Cvar<bool > r_parallelNotbntoq ( " r_parallelNotbntoq" , " r_parallelNotbntoq" , Cvar::NONE, true );
4847
4948template <typename T> void surfaceTasker ( const T& task, const size_t & amount )
5049{
@@ -1082,7 +1081,7 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
10821081 // Deform the vertices by the lerped bones.
10831082 if ( tess.skipTangents )
10841083 {
1085- # if NO_MT_IF_NO_TBNTOQ
1084+ if ( !r_parallelNotbntoq. Get () ) {
10861085 for ( ; tessVertex < lastVertex; tessVertex++,
10871086 surfaceVertex++ )
10881087 {
@@ -1106,7 +1105,7 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
11061105
11071106 Vector2Copy ( surfaceVertex->texCoords , tessVertex->texCoords );
11081107 }
1109- # else
1108+ } else {
11101109 auto task = [&]( size_t chunk_index ) -> void
11111110 {
11121111 size_t chunk_offset = chunk_index * chunk_size;
@@ -1147,7 +1146,7 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
11471146 };
11481147
11491148 surfaceTasker ( task, num_chunks );
1150- # endif
1149+ }
11511150 }
11521151 else
11531152 {
@@ -1342,7 +1341,7 @@ void Tess_SurfaceIQM( srfIQModel_t *surf ) {
13421341 byte *modelBlendIndex = model->blendIndexes + 4 * firstVertex;
13431342 byte *modelBlendWeight = model->blendWeights + 4 * firstVertex;
13441343
1345- # if NO_MT_IF_NO_TBNTOQ
1344+ if ( !r_parallelNotbntoq. Get () ) {
13461345 for ( ; tessVertex < lastVertex; tessVertex++,
13471346 modelPosition += 3 , modelNormal += 3 ,
13481347 modelTangent += 3 , modelBitangent += 3 ,
@@ -1371,7 +1370,7 @@ void Tess_SurfaceIQM( srfIQModel_t *surf ) {
13711370
13721371 Vector2Copy ( modelTexcoord, tessVertex->texCoords );
13731372 }
1374- # else
1373+ } else {
13751374 auto task = [&]( const size_t & chunk_index ) -> void
13761375 {
13771376 size_t chunk_offset = chunk_index * chunk_size;
@@ -1423,7 +1422,7 @@ void Tess_SurfaceIQM( srfIQModel_t *surf ) {
14231422 };
14241423
14251424 surfaceTasker ( task, num_chunks );
1426- # endif
1425+ }
14271426 }
14281427 else
14291428 {
0 commit comments