示例#1
0
func (c *Context) NewCommandQueue(device Device, param CommandQueueParameter) (*CommandQueue, error) {
	var c_queue C.cl_command_queue
	var err C.cl_int
	if c_queue = C.clCreateCommandQueue(c.id, device.id, C.cl_command_queue_properties(param), &err); err != C.CL_SUCCESS {
		return nil, Cl_error(err)
	}
	queue := &CommandQueue{id: c_queue}
	runtime.SetFinalizer(queue, (*CommandQueue).release)

	return queue, nil
}
示例#2
0
func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error) {
	var err C.cl_int
	clQueue := C.clCreateCommandQueue(ctx.clContext, device.id, C.cl_command_queue_properties(properties), &err)
	if err != C.CL_SUCCESS {
		return nil, toError(err)
	}
	if clQueue == nil {
		return nil, ErrUnknown
	}
	commandQueue := &CommandQueue{clQueue: clQueue, device: device}
	runtime.SetFinalizer(commandQueue, releaseCommandQueue)
	return commandQueue, nil
}
示例#3
0
文件: queue1x.go 项目: xfong/gocl
func CLCreateCommandQueue(context CL_context,
	device CL_device_id,
	properties CL_command_queue_properties,
	errcode_ret *CL_int) CL_command_queue {
	var c_errcode_ret C.cl_int
	var c_command_queue C.cl_command_queue

	c_command_queue = C.clCreateCommandQueue(context.cl_context,
		device.cl_device_id,
		C.cl_command_queue_properties(properties),
		&c_errcode_ret)

	if errcode_ret != nil {
		*errcode_ret = CL_int(c_errcode_ret)
	}

	return CL_command_queue{c_command_queue}
}
示例#4
0
文件: package.go 项目: mantyr/cl
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateCommandQueue.html
func CreateCommandQueue(context Context, did DeviceId, properties CommandQueueProperties, errcode *ErrorCode) CommandQueue {
	return CommandQueue(C.clCreateCommandQueue(context.clContext, did, C.cl_command_queue_properties(properties), (*C.cl_int)(errcode)))
}