| 25 | namespace clMath { |
| 26 | |
| 27 | static size_t |
| 28 | imageMaxDimension(cl_context context, int widthHeight) |
| 29 | { |
| 30 | cl_int err; |
| 31 | cl_device_id devices[2]; |
| 32 | size_t i, retSize; |
| 33 | size_t rc = (size_t)-1; |
| 34 | cl_device_info par; |
| 35 | |
| 36 | par = (widthHeight) ? CL_DEVICE_IMAGE2D_MAX_HEIGHT : |
| 37 | CL_DEVICE_IMAGE2D_MAX_WIDTH; |
| 38 | |
| 39 | err = clGetContextInfo(context, CL_CONTEXT_DEVICES, |
| 40 | sizeof(devices), devices, &retSize); |
| 41 | if (err == CL_SUCCESS) { |
| 42 | size_t s; |
| 43 | |
| 44 | retSize /= sizeof(cl_device_id); |
| 45 | for (i = 0; (i < retSize) && (err == CL_SUCCESS); i++) { |
| 46 | err = clGetDeviceInfo(devices[i], par, sizeof(s), &s, NULL); |
| 47 | if (err == CL_SUCCESS) { |
| 48 | rc = std::min(rc, s); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | if (err != CL_SUCCESS) { |
| 54 | rc = 0; |
| 55 | } |
| 56 | |
| 57 | return rc; |
| 58 | } |
| 59 | |
| 60 | static size_t |
| 61 | imageMaxWidth(cl_context context) |
no outgoing calls
no test coverage detected