本文整理匯總了Golang中C.cl_image_format類的典型用法代碼示例。如果您正苦於以下問題:Golang cl_image_format類的具體用法?Golang cl_image_format怎麽用?Golang cl_image_format使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了cl_image_format類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CLCreateImage3D
func CLCreateImage3D(context CL_context,
flags CL_mem_flags,
image_format *CL_image_format,
image_width CL_size_t,
image_height CL_size_t,
image_depth CL_size_t,
image_row_pitch CL_size_t,
image_slice_pitch CL_size_t,
host_ptr unsafe.Pointer,
errcode_ret *CL_int) CL_mem {
var c_image_format C.cl_image_format
var c_errcode_ret C.cl_int
var c_image C.cl_mem
c_image_format.image_channel_order = C.cl_channel_order(image_format.Image_channel_order)
c_image_format.image_channel_data_type = C.cl_channel_type(image_format.Image_channel_data_type)
c_image = C.clCreateImage3D(context.cl_context,
C.cl_mem_flags(flags),
&c_image_format,
C.size_t(image_width),
C.size_t(image_height),
C.size_t(image_depth),
C.size_t(image_row_pitch),
C.size_t(image_slice_pitch),
host_ptr,
&c_errcode_ret)
if errcode_ret != nil {
*errcode_ret = CL_int(c_errcode_ret)
}
return CL_mem{c_image}
}
示例2: NewImage3D
func (c *Context) NewImage3D(flags MemFlags, order ChannelOrder, dataType ChannelType, width, height, depth, rowPitch, slicePitch uint32, data *byte) (*Image, error) {
var c_buffer C.cl_mem
var err C.cl_int
format := new(C.cl_image_format)
format.image_channel_order = C.cl_channel_order(order)
format.image_channel_data_type = C.cl_channel_type(dataType)
if c_buffer = C.clCreateImage3D(c.id, C.cl_mem_flags(flags), format, C.size_t(width), C.size_t(height), C.size_t(depth), C.size_t(rowPitch), C.size_t(slicePitch), unsafe.Pointer(data), &err); err != C.CL_SUCCESS {
return nil, Cl_error(err)
}
image := &Image{id: c_buffer, w: width, h: height, d: depth, hostptr: data}
runtime.SetFinalizer(image, (*Image).release)
return image, nil
}
示例3: CLCreateImage
func CLCreateImage(context CL_context,
flags CL_mem_flags,
image_format *CL_image_format,
image_desc *CL_image_desc,
host_ptr unsafe.Pointer,
errcode_ret *CL_int) CL_mem {
var c_image_format C.cl_image_format
var c_image_desc C.cl_image_desc
var c_errcode_ret C.cl_int
var c_image C.cl_mem
c_image_format.image_channel_order = C.cl_channel_order(image_format.Image_channel_order)
c_image_format.image_channel_data_type = C.cl_channel_type(image_format.Image_channel_data_type)
c_image_desc.image_type = C.cl_mem_object_type(image_desc.Image_type)
c_image_desc.image_width = C.size_t(image_desc.Image_width)
c_image_desc.image_height = C.size_t(image_desc.Image_height)
c_image_desc.image_depth = C.size_t(image_desc.Image_depth)
c_image_desc.image_array_size = C.size_t(image_desc.Image_array_size)
c_image_desc.image_row_pitch = C.size_t(image_desc.Image_row_pitch)
c_image_desc.image_slice_pitch = C.size_t(image_desc.Image_slice_pitch)
c_image_desc.num_mip_levels = C.cl_uint(image_desc.Num_mip_levels)
c_image_desc.num_samples = C.cl_uint(image_desc.Num_samples)
c_image_desc.buffer = image_desc.Buffer.cl_mem
c_image = C.clCreateImage(context.cl_context,
C.cl_mem_flags(flags),
&c_image_format,
&c_image_desc,
host_ptr,
&c_errcode_ret)
if errcode_ret != nil {
*errcode_ret = CL_int(c_errcode_ret)
}
return CL_mem{c_image}
}
示例4: toCl
func (f ImageFormat) toCl() C.cl_image_format {
var format C.cl_image_format
format.image_channel_order = C.cl_channel_order(f.ChannelOrder)
format.image_channel_data_type = C.cl_channel_type(f.ChannelDataType)
return format
}