Skip to content

Instantly share code, notes, and snippets.

@mratsim
Last active May 5, 2018 10:10
Show Gist options
  • Save mratsim/7f7ecf3cfc2be0f59f9075baf5d051a4 to your computer and use it in GitHub Desktop.
Save mratsim/7f7ecf3cfc2be0f59f9075baf5d051a4 to your computer and use it in GitHub Desktop.
# Works on checkout 8ce9e434348f6f63b81f7a788bd4093996dbaca7, from 11 days ago but not on latest
import opencl
{.experimental.}
type clResource = PCommandQueue | PKernel | PProgram | PMem | PContext
template release*(queue: PCommandQueue) = check releaseCommandQueue(queue)
template release*(kernel: PKernel) = check releaseKernel(kernel)
template release*(program: PProgram) = check releaseProgram(program)
template release*(buffer: PMem) = check releaseMemObject(buffer)
template release*(context: PContext) = check releaseContext(context)
proc `=destroy`*(clres: clResource) =
release clres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment