Changed BarrierOperation so that it isn't limited to jut working within GraphicsContexts.
This commit is contained in:
@@ -54,7 +54,7 @@ struct OSG_EXPORT SwapBuffersOperation : public GraphicsOperation
|
||||
};
|
||||
|
||||
/** BarrierOperation allows one to syncronize multiple GraphicsThreads with each other.*/
|
||||
struct OSG_EXPORT BarrierOperation : public GraphicsOperation, public OpenThreads::Barrier
|
||||
struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barrier
|
||||
{
|
||||
enum PreBlockOp
|
||||
{
|
||||
@@ -64,13 +64,13 @@ struct OSG_EXPORT BarrierOperation : public GraphicsOperation, public OpenThread
|
||||
};
|
||||
|
||||
BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION):
|
||||
GraphicsOperation("Barrier", true),
|
||||
Operation("Barrier", true),
|
||||
OpenThreads::Barrier(numThreads),
|
||||
_preBlockOp(op) {}
|
||||
|
||||
virtual void release();
|
||||
|
||||
virtual void operator () (GraphicsContext* context);
|
||||
virtual void operator () (Object* object);
|
||||
|
||||
PreBlockOp _preBlockOp;
|
||||
};
|
||||
|
||||
@@ -58,11 +58,15 @@ void BarrierOperation::release()
|
||||
Barrier::release();
|
||||
}
|
||||
|
||||
void BarrierOperation::operator () (GraphicsContext*)
|
||||
void BarrierOperation::operator () (Object* object)
|
||||
{
|
||||
if (_preBlockOp==GL_FLUSH) glFlush();
|
||||
if (_preBlockOp==GL_FINISH) glFinish();
|
||||
|
||||
if (_preBlockOp!=NO_OPERATION)
|
||||
{
|
||||
GraphicsContext* context = dynamic_cast<GraphicsContext*>(object);
|
||||
if (_preBlockOp==GL_FLUSH) glFlush();
|
||||
else if (_preBlockOp==GL_FINISH) glFinish();
|
||||
}
|
||||
|
||||
block();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user