Esempio n. 1
0
File: image.go Progetto: xfong/gocl
func CLEnqueueCopyBufferToImage(command_queue CL_command_queue,
	src_buffer CL_mem,
	dst_image CL_mem,
	src_offset CL_size_t,
	dst_origin [3]CL_size_t,
	region [3]CL_size_t,
	num_events_in_wait_list CL_uint,
	event_wait_list []CL_event,
	event *CL_event) CL_int {

	if (num_events_in_wait_list == 0 && event_wait_list != nil) ||
		(num_events_in_wait_list != 0 && event_wait_list == nil) ||
		int(num_events_in_wait_list) != len(event_wait_list) {
		return CL_INVALID_EVENT_WAIT_LIST
	}

	var c_origin, c_region [3]C.size_t
	var c_event C.cl_event
	var c_errcode_ret C.cl_int

	for i := 0; i < 3; i++ {
		c_origin[i] = C.size_t(dst_origin[i])
		c_region[i] = C.size_t(region[i])
	}
	if num_events_in_wait_list != 0 {
		var c_event_wait_list []C.cl_event
		c_event_wait_list = make([]C.cl_event, num_events_in_wait_list)
		for i := 0; i < int(num_events_in_wait_list); i++ {
			c_event_wait_list[i] = event_wait_list[i].cl_event
		}

		c_errcode_ret = C.clEnqueueCopyBufferToImage(command_queue.cl_command_queue,
			src_buffer.cl_mem,
			dst_image.cl_mem,
			C.size_t(src_offset),
			&c_origin[0],
			&c_region[0],
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event)
	} else {
		c_errcode_ret = C.clEnqueueCopyBufferToImage(command_queue.cl_command_queue,
			src_buffer.cl_mem,
			dst_image.cl_mem,
			C.size_t(src_offset),
			&c_origin[0],
			&c_region[0],
			0,
			nil,
			&c_event)
	}

	if event != nil {
		event.cl_event = c_event
	}

	return CL_int(c_errcode_ret)
}
Esempio n. 2
0
File: image.go Progetto: xfong/tmpCL
// Enqueues a command to copy from a 2D or 3D image object to buffer memory.
func (q *CommandQueue) EnqueueCopyBufferToImage(dst, src *MemObject, src_offset int, region, dst_origin [3]int, eventWaitList []*Event) (*Event, error) {
	dOrigin := sizeT3(dst_origin)
	cRegion := sizeT3(region)
	var event C.cl_event
	err := toError(C.clEnqueueCopyBufferToImage(q.clQueue, src.clMem, dst.clMem, (C.size_t)(src_offset), &dOrigin[0], &cRegion[0], C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event))
	return newEvent(event), err
}
Esempio n. 3
0
File: package.go Progetto: mantyr/cl
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBufferToImage.html
func EnqueueCopyBufferToImage(cq CommandQueue, src_buffer Mem, dst_image Mem, src_offset uint64, dst_origin3 *uint64, region3 *uint64, num_events_in_wait_list uint32, event_wait_list *Event, event *Event) ErrorCode {
	return ErrorCode(C.clEnqueueCopyBufferToImage(cq, src_buffer, dst_image, C.size_t(src_offset), (*C.size_t)(unsafe.Pointer(dst_origin3)), (*C.size_t)(unsafe.Pointer(region3)), C.cl_uint(num_events_in_wait_list), (*C.cl_event)(unsafe.Pointer(event_wait_list)), (*C.cl_event)(unsafe.Pointer(event))))
}