Page MenuHomePhabricator

vtkShaderProgram2 error
Closed, ResolvedPublic

Description

When removing an image rendered using volume rendering and ray cast, the following VTK error appears:
"a vtkShaderProgram2 object is being deleted before ReleaseGraphicsResources() has been called."

The MITK function mitk::GPUVolumeMapper3D::DeinitRAY() already has a comment on this, but the function is not called on the destructor of GPUVolumeMapper3D.

One possible solution is to call DeInit() on all mappers on the destructor of GPUVolumeMapper3D:

  // Deinit all mappers for all renderers
  const RenderingManager::RenderWindowVector& renderWindows = RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
  for (RenderingManager::RenderWindowVector::const_iterator iter = renderWindows.begin();
    iter != renderWindows.end();
    ++iter)
  {
    if ( mitk::BaseRenderer::GetInstance((*iter))->GetMapperID() == BaseRenderer::Standard3D )
    {
		mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance((*iter));
		DeinitCPU(renderer);
		DeinitGPU(renderer);
		// Only with VTK 5.6 or above

#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))

		DeinitRAY(renderer);

#endif

  }
}

RAY-Console.png (726×677 px, 39 KB)

Event Timeline

We should take care of this. Markus, Sandy, could you have a look?

New remote branch pushed: bug-16127-Resolving-VtkShaderProgram2Error

[7a90bb]: Merge branch 'bug-16127-Resolving-VtkShaderProgram2Error'

Merged commits:

2013-10-09 15:06:01 Sandy Engelhardt [ebe29e]
fixed ReleaseGraphicsResources Error

We fixed the bug by directly calling ReleaseGraphicsResources() in LocalStorage destructor, since the LocalStorage holds usually the last reference on the mapper.