Beispiel #1
0
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
}
Beispiel #2
0
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}
}
Beispiel #3
0
// 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))))
}
Beispiel #4
0
func (ctx *Context) CreateSampler(normalized_coors bool, addr_mode, filter_mode int) (*Sampler, error) {
	var err C.cl_int
	return &Sampler{C.clCreateSampler(ctx.clContext, clBool(normalized_coors), (C.cl_addressing_mode)(addr_mode), (C.cl_filter_mode)(filter_mode), &err)}, toError(err)
}