MCPcopy Create free account
hub / github.com/Syncleus/aparapi / create2D

Method create2D

src/main/java/com/aparapi/Range.java:207–223  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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>.

Callers 11

test384x384Method · 0.95
test384x320Method · 0.95
testMethod · 0.95
singleDimensionTestMethod · 0.95
twoDimensionTestMethod · 0.95
recreateRangeMethod · 0.95
createRange2DMethod · 0.95

Calls 14

setGlobalSize_0Method · 0.95
setLocalSize_0Method · 0.95
setGlobalSize_1Method · 0.95
setLocalSize_1Method · 0.95
setValidMethod · 0.95
getLocalSize_0Method · 0.95
getLocalSize_1Method · 0.95
getMaxWorkItemSizeMethod · 0.95
getMaxWorkGroupSizeMethod · 0.95
getGlobalSize_0Method · 0.95
getGlobalSize_1Method · 0.95
isValidMethod · 0.95

Tested by 9

test384x384Method · 0.76
test384x320Method · 0.76
testMethod · 0.76
singleDimensionTestMethod · 0.76
twoDimensionTestMethod · 0.76