An update will be applied today, Nov30th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 26079f9a authored by Aashish Chaudhary's avatar Aashish Chaudhary
Browse files

Query device id instead of using a fixed number

Change-Id: I6e2889fe130a27e6bf67583ac547bce180607d67
parent 5a629edc
......@@ -177,7 +177,7 @@ void MyProcess::Execute()
renWin->Render();
// TODO: Add an argument to decide if use interop or not
vtkPistonMapper::InitCUDAGL(renWin);
vtkPistonMapper::InitCudaGL(renWin);
this->CreatePipeline(renderer);
prm->SetRenderWindow(renWin);
......
......@@ -41,7 +41,7 @@ int TestUsePiston( int argc, char *argv[] )
// Initialize interop rendering using that context
// TODO: Add an argument to decide if use interop or not
vtkPistonMapper::InitCUDAGL(renwin);
vtkPistonMapper::InitCudaGL(renwin);
vtkImageMandelbrotSource *src = vtkImageMandelbrotSource::New();
src->SetWholeExtent(0,20,0,20,0,20);
......
......@@ -23,7 +23,7 @@ class TestRendering(Testing.vtkTest):
if "GPURender" in args:
print "Testing GPU direct render path"
vtk.vtkPistonMapper.InitCUDAGL(renwin)
vtk.vtkPistonMapper.InitCudaGL(renwin)
else:
print "Testing CPU indirect render path"
......
......@@ -97,12 +97,24 @@ struct color_map : thrust::unary_function<ValueType, float3>
//------------------------------------------------------------------------------
void CudaGLInit()
{
cudaError_t res = cudaGLSetGLDevice(0);
cudaDeviceProp prop;
int dev;
// Fill it with zeros
memset(&prop,0,sizeof(cudaDeviceProp));
// Pick a GPU capable of 1.0 or better
prop.major=1; prop.minor=0;
cudaChooseDevice(&dev,&prop);
// Set OpenGL device
cudaError_t res = cudaGLSetGLDevice(dev);
if (res != cudaSuccess)
{
{
cerr << "Set device failed ... " << cudaGetErrorString(res) << endl;
return;
}
}
}
//------------------------------------------------------------------------------
......
......@@ -88,7 +88,7 @@ vtkStandardNewMacro(vtkPistonMapper);
bool vtkPistonMapper::CudaGLInitted = false;
//-----------------------------------------------------------------------------
void vtkPistonMapper::InitCUDAGL(vtkRenderWindow *rw)
void vtkPistonMapper::InitCudaGL(vtkRenderWindow *rw)
{
if (!vtkPistonMapper::CudaGLInitted)
{
......
......@@ -41,7 +41,14 @@ public:
// Description:
// Manually call this before any cuda filters are created
// to use direct GPU rendering.
static void InitCUDAGL(vtkRenderWindow *rw);
static void InitCudaGL(vtkRenderWindow *rw);
// Description:
// Return true if using cuda interop feature otherwise false.
inline static bool IsEnabledCudaGL()
{
return CudaGLInitted;
}
// Description:
// A convenience method to reduce code duplication that gets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment