Introduced OpenThreads::Affinity support into osg::Camera, osg::GraphicsContext::Traitse, osgDB::DatabasePager and osgViewer::ViewerBase/Viewer/CompositeViewer.

Added ViewerBase::configureAffinity() to help with the setting of the affinity of camera, graphics context and pager threads
This commit is contained in:
Robert Osfield
2016-09-28 18:44:58 +01:00
parent 77c5e96ccb
commit ee97db3488
10 changed files with 161 additions and 91 deletions

View File

@@ -74,6 +74,7 @@ Camera::Camera(const Camera& camera,const CopyOp& copyop):
_implicitBufferAttachmentRenderMask(camera._implicitBufferAttachmentRenderMask),
_implicitBufferAttachmentResolveMask(camera._implicitBufferAttachmentResolveMask),
_attachmentMapModifiedCount(camera._attachmentMapModifiedCount),
_affinity(camera._affinity),
_initialDrawCallback(camera._initialDrawCallback),
_preDrawCallback(camera._preDrawCallback),
_postDrawCallback(camera._postDrawCallback),
@@ -521,6 +522,12 @@ void Camera::resize(int width, int height, int resizeMask)
}
}
void Camera::setProcessorAffinity(const OpenThreads::Affinity& affinity)
{
_affinity = affinity;
if (_cameraThread.valid()) _cameraThread->setProcessorAffinity(affinity);
}
void Camera::createCameraThread()
{
@@ -543,6 +550,8 @@ void Camera::setCameraThread(OperationThread* gt)
_cameraThread = gt;
_cameraThread->setProcessorAffinity(_affinity);
if (_cameraThread.valid())
{
_cameraThread->setParent(this);

View File

@@ -589,6 +589,11 @@ void GraphicsContext::createGraphicsThread()
if (!_graphicsThread)
{
setGraphicsThread(new GraphicsThread);
if (_traits.valid())
{
_graphicsThread->setProcessorAffinity(_traits->affinity);
}
}
}