Skip to content

Commit

Permalink
Move NUM_THREADS to stdafx.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Jan 27, 2018
1 parent 62bb2af commit ff4b7c0
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/utils/xrAI/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"

#define NUM_THREADS 8

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
extern CThreadManager::ReportStatusFunc ProxyStatus;
Expand Down
1 change: 0 additions & 1 deletion src/utils/xrAI/compiler_cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ void compute_non_covers()
delete_data(nearest);
}

#define NUM_THREADS 3
extern void mem_Optimize();
void xrCover(bool pure_covers)
{
Expand Down
2 changes: 2 additions & 0 deletions src/utils/xrLC/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"

#define NUM_THREADS 8

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
extern CThreadManager::ReportStatusFunc ProxyStatus;
Expand Down
3 changes: 1 addition & 2 deletions src/utils/xrLC/xrLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ void CBuild::LMapsLocal()
// Main process (4 threads)
Logger.Status("Lighting...");
CThreadManager threads(ProxyStatus, ProxyProgress);
const u32 thNUM = 6;
CTimer start_time;
start_time.Start();
for (int L = 0; L < thNUM; L++)
for (int L = 0; L < NUM_THREADS; L++)
threads.start(new CLMThread(L));
threads.wait(500);
Logger.clMsg("%f seconds", start_time.GetElapsed_sec());
Expand Down
6 changes: 2 additions & 4 deletions src/utils/xrLC/xrPhase_AdaptiveHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class CPrecalcBaseHemiThread : public CThread
}
};

CThreadManager precalc_base_hemi(ProxyStatus, ProxyProgress);

void CBuild::xrPhase_AdaptiveHT()
{
CDB::COLLIDER DB;
Expand Down Expand Up @@ -205,11 +203,11 @@ void CBuild::xrPhase_AdaptiveHT()
// V->C._set (vC);
//}

CThreadManager precalc_base_hemi(ProxyStatus, ProxyProgress);
u32 stride = u32(-1);

u32 threads = u32(-1);
u32 rest = u32(-1);
get_intervals(8, lc_global_data()->g_vertices().size(), threads, stride, rest);
get_intervals(NUM_THREADS, lc_global_data()->g_vertices().size(), threads, stride, rest);
for (u32 thID = 0; thID < threads; thID++)
precalc_base_hemi.start(new CPrecalcBaseHemiThread(thID, thID * stride, thID * stride + stride));
if (rest > 0)
Expand Down
5 changes: 2 additions & 3 deletions src/utils/xrLC/xrPhase_GI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "xrCore/Threading/Lock.hpp"
#include "xrCDB/xrCDB.h"

#define GI_THREADS 2
const u32 gi_num_photons = 32;
const float gi_optimal_range = 15.f;
const float gi_reflect = 0.9f;
Expand Down Expand Up @@ -118,7 +117,7 @@ class CGI : public CThread
dst.type = LT_SECONDARY;
dst.level++;
task_it++;
thProgress = float(task_it) / float(task->size()) / float(GI_THREADS);
thProgress = float(task_it) / float(task->size()) / float(NUM_THREADS);
}
task_cs.Leave();
if (dst.level > gi_maxlevel)
Expand Down Expand Up @@ -227,7 +226,7 @@ void CBuild::xrPhase_Radiosity()

// perform all the work
u32 setup_old = task->size();
for (int t = 0; t < GI_THREADS; t++)
for (int t = 0; t < NUM_THREADS; t++)
{
gi.start(new CGI(t));
Sleep(10);
Expand Down
2 changes: 0 additions & 2 deletions src/utils/xrLC_Light/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "lightthread.h"
#include "xrLightDoNet.h"

#define NUM_THREADS 3

void xrLight()
{
u32 range = gl_data.slots_data.size_z();
Expand Down
2 changes: 2 additions & 0 deletions src/utils/xrLC_Light/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"

#define NUM_THREADS 8

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
extern CThreadManager::ReportStatusFunc ProxyStatus;
Expand Down
1 change: 0 additions & 1 deletion src/utils/xrLC_Light/xrLightVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ namespace lc_net
{
void RunLightVertexNet();
}
#define NUM_THREADS 4
void LightVertex(bool net)
{
g_trans = new mapVert();
Expand Down
1 change: 0 additions & 1 deletion src/utils/xrLC_Light/xrLight_ImplicitThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void ImplicitThread::Execute()
execute.Execute(0);
}

#define NUM_THREADS 8
void RunImplicitMultithread(ImplicitDeflector& defl)
{
// Start threads
Expand Down

0 comments on commit ff4b7c0

Please sign in to comment.