Commit 2e0bd273 by Philipp Adolf

Enable setting kernel args

parent 5752ac88
......@@ -32,7 +32,7 @@ It is mainly developed and tested on Linux and with Intel and Nvidia GPUs. It sh
- [ ] querying program (build) info
- [ ] kernel objects
- [x] creating and releasing kernels
- [ ] setting arguments
- [x] setting arguments
- [ ] querying kernel, work group and argument info
- [ ] executing kernels
- [ ] event objects
......
......@@ -37,3 +37,15 @@ func (k Kernel) Release() error {
}
return nil
}
func (k Kernel) SetArg(index uint, size uintptr, value unsafe.Pointer) error {
err := C.clSetKernelArg(k.kernel, C.cl_uint(index), C.size_t(size), value)
if err != C.CL_SUCCESS {
return fmt.Errorf("error setting kernel argument: %d", err)
}
return nil
}
func (k Kernel) SetArgBuffer(index uint, buffer Memory) error {
return k.SetArg(index, unsafe.Sizeof(buffer.memory), unsafe.Pointer(&buffer.memory))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment