… | |
… | |
192 | IV iv; |
192 | IV iv; |
193 | const char *name; |
193 | const char *name; |
194 | #define const_iv(name) { (IV)CL_ ## name, # name }, |
194 | #define const_iv(name) { (IV)CL_ ## name, # name }, |
195 | } ivstr; |
195 | } ivstr; |
196 | |
196 | |
|
|
197 | typedef struct |
|
|
198 | { |
|
|
199 | NV nv; |
|
|
200 | const char *name; |
|
|
201 | #define const_nv(name) { (NV)CL_ ## name, # name }, |
|
|
202 | } nvstr; |
|
|
203 | |
197 | static const char * |
204 | static const char * |
198 | iv2str (IV value, const ivstr *base, int count, const char *fallback) |
205 | iv2str (IV value, const ivstr *base, int count, const char *fallback) |
199 | { |
206 | { |
200 | int i; |
207 | int i; |
201 | static char strbuf [32]; |
208 | static char strbuf [32]; |
… | |
… | |
795 | eq_signal_arg = (void*)arg; |
802 | eq_signal_arg = (void*)arg; |
796 | |
803 | |
797 | BOOT: |
804 | BOOT: |
798 | { |
805 | { |
799 | HV *stash = gv_stashpv ("OpenCL", 1); |
806 | HV *stash = gv_stashpv ("OpenCL", 1); |
|
|
807 | |
800 | static const ivstr *civ, const_iv[] = { |
808 | static const ivstr *civ, const_iv[] = { |
801 | { sizeof (cl_char ), "SIZEOF_CHAR" }, |
809 | { sizeof (cl_char ), "SIZEOF_CHAR" }, |
802 | { sizeof (cl_uchar ), "SIZEOF_UCHAR" }, |
810 | { sizeof (cl_uchar ), "SIZEOF_UCHAR" }, |
803 | { sizeof (cl_short ), "SIZEOF_SHORT" }, |
811 | { sizeof (cl_short ), "SIZEOF_SHORT" }, |
804 | { sizeof (cl_ushort), "SIZEOF_USHORT" }, |
812 | { sizeof (cl_ushort), "SIZEOF_USHORT" }, |
… | |
… | |
813 | #include "constiv.h" |
821 | #include "constiv.h" |
814 | }; |
822 | }; |
815 | |
823 | |
816 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
824 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
817 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
825 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
|
|
826 | |
|
|
827 | static const nvstr *cnv, const_nv[] = { |
|
|
828 | #include "constnv.h" |
|
|
829 | }; |
|
|
830 | |
|
|
831 | for (cnv = const_nv + sizeof (const_nv) / sizeof (const_nv [0]); cnv > const_nv; cnv--) |
|
|
832 | newCONSTSUB (stash, (char *)cnv[-1].name, newSVnv (cnv[-1].nv)); |
|
|
833 | |
|
|
834 | newCONSTSUB (stash, "NAN", newSVnv (CL_NAN)); // CL_NAN might be a function call |
818 | |
835 | |
819 | stash_platform = gv_stashpv ("OpenCL::Platform", GV_ADD); |
836 | stash_platform = gv_stashpv ("OpenCL::Platform", GV_ADD); |
820 | stash_device = gv_stashpv ("OpenCL::Device", GV_ADD); |
837 | stash_device = gv_stashpv ("OpenCL::Device", GV_ADD); |
821 | stash_subdevice = gv_stashpv ("OpenCL::SubDevice", GV_ADD); |
838 | stash_subdevice = gv_stashpv ("OpenCL::SubDevice", GV_ADD); |
822 | stash_context = gv_stashpv ("OpenCL::Context", GV_ADD); |
839 | stash_context = gv_stashpv ("OpenCL::Context", GV_ADD); |
… | |
… | |
2794 | CODE: |
2811 | CODE: |
2795 | clSetKernelArg (self, idx, sizeof (value), value ? &value : 0); |
2812 | clSetKernelArg (self, idx, sizeof (value), value ? &value : 0); |
2796 | |
2813 | |
2797 | void |
2814 | void |
2798 | set_image (OpenCL::Kernel self, cl_uint idx, OpenCL::Image_ornull value) |
2815 | set_image (OpenCL::Kernel self, cl_uint idx, OpenCL::Image_ornull value) |
2799 | ALIAS: |
|
|
2800 | set_image2d = 0 |
|
|
2801 | set_image3d = 0 |
|
|
2802 | CODE: |
2816 | CODE: |
2803 | clSetKernelArg (self, idx, sizeof (value), value ? &value : 0); |
2817 | clSetKernelArg (self, idx, sizeof (value), value ? &value : 0); |
2804 | |
2818 | |
2805 | void |
2819 | void |
2806 | set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value) |
2820 | set_sampler (OpenCL::Kernel self, cl_uint idx, OpenCL::Sampler value) |