<div dir="ltr">Shinya,<br><br>Would you be please submit this patch to VTK's gerrit review to make it easy to test and integrate your fix?<br><br>To do that (distilled from <a href="http://www.vtk.org/Wiki/VTK/Git/Develop">http://www.vtk.org/Wiki/VTK/Git/Develop</a>)<br>

<br>$ git clone git://<a href="http://vtk.org/VTK.git">vtk.org/VTK.git</a><br>$ ./Utilities/SetupForDevelopment.sh<br>$ git checkout -b my-topic origin/master<br>$ edit Accelerators/Piston/vtkPistonMapper.cxx<br>$ compile and test locally<br>

$ git add file1 file2 file3<br>$ git commit<br>$ git gerrit-push<br><br>Choose myself and Robert Maynard as reviewers please in the gerrit web page for the change.<div><br></div><div>Thank you!</div></div><div class="gmail_extra">

<br clear="all"><div>David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div>
<br><br><div class="gmail_quote">On Thu, Aug 14, 2014 at 1:24 AM, Onogi Shinya <span dir="ltr"><<a href="mailto:shinya.onogi@live.jp" target="_blank">shinya.onogi@live.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi all:<br>
<br>
vtkPistonMapper calls vtkpiston::CudaRegisterBuffer in every gpu rendering (in vtkPistonMapper.cxx; L181-L186); however, cudaGraphicsUnregisterResource is never called. It results in a gpu resource issue when vtkPistonAlgorithm is updated several times.<br>


<br>
Quick solution I tested is followings:<br>
vtkPistonMapper.cxx<br>
43   void CudaRegisterBuffer(struct cudaGraphicsResource **vboResource,<br>
44                           GLuint vboBuffer);<br>
+    void CudaUnregisterBuffer(struct cudaGraphicsResource **vboResource);<br>
<br>
148 if (this->Internal->BufferSize != 0)<br>
149   {<br>
150    // Release old buffer<br>
+      vtkpiston::CudaUnregisterResource(this->Internal->vboResources[0]);<br>
+      vtkpiston::CudaUnregisterResource(this->Internal->vboResources[1]);<br>
+      vtkpiston::CudaUnregisterResource(this->Internal->vboResources[2]);<br>
151    vtkgl::DeleteBuffers(3, this->Internal->vboBuffers);<br>
<br>
vtkPistonMapper.cu<br>
void CudaUnregisterResource(struct cudaGraphicsResource *vboResource)<br>
{<br>
  cudaError_t res = cudaGraphicsUnregisterResource(vboResource);<br>
  if (res != cudaSuccess)<br>
  {<br>
    cerr << "Unregister buffer failed ... " << cudaGetErrorString(res) << endl;<br>
    return;<br>
  }<br>
}<br>
<br>
But, register/unregister in every rendering wouldn't be needed according to samples of gl interop with cuda.<br>
Thnaks,<br>
Shinya<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>