vtkGPUVolumeRayCastMapper getting GPUInfo is slow
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Change below only gets the max video memory once -
vtkGPUVolumeRayCastMapper::vtkGPUVolumeRayCastMapper() { this->AutoAdjustSampleDistances = 1; this->ImageSampleDistance = 1.0; this->MinimumImageSampleDistance = 1.0; this->MaximumImageSampleDistance = 10.0; this->SampleDistance = 1.0; this->SmallVolumeRender = 0; this->BigTimeToDraw = 0.0; this->SmallTimeToDraw = 0.0; this->FinalColorWindow = 1.0; this->FinalColorLevel = 0.5; this->GeneratingCanonicalView = 0; this->CanonicalViewImageData = NULL;
this->MaskInput = NULL; this->MaskBlendFactor = 1.0f; this->MaskType = vtkGPUVolumeRayCastMapper::LabelMapMaskType;
this->AMRMode=0; this->ClippedCroppingRegionPlanes[0]=VTK_DOUBLE_MAX; this->ClippedCroppingRegionPlanes[1]=VTK_DOUBLE_MIN; this->ClippedCroppingRegionPlanes[2]=VTK_DOUBLE_MAX; this->ClippedCroppingRegionPlanes[3]=VTK_DOUBLE_MIN; this->ClippedCroppingRegionPlanes[4]=VTK_DOUBLE_MAX; this->ClippedCroppingRegionPlanes[5]=VTK_DOUBLE_MIN;
// :ADSK: JNH, force abs on memory sizes, only calculate once static vtkIdType maxMemoryInBytes = 0 ; if ( maxMemoryInBytes == 0 ) { vtkGPUInfoList *l=vtkGPUInfoList::New(); l->Probe(); if(l->GetNumberOfGPUs()>0) { vtkGPUInfo *info=l->GetGPUInfo(0); maxMemoryInBytes=info->GetDedicatedVideoMemory();
if( maxMemoryInBytes < 0 )
maxMemoryInBytes *= -1 ;
if(maxMemoryInBytes == 0)
{
maxMemoryInBytes=info->GetDedicatedSystemMemory();
}
if( maxMemoryInBytes < 0 )
maxMemoryInBytes *= -1 ;
}
l->Delete();
if (maxMemoryInBytes == 0)
{
char* env = getenv("VTK_MAX_GPU_MEMORY_MB");
if (env)
{
maxMemoryInBytes = atoi(env) * 1024 * 1024;
}
}
if (maxMemoryInBytes < 0)
maxMemoryInBytes *= -1;
if (maxMemoryInBytes == 0)
{
// :ADSK: use some default value: 1Gb, is reasonable in 2014!
maxMemoryInBytes = 1024 * 1024 * 1024;
}
}
this->MaxMemoryInBytes = maxMemoryInBytes ; this->MaxMemoryFraction = 0.75;
this->ReportProgress=true;
this->TransformedInput = NULL; this->LastInput = NULL; }