Beispiel #1
0
        //[DllImport("kernel32.dll")]
        //static extern bool GetThreadTimes(IntPtr hThread, out long lpCreationTime, out long lpExitTime, out long lpKernelTime, out long lpUserTime);
        //[DllImport("kernel32.dll")]
        //static extern IntPtr GetCurrentThread();

        void DoClose()
        {
            if (inited)
            {
                int strideCount = samplesInBuffer / stride;
                if (strideCount > 0)
                {
                    do_output_frames(strideCount);
                }
                if (samplesInBuffer > 0)
                {
                    throw new Exception(string.Format("samplesInBuffer % stride != 0"));
                }
                if (task2.strideCount > 0)
                {
                    task2.openCLCQ.Finish(); // cuda.SynchronizeStream(task2.stream);
                    task2.strideCount = 0;
                }

                task1.Dispose();
                task2.Dispose();
                openCLProgram.Dispose();
                OCLMan.Dispose();
                inited = false;
            }
        }
Beispiel #2
0
 private void VoxelImage_FormClosing(object sender, EventArgs e)
 {
     vol.ReturnBuffer().Dispose();
     color_buffer.Dispose();
     opacity.Dispose();
     manager.CQ[0].Dispose();
     kernel.Dispose();
     program.Dispose();
     manager.Context.Dispose();
     manager.Dispose();
     VSurface.Dispose();
     GC.Collect();
 }