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:
@@ -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);
|
||||
|
||||
@@ -589,6 +589,11 @@ void GraphicsContext::createGraphicsThread()
|
||||
if (!_graphicsThread)
|
||||
{
|
||||
setGraphicsThread(new GraphicsThread);
|
||||
|
||||
if (_traits.valid())
|
||||
{
|
||||
_graphicsThread->setProcessorAffinity(_traits->affinity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user