當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.cl_bool函數代碼示例

本文整理匯總了Golang中C.cl_bool函數的典型用法代碼示例。如果您正苦於以下問題:Golang cl_bool函數的具體用法?Golang cl_bool怎麽用?Golang cl_bool使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了cl_bool函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: CLEnqueueReadBuffer

func CLEnqueueReadBuffer(command_queue CL_command_queue,
	buffer CL_mem,
	blocking_read CL_bool,
	offset CL_size_t,
	cb CL_size_t,
	ptr unsafe.Pointer,
	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_event C.cl_event
	var c_errcode_ret C.cl_int

	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.clEnqueueReadBuffer(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_read),
			C.size_t(offset),
			C.size_t(cb),
			ptr,
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event)
	} else {
		c_errcode_ret = C.clEnqueueReadBuffer(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_read),
			C.size_t(offset),
			C.size_t(cb),
			ptr,
			0,
			nil,
			&c_event)
	}

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

	return CL_int(c_errcode_ret)
}
開發者ID:Dirbaio,項目名稱:gominer,代碼行數:53,代碼來源:buffer.go

示例2: CLEnqueueSVMMap

func CLEnqueueSVMMap(command_queue CL_command_queue,
	blocking_map CL_bool,
	map_flags CL_map_flags,
	svm_ptr unsafe.Pointer,
	size 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_event C.cl_event
	var c_errcode_ret C.cl_int

	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.clEnqueueSVMMap(command_queue.cl_command_queue,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			svm_ptr,
			C.size_t(size),
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event)
	} else {
		c_errcode_ret = C.clEnqueueSVMMap(command_queue.cl_command_queue,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			svm_ptr,
			C.size_t(size),
			0,
			nil,
			&c_event)
	}

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

	return CL_int(c_errcode_ret)
}
開發者ID:xfong,項目名稱:gocl,代碼行數:50,代碼來源:svm20.go

示例3: EnqueueReadImage

func (cq *CommandQueue) EnqueueReadImage(i *Image, blocking bool, origin, region [3]Size, rowPitch, slicePitch Size) ([]byte, error) {
	c_blocking := C.cl_bool(C.CL_FALSE)
	if blocking {
		c_blocking = C.CL_TRUE
	}

	size := Size(0)
	if i.Property(IMAGE_DEPTH) == 0 || i.Property(IMAGE_DEPTH) == 1 { // 2D image
		if rowPitch == 0 {
			rowPitch = i.Property(IMAGE_WIDTH) * i.Property(IMAGE_ELEMENT_SIZE)
		}
		size = rowPitch * i.Property(IMAGE_HEIGHT)
	} else {
		if slicePitch == 0 {
			if rowPitch == 0 {
				rowPitch = i.Property(IMAGE_WIDTH) * i.Property(IMAGE_ELEMENT_SIZE)
			}
			slicePitch = rowPitch * i.Property(IMAGE_DEPTH)
		}
		size = slicePitch * i.Property(IMAGE_DEPTH)
	}
	bytes := make([]byte, size)

	if ret := C.clEnqueueReadImage(
		cq.id, i.id, c_blocking,
		(*C.size_t)(unsafe.Pointer(&origin[0])), (*C.size_t)(unsafe.Pointer(&region[0])),
		C.size_t(rowPitch), C.size_t(slicePitch), unsafe.Pointer(&bytes[0]),
		0, nil, nil); ret != C.CL_SUCCESS {
		return nil, Cl_error(ret)
	}
	return bytes, nil
}
開發者ID:pseudomind,項目名稱:go-opencl,代碼行數:32,代碼來源:commandQueue.go

示例4: EnqueueWriteImage

func (cq *CommandQueue) EnqueueWriteImage(img *Image, blocking bool, origin, region [3]Size, rowPitch, slicePitch Size, data []byte) error {
	c_blocking := C.cl_bool(C.CL_FALSE)
	if blocking {
		c_blocking = C.CL_TRUE
	}

	if ret := C.clEnqueueWriteImage(
		cq.id, img.id, c_blocking,
		(*C.size_t)(unsafe.Pointer(&origin[0])), (*C.size_t)(unsafe.Pointer(&region[0])),
		C.size_t(rowPitch), C.size_t(slicePitch),
		unsafe.Pointer(&data[0]),
		C.cl_uint(0), nil, nil); ret != C.CL_SUCCESS {
		return Cl_error(ret)
	}
	return nil
}
開發者ID:pseudomind,項目名稱:go-opencl,代碼行數:16,代碼來源:commandQueue.go

示例5: NewSampler

func (c *Context) NewSampler(normalizedCoords bool, addressingMode AddressingMode, filterMode FilterMode) (*Sampler, error) {
	var c_sampler C.cl_sampler
	var err C.cl_int

	cNormalizedCoords := C.cl_bool(C.CL_FALSE)
	if normalizedCoords {
		cNormalizedCoords = C.CL_TRUE
	}

	if c_sampler = C.clCreateSampler(c.id, cNormalizedCoords, C.cl_addressing_mode(addressingMode), C.cl_filter_mode(filterMode), &err); err != C.CL_SUCCESS {
		return nil, Cl_error(err)
	}

	sampler := &Sampler{id: c_sampler}
	runtime.SetFinalizer(sampler, (*Sampler).release)

	return sampler, nil
}
開發者ID:salviati,項目名稱:go-opencl,代碼行數:18,代碼來源:context.go

示例6: CLCreateSampler

func CLCreateSampler(context CL_context,
	normalized_coords CL_bool,
	addressing_mode CL_addressing_mode,
	filter_mode CL_filter_mode,
	errcode_ret *CL_int) CL_sampler {

	var c_errcode_ret C.cl_int
	var c_sampler C.cl_sampler

	c_sampler = C.clCreateSampler(context.cl_context,
		C.cl_bool(normalized_coords),
		C.cl_addressing_mode(addressing_mode),
		C.cl_filter_mode(filter_mode),
		&c_errcode_ret)

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

	return CL_sampler{c_sampler}
}
開發者ID:Dirbaio,項目名稱:gominer,代碼行數:21,代碼來源:sampler1x.go

示例7: EnqueueMapImage

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueMapImage.html
func EnqueueMapImage(cq CommandQueue, image Mem, blocking_map Bool, map_flags MapFlags, origin3 *uint64, region3 *uint64, image_row_pitch *uint64, image_slice_pitch *uint64, num_events_in_wait_list uint32, event_wait_list *Event, event *Event, errcode_ret *int32) unsafe.Pointer {
	return unsafe.Pointer(C.clEnqueueMapImage(cq, image, C.cl_bool(blocking_map), C.cl_map_flags(map_flags), (*C.size_t)(unsafe.Pointer(origin3)), (*C.size_t)(unsafe.Pointer(region3)), (*C.size_t)(unsafe.Pointer(image_row_pitch)), (*C.size_t)(unsafe.Pointer(image_slice_pitch)), C.cl_uint(num_events_in_wait_list), (*C.cl_event)(unsafe.Pointer(event_wait_list)), (*C.cl_event)(unsafe.Pointer(event)), (*C.cl_int)(unsafe.Pointer(errcode_ret))))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例8: EnqueueMapBuffer

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueMapBuffer.html
func EnqueueMapBuffer(cq CommandQueue, buffer Mem, blocking_map Bool, map_flags uint64, offset uint64, size uint64, num_events_in_wait_list uint32, event_wait_list *Event, event *Event, errcode_ret *int32) unsafe.Pointer {
	return unsafe.Pointer(C.clEnqueueMapBuffer(cq, buffer, C.cl_bool(blocking_map), C.cl_map_flags(map_flags), C.size_t(offset), C.size_t(size), C.cl_uint(num_events_in_wait_list), (*C.cl_event)(unsafe.Pointer(event_wait_list)), (*C.cl_event)(unsafe.Pointer(event)), (*C.cl_int)(unsafe.Pointer(errcode_ret))))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例9: EnqueueWriteImage

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteImage.html
func EnqueueWriteImage(cq CommandQueue, image Mem, blocking_write Bool, origin3 *uint64, region3 *uint64, input_row_pitch uint64, input_slice_pitch uint64, ptr unsafe.Pointer, num_events_in_wait_list uint32, event_wait_list *Event, event *Event) ErrorCode {
	return ErrorCode(C.clEnqueueWriteImage(cq, image, C.cl_bool(blocking_write), (*C.size_t)(unsafe.Pointer(origin3)), (*C.size_t)(unsafe.Pointer(region3)), C.size_t(input_row_pitch), C.size_t(input_slice_pitch), unsafe.Pointer(ptr), C.cl_uint(num_events_in_wait_list), (*C.cl_event)(unsafe.Pointer(event_wait_list)), (*C.cl_event)(unsafe.Pointer(event))))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例10: EnqueueWriteBuffer

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBuffer.html
func EnqueueWriteBuffer(cq CommandQueue, buffer Mem, blocking_write Bool, offset uint64, size uint64, ptr unsafe.Pointer, num_events_in_wait_list uint32, event_wait_list *Event, event *Event) ErrorCode {
	return ErrorCode(C.clEnqueueWriteBuffer(cq, buffer, C.cl_bool(blocking_write), C.size_t(offset), C.size_t(size), unsafe.Pointer(ptr), C.cl_uint(num_events_in_wait_list), (*C.cl_event)(unsafe.Pointer(event_wait_list)), (*C.cl_event)(unsafe.Pointer(event))))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例11: CreateSampler

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateSampler.html
func CreateSampler(context Context, normalizedCoords Bool, addressingMode AddressingMode, filterMode FilterMode, errcode *ErrorCode) Sampler {
	return Sampler(C.clCreateSampler(context.clContext, C.cl_bool(normalizedCoords), C.cl_addressing_mode(addressingMode), C.cl_filter_mode(filterMode), (*C.cl_int)(unsafe.Pointer(errcode))))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例12: SetCommandQueueProperty

// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetCommandQueueProperty.html
func SetCommandQueueProperty(cq CommandQueue, properties CommandQueueProperties, enable BOOL, oldproperties *CommandQueueProperties) int {
	return ErrorCode(C.clSetCommandQueueProperty(cq, C.cl_command_queue_properties(properties), C.cl_bool(enable), (*C.cl_command_queue_properties)(oldproperties)))
}
開發者ID:mantyr,項目名稱:cl,代碼行數:4,代碼來源:package.go

示例13: CLEnqueueMapBuffer

func CLEnqueueMapBuffer(command_queue CL_command_queue,
	buffer CL_mem,
	blocking_map CL_bool,
	map_flags CL_map_flags,
	offset CL_size_t,
	cb CL_size_t,
	num_events_in_wait_list CL_uint,
	event_wait_list []CL_event,
	event *CL_event,
	errcode_ret *CL_int) unsafe.Pointer {

	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) {

		if errcode_ret != nil {
			*errcode_ret = CL_INVALID_EVENT_WAIT_LIST
		}
		return nil
	}

	var c_event C.cl_event
	var c_errcode_ret C.cl_int
	var c_ptr_ret unsafe.Pointer

	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_ptr_ret = C.clEnqueueMapBuffer(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			C.size_t(offset),
			C.size_t(cb),
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event,
			&c_errcode_ret)
	} else {
		c_ptr_ret = C.clEnqueueMapBuffer(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			C.size_t(offset),
			C.size_t(cb),
			0,
			nil,
			&c_event,
			&c_errcode_ret)
	}

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

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

	return c_ptr_ret
}
開發者ID:Dirbaio,項目名稱:gominer,代碼行數:65,代碼來源:buffer.go

示例14: CLEnqueueWriteBufferRect

func CLEnqueueWriteBufferRect(command_queue CL_command_queue,
	buffer CL_mem,
	blocking_write CL_bool,
	buffer_origin [3]CL_size_t,
	host_origin [3]CL_size_t,
	region [3]CL_size_t,
	buffer_row_pitch CL_size_t,
	buffer_slice_pitch CL_size_t,
	host_row_pitch CL_size_t,
	host_slice_pitch CL_size_t,
	ptr unsafe.Pointer,
	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_buffer_origin [3]C.size_t
	var c_host_origin [3]C.size_t
	var c_region [3]C.size_t

	for i := 0; i < 3; i++ {
		c_buffer_origin[i] = C.size_t(buffer_origin[i])
		c_host_origin[i] = C.size_t(host_origin[i])
		c_region[i] = C.size_t(region[i])
	}

	var c_event C.cl_event
	var c_errcode_ret C.cl_int

	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.clEnqueueWriteBufferRect(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_write),
			&c_buffer_origin[0],
			&c_host_origin[0],
			&c_region[0],
			C.size_t(buffer_row_pitch),
			C.size_t(buffer_slice_pitch),
			C.size_t(host_row_pitch),
			C.size_t(host_slice_pitch),
			ptr,
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event)
	} else {
		c_errcode_ret = C.clEnqueueWriteBufferRect(command_queue.cl_command_queue,
			buffer.cl_mem,
			C.cl_bool(blocking_write),
			&c_buffer_origin[0],
			&c_host_origin[0],
			&c_region[0],
			C.size_t(buffer_row_pitch),
			C.size_t(buffer_slice_pitch),
			C.size_t(host_row_pitch),
			C.size_t(host_slice_pitch),
			ptr,
			0,
			nil,
			&c_event)
	}

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

	return CL_int(c_errcode_ret)
}
開發者ID:Dirbaio,項目名稱:gominer,代碼行數:78,代碼來源:buffer.go

示例15: CLEnqueueMapImage

func CLEnqueueMapImage(command_queue CL_command_queue,
	image CL_mem,
	blocking_map CL_bool,
	map_flags CL_map_flags,
	origin [3]CL_size_t,
	region [3]CL_size_t,
	image_row_pitch *CL_size_t,
	image_slice_pitch *CL_size_t,
	num_events_in_wait_list CL_uint,
	event_wait_list []CL_event,
	event *CL_event,
	errcode_ret *CL_int) unsafe.Pointer {

	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) {

		if errcode_ret != nil {
			*errcode_ret = CL_INVALID_EVENT_WAIT_LIST
		}
		return nil
	}

	var c_origin, c_region [3]C.size_t
	var c_image_row_pitch, c_image_slice_pitch C.size_t
	var c_event C.cl_event
	var c_errcode_ret C.cl_int
	var c_ptr_ret unsafe.Pointer

	for i := 0; i < 3; i++ {
		c_origin[i] = C.size_t(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_ptr_ret = C.clEnqueueMapImage(command_queue.cl_command_queue,
			image.cl_mem,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			&c_origin[0],
			&c_region[0],
			&c_image_row_pitch,
			&c_image_slice_pitch,
			C.cl_uint(num_events_in_wait_list),
			&c_event_wait_list[0],
			&c_event,
			&c_errcode_ret)
	} else {
		c_ptr_ret = C.clEnqueueMapImage(command_queue.cl_command_queue,
			image.cl_mem,
			C.cl_bool(blocking_map),
			C.cl_map_flags(map_flags),
			&c_origin[0],
			&c_region[0],
			&c_image_row_pitch,
			&c_image_slice_pitch,
			0,
			nil,
			&c_event,
			&c_errcode_ret)
	}

	if image_row_pitch != nil {
		*image_row_pitch = CL_size_t(c_image_row_pitch)
	}
	if image_slice_pitch != nil {
		*image_slice_pitch = CL_size_t(c_image_slice_pitch)
	}

	if event != nil {
		event.cl_event = c_event
	}
	if errcode_ret != nil {
		*errcode_ret = CL_int(c_errcode_ret)
	}

	return c_ptr_ret
}
開發者ID:xfong,項目名稱:gocl,代碼行數:84,代碼來源:image.go


注:本文中的C.cl_bool函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。