Create a two dimensional range 0.._globalWidth x 0.._globalHeight using a group which is _localWidth x _localHeight in size. Note that for this range to be valid _globalWidth > 0 && _globalHeight >0 && _localWidth>0 && _localHeight>0 && _localWidth _localHeight < MAX_GROUP_SIZE && _globalWid
(Device _device, int _globalWidth, int _globalHeight, int _localWidth, int _localHeight)
| 205 | * @return |
| 206 | */ |
| 207 | public static Range create2D(Device _device, int _globalWidth, int _globalHeight, int _localWidth, int _localHeight) { |
| 208 | final Range range = new Range(_device, 2); |
| 209 | |
| 210 | range.setGlobalSize_0(_globalWidth); |
| 211 | range.setLocalSize_0(_localWidth); |
| 212 | range.setGlobalSize_1(_globalHeight); |
| 213 | range.setLocalSize_1(_localHeight); |
| 214 | |
| 215 | range.setValid((range.getLocalSize_0() > 0) && (range.getLocalSize_1() > 0) |
| 216 | && (range.getLocalSize_0() <= range.getMaxWorkItemSize()[0]) |
| 217 | && (range.getLocalSize_1() <= range.getMaxWorkItemSize()[1]) |
| 218 | && ((range.getLocalSize_0() * range.getLocalSize_1()) <= range.getMaxWorkGroupSize()) |
| 219 | && ((range.getGlobalSize_0() % range.getLocalSize_0()) == 0) |
| 220 | && ((range.getGlobalSize_1() % range.getLocalSize_1()) == 0)); |
| 221 | |
| 222 | return (range); |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Create a two dimensional range <code>0.._globalWidth * 0.._globalHeight</code> choosing suitable values for <code>localWidth</code> and <code>localHeight</code>. |