| 289 | } |
| 290 | |
| 291 | public List<OpenCLArgDescriptor> getArgs(Method m) { |
| 292 | final List<OpenCLArgDescriptor> args = new ArrayList<OpenCLArgDescriptor>(); |
| 293 | final Annotation[][] parameterAnnotations = m.getParameterAnnotations(); |
| 294 | final Class<?>[] parameterTypes = m.getParameterTypes(); |
| 295 | |
| 296 | for (int arg = 0; arg < parameterTypes.length; arg++) { |
| 297 | if (parameterTypes[arg].isAssignableFrom(Range.class)) { |
| 298 | |
| 299 | } else { |
| 300 | |
| 301 | long bits = 0L; |
| 302 | String name = null; |
| 303 | for (final Annotation pa : parameterAnnotations[arg]) { |
| 304 | if (pa instanceof GlobalReadOnly) { |
| 305 | name = ((GlobalReadOnly) pa).value(); |
| 306 | bits |= OpenCLArgDescriptor.ARG_GLOBAL_BIT | OpenCLArgDescriptor.ARG_READONLY_BIT; |
| 307 | } else if (pa instanceof GlobalWriteOnly) { |
| 308 | name = ((GlobalWriteOnly) pa).value(); |
| 309 | bits |= OpenCLArgDescriptor.ARG_GLOBAL_BIT | OpenCLArgDescriptor.ARG_WRITEONLY_BIT; |
| 310 | } else if (pa instanceof GlobalReadWrite) { |
| 311 | name = ((GlobalReadWrite) pa).value(); |
| 312 | bits |= OpenCLArgDescriptor.ARG_GLOBAL_BIT | OpenCLArgDescriptor.ARG_READWRITE_BIT; |
| 313 | } else if (pa instanceof Local) { |
| 314 | name = ((Local) pa).value(); |
| 315 | bits |= OpenCLArgDescriptor.ARG_LOCAL_BIT; |
| 316 | } else if (pa instanceof Constant) { |
| 317 | name = ((Constant) pa).value(); |
| 318 | bits |= OpenCLArgDescriptor.ARG_CONST_BIT | OpenCLArgDescriptor.ARG_READONLY_BIT; |
| 319 | } else if (pa instanceof Arg) { |
| 320 | name = ((Arg) pa).value(); |
| 321 | bits |= OpenCLArgDescriptor.ARG_ISARG_BIT; |
| 322 | } |
| 323 | |
| 324 | } |
| 325 | if (parameterTypes[arg].isArray()) { |
| 326 | if (parameterTypes[arg].isAssignableFrom(float[].class)) { |
| 327 | bits |= OpenCLArgDescriptor.ARG_FLOAT_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 328 | } else if (parameterTypes[arg].isAssignableFrom(int[].class)) { |
| 329 | bits |= OpenCLArgDescriptor.ARG_INT_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 330 | } else if (parameterTypes[arg].isAssignableFrom(double[].class)) { |
| 331 | bits |= OpenCLArgDescriptor.ARG_DOUBLE_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 332 | } else if (parameterTypes[arg].isAssignableFrom(byte[].class)) { |
| 333 | bits |= OpenCLArgDescriptor.ARG_BYTE_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 334 | } else if (parameterTypes[arg].isAssignableFrom(short[].class)) { |
| 335 | bits |= OpenCLArgDescriptor.ARG_SHORT_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 336 | } else if (parameterTypes[arg].isAssignableFrom(long[].class)) { |
| 337 | bits |= OpenCLArgDescriptor.ARG_LONG_BIT | OpenCLArgDescriptor.ARG_ARRAY_BIT; |
| 338 | } |
| 339 | } else if (parameterTypes[arg].isPrimitive()) { |
| 340 | if (parameterTypes[arg].isAssignableFrom(float.class)) { |
| 341 | bits |= OpenCLArgDescriptor.ARG_FLOAT_BIT | OpenCLArgDescriptor.ARG_PRIMITIVE_BIT; |
| 342 | } else if (parameterTypes[arg].isAssignableFrom(int.class)) { |
| 343 | bits |= OpenCLArgDescriptor.ARG_INT_BIT | OpenCLArgDescriptor.ARG_PRIMITIVE_BIT; |
| 344 | } else if (parameterTypes[arg].isAssignableFrom(double.class)) { |
| 345 | bits |= OpenCLArgDescriptor.ARG_DOUBLE_BIT | OpenCLArgDescriptor.ARG_PRIMITIVE_BIT; |
| 346 | } else if (parameterTypes[arg].isAssignableFrom(byte.class)) { |
| 347 | bits |= OpenCLArgDescriptor.ARG_BYTE_BIT | OpenCLArgDescriptor.ARG_PRIMITIVE_BIT; |
| 348 | } else if (parameterTypes[arg].isAssignableFrom(short.class)) { |