예제 #1
0
        /// <summary>
        /// Disposes of the resources that have been acquired by the kernel.
        /// </summary>
        /// <param name="disposing">Determines whether managed object or managed and unmanaged resources should be disposed of.</param>
        protected override void Dispose(bool disposing)
        {
            // Checks if the kernel has already been disposed of, if not, then it is disposed of
            if (!this.IsDisposed)
            {
                KernelsNativeApi.ReleaseKernel(this.Handle);
            }

            // Makes sure that the base class can execute its dispose logic
            base.Dispose(disposing);
        }
예제 #2
0
파일: Kernel.cs 프로젝트: Open-FL/OpenCL
        /// <summary>
        ///     Disposes of the resources that have been acquired by the kernel.
        /// </summary>
        /// <param name="disposing">Determines whether managed object or managed and unmanaged resources should be disposed of.</param>
        public override void Dispose()
        {
            // Checks if the kernel has already been disposed of, if not, then it is disposed of
            if (!IsDisposed)
            {
                KernelsNativeApi.ReleaseKernel(Handle);
            }

            // Makes sure that the base class can execute its dispose logic
            base.Dispose();
        }
예제 #3
0
        public void CleanupCLResources()
        {
            if (hasClInitialized)
            {
                FlushWorkingCache();

                foreach (var item in kernels)
                {
                    KernelsNativeApi.ReleaseKernel(item.Value);
                }
                kernels.Clear();

                ProgramsNativeApi.ReleaseProgram(clProgram);
                CommandQueuesNativeApi.ReleaseCommandQueue(commandQueue);
                ContextsNativeApi.ReleaseContext(clContext);

                hasClInitialized = false;
            }
        }