-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuck with CullingThreadPool #18
Comments
same problem. stuck at flush, seem that Reset() work unexpectly where mWritePtr and mRenderPtrs are not reset at the same time. |
I‘ve solved the problem by changing the order of some code //CullingThreadpool.cpp line 187
void CullingThreadpool::RenderJobQueue::Reset()
{
mWritePtr = 0;
mBinningPtr = 0;
for (unsigned int i = 0; i < mNumBins; ++i)
mRenderPtrs[i] = 0;
for (unsigned int i = 0; i < mMaxJobs; ++i)
{
mJobs[i].mBinningJobCompletedIdx = -1;
mJobs[i].mBinningJobStartedIdx = -1;
}
}
//after fix
void CullingThreadpool::RenderJobQueue::Reset()
{
mWritePtr = 0;
mBinningPtr = 0;
for (unsigned int i = 0; i < mMaxJobs; ++i)
{
mJobs[i].mBinningJobCompletedIdx = -1;
mJobs[i].mBinningJobStartedIdx = -1;
}
//change the order
for (unsigned int i = 0; i < mNumBins; ++i)
mRenderPtrs[i] = 0;
} There is another problem causing wrong culling result //CullingThreadpool.cpp line 314
CullingThreadpool::CullingThreadpool(unsigned int numThreads, unsigned int binsW, unsigned int binsH, unsigned int maxJobs) :
mNumThreads(numThreads),
mMaxJobs(maxJobs),
mBinsW(binsW),
mBinsH(binsH),
mKillThreads(false),
mSuspendThreads(true),
mNumSuspendedThreads(0),
mModelToClipMatrices(maxJobs),
mVertexLayouts(maxJobs),
mMOC(nullptr)
{ ... }
//after fix
CullingThreadpool::CullingThreadpool(unsigned int numThreads, unsigned int binsW, unsigned int binsH, unsigned int maxJobs) :
mNumThreads(numThreads),
mMaxJobs(maxJobs),
mBinsW(binsW),
mBinsH(binsH),
mKillThreads(false),
mSuspendThreads(true),
mNumSuspendedThreads(0),
mModelToClipMatrices(maxJobs + 1),
mVertexLayouts(maxJobs + 1),
mMOC(nullptr)
{ ... } finally,there are some threading problems can be found with turning on TSan on XCode with fixing these problem, MOC with CullingThreadPool works fine in our engine |
Thanks a lot! |
see mainline GameTechDev#18
The program got stuck when using CullingThreadPool, and going on with example code, I got the same problem after changing some code:
run FillrateTest
The text was updated successfully, but these errors were encountered: