Skip to content

Commit 6dabd91

Browse files
authored
Merge pull request #108 from Atry/kernelNames
Add kernelNames method
2 parents 82089d5 + 8d7a90e commit 6dabd91

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

OpenCL/src/main/scala/com/thoughtworks/compute/OpenCL.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,20 @@ object OpenCL {
881881
def monadicClose = UnitContinuation.delay {
882882
OpenCL.checkErrorCode(clReleaseProgram(handle))
883883
}
884+
885+
def kernelNames(): Seq[String] = {
886+
val stack = stackPush()
887+
try {
888+
val sizeBuffer = stack.mallocPointer(1)
889+
checkErrorCode(clGetProgramInfo(this.handle, CL_PROGRAM_KERNEL_NAMES, null: ByteBuffer, sizeBuffer))
890+
val nameBuffer = stack.malloc(sizeBuffer.get(0).toInt)
891+
checkErrorCode(clGetProgramInfo(this.handle, CL_PROGRAM_KERNEL_NAMES, nameBuffer, null: PointerBuffer))
892+
memUTF8(nameBuffer).split(';')
893+
} finally {
894+
stack.close()
895+
}
896+
}
897+
884898
}
885899

886900
object Program {

0 commit comments

Comments
 (0)