forked from decred/gominer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sampler1x.go
40 lines (32 loc) · 831 Bytes
/
sampler1x.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package cl
/*
#cgo CFLAGS: -I CL
#cgo !darwin LDFLAGS: -lOpenCL
#cgo darwin LDFLAGS: -framework OpenCL
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
#ifdef __APPLE__
#include "OpenCL/opencl.h"
#else
#include "CL/opencl.h"
#endif
*/
import "C"
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}
}