Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 1 | /* |
Stephen Hines | adeb809 | 2012-04-20 14:26:06 -0700 | [diff] [blame] | 2 | * Copyright (C) 2008-2012 The Android Open Source Project |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.renderscript; |
| 18 | |
Mathew Inwood | f0c90b1 | 2018-08-01 10:05:11 +0100 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 20 | import android.util.SparseArray; |
| 21 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 22 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 23 | * The parent class for all executable scripts. This should not be used by |
| 24 | * applications. |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 25 | **/ |
| 26 | public class Script extends BaseObj { |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * KernelID is an identifier for a Script + root function pair. It is used |
| 30 | * as an identifier for ScriptGroup creation. |
| 31 | * |
| 32 | * This class should not be directly created. Instead use the method in the |
| 33 | * reflected or intrinsic code "getKernelID_funcname()". |
| 34 | * |
| 35 | */ |
| 36 | public static final class KernelID extends BaseObj { |
| 37 | Script mScript; |
| 38 | int mSlot; |
| 39 | int mSig; |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 40 | KernelID(long id, RenderScript rs, Script s, int slot, int sig) { |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 41 | super(id, rs); |
| 42 | mScript = s; |
| 43 | mSlot = slot; |
| 44 | mSig = sig; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | private final SparseArray<KernelID> mKIDs = new SparseArray<KernelID>(); |
| 49 | /** |
| 50 | * Only to be used by generated reflected classes. |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 51 | */ |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 52 | protected KernelID createKernelID(int slot, int sig, Element ein, |
| 53 | Element eout) { |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 54 | KernelID k = mKIDs.get(slot); |
| 55 | if (k != null) { |
| 56 | return k; |
| 57 | } |
| 58 | |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 59 | long id = mRS.nScriptKernelIDCreate(getID(mRS), slot, sig); |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 60 | if (id == 0) { |
| 61 | throw new RSDriverException("Failed to create KernelID"); |
| 62 | } |
| 63 | |
| 64 | k = new KernelID(id, mRS, this, slot, sig); |
| 65 | mKIDs.put(slot, k); |
| 66 | return k; |
| 67 | } |
| 68 | |
| 69 | /** |
Yang Ni | be392ad | 2015-01-23 17:16:02 -0800 | [diff] [blame] | 70 | * InvokeID is an identifier for an invoke function. It is used |
| 71 | * as an identifier for ScriptGroup creation. |
| 72 | * |
| 73 | * This class should not be directly created. Instead use the method in the |
| 74 | * reflected or intrinsic code "getInvokeID_funcname()". |
| 75 | * |
| 76 | */ |
| 77 | public static final class InvokeID extends BaseObj { |
| 78 | Script mScript; |
| 79 | int mSlot; |
| 80 | InvokeID(long id, RenderScript rs, Script s, int slot) { |
| 81 | super(id, rs); |
| 82 | mScript = s; |
| 83 | mSlot = slot; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | private final SparseArray<InvokeID> mIIDs = new SparseArray<InvokeID>(); |
| 88 | /** |
Yang Ni | be392ad | 2015-01-23 17:16:02 -0800 | [diff] [blame] | 89 | * Only to be used by generated reflected classes. |
| 90 | */ |
| 91 | protected InvokeID createInvokeID(int slot) { |
| 92 | InvokeID i = mIIDs.get(slot); |
| 93 | if (i != null) { |
| 94 | return i; |
| 95 | } |
| 96 | |
| 97 | long id = mRS.nScriptInvokeIDCreate(getID(mRS), slot); |
| 98 | if (id == 0) { |
| 99 | throw new RSDriverException("Failed to create KernelID"); |
| 100 | } |
| 101 | |
| 102 | i = new InvokeID(id, mRS, this, slot); |
| 103 | mIIDs.put(slot, i); |
| 104 | return i; |
| 105 | } |
| 106 | |
| 107 | /** |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 108 | * FieldID is an identifier for a Script + exported field pair. It is used |
| 109 | * as an identifier for ScriptGroup creation. |
| 110 | * |
| 111 | * This class should not be directly created. Instead use the method in the |
| 112 | * reflected or intrinsic code "getFieldID_funcname()". |
| 113 | * |
| 114 | */ |
| 115 | public static final class FieldID extends BaseObj { |
| 116 | Script mScript; |
| 117 | int mSlot; |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 118 | FieldID(long id, RenderScript rs, Script s, int slot) { |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 119 | super(id, rs); |
| 120 | mScript = s; |
| 121 | mSlot = slot; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | private final SparseArray<FieldID> mFIDs = new SparseArray(); |
| 126 | /** |
| 127 | * Only to be used by generated reflected classes. |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 128 | */ |
| 129 | protected FieldID createFieldID(int slot, Element e) { |
| 130 | FieldID f = mFIDs.get(slot); |
| 131 | if (f != null) { |
| 132 | return f; |
| 133 | } |
| 134 | |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 135 | long id = mRS.nScriptFieldIDCreate(getID(mRS), slot); |
Jason Sams | 08a8158 | 2012-09-18 12:32:10 -0700 | [diff] [blame] | 136 | if (id == 0) { |
| 137 | throw new RSDriverException("Failed to create FieldID"); |
| 138 | } |
| 139 | |
| 140 | f = new FieldID(id, mRS, this, slot); |
| 141 | mFIDs.put(slot, f); |
| 142 | return f; |
| 143 | } |
| 144 | |
| 145 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 146 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 147 | * Only intended for use by generated reflected code. |
| 148 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 149 | */ |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 150 | protected void invoke(int slot) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 151 | mRS.nScriptInvoke(getID(mRS), slot); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 154 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 155 | * Only intended for use by generated reflected code. |
| 156 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 157 | */ |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 158 | protected void invoke(int slot, FieldPacker v) { |
| 159 | if (v != null) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 160 | mRS.nScriptInvokeV(getID(mRS), slot, v.getData()); |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 161 | } else { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 162 | mRS.nScriptInvoke(getID(mRS), slot); |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 163 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 164 | } |
| 165 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 166 | /** |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 167 | * Only intended for use by generated reflected code. |
| 168 | * |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 169 | */ |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 170 | protected void forEach(int slot, Allocation ain, Allocation aout, |
| 171 | FieldPacker v) { |
| 172 | forEach(slot, ain, aout, v, null); |
Jason Sams | 6e494d3 | 2011-04-27 16:33:11 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 175 | /** |
| 176 | * Only intended for use by generated reflected code. |
| 177 | * |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 178 | */ |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 179 | protected void forEach(int slot, Allocation ain, Allocation aout, |
| 180 | FieldPacker v, LaunchOptions sc) { |
| 181 | // TODO: Is this necessary if nScriptForEach calls validate as well? |
Jason Sams | 678cc7f | 2014-03-05 16:09:02 -0800 | [diff] [blame] | 182 | mRS.validate(); |
| 183 | mRS.validateObject(ain); |
| 184 | mRS.validateObject(aout); |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 185 | |
Jason Sams | d1516df | 2015-05-05 18:00:34 -0700 | [diff] [blame] | 186 | if (ain == null && aout == null && sc == null) { |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 187 | throw new RSIllegalArgumentException( |
Jason Sams | d1516df | 2015-05-05 18:00:34 -0700 | [diff] [blame] | 188 | "At least one of input allocation, output allocation, or LaunchOptions is required to be non-null."); |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 189 | } |
Tim Murray | ba9dd06 | 2013-02-12 16:22:34 -0800 | [diff] [blame] | 190 | |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 191 | long[] in_ids = null; |
Stephen Hines | c9c7daf | 2014-08-13 17:32:19 +0000 | [diff] [blame] | 192 | if (ain != null) { |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 193 | in_ids = mInIdsBuffer; |
| 194 | in_ids[0] = ain.getID(mRS); |
Stephen Hines | c9c7daf | 2014-08-13 17:32:19 +0000 | [diff] [blame] | 195 | } |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 196 | |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 197 | long out_id = 0; |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 198 | if (aout != null) { |
| 199 | out_id = aout.getID(mRS); |
| 200 | } |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 201 | |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 202 | byte[] params = null; |
| 203 | if (v != null) { |
| 204 | params = v.getData(); |
| 205 | } |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 206 | |
| 207 | int[] limits = null; |
| 208 | if (sc != null) { |
| 209 | limits = new int[6]; |
| 210 | |
| 211 | limits[0] = sc.xstart; |
| 212 | limits[1] = sc.xend; |
| 213 | limits[2] = sc.ystart; |
| 214 | limits[3] = sc.yend; |
| 215 | limits[4] = sc.zstart; |
| 216 | limits[5] = sc.zend; |
| 217 | } |
| 218 | |
| 219 | mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits); |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 220 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 221 | |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 222 | /** |
| 223 | * Only intended for use by generated reflected code. |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 224 | */ |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 225 | protected void forEach(int slot, Allocation[] ains, Allocation aout, |
| 226 | FieldPacker v) { |
Jason Sams | 6a420b5 | 2015-03-30 15:31:26 -0700 | [diff] [blame] | 227 | |
| 228 | // FieldPacker is kept here to support regular params in the future. |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 229 | forEach(slot, ains, aout, v, null); |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Only intended for use by generated reflected code. |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 234 | */ |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 235 | protected void forEach(int slot, Allocation[] ains, Allocation aout, |
| 236 | FieldPacker v, LaunchOptions sc) { |
| 237 | // TODO: Is this necessary if nScriptForEach calls validate as well? |
Jason Sams | 6a420b5 | 2015-03-30 15:31:26 -0700 | [diff] [blame] | 238 | // FieldPacker is kept here to support regular params in the future. |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 239 | mRS.validate(); |
Andreas Gampe | c8ddcdd | 2015-03-15 15:57:30 -0700 | [diff] [blame] | 240 | if (ains != null) { |
| 241 | for (Allocation ain : ains) { |
| 242 | mRS.validateObject(ain); |
| 243 | } |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 244 | } |
Stephen Hines | c9c7daf | 2014-08-13 17:32:19 +0000 | [diff] [blame] | 245 | mRS.validateObject(aout); |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 246 | |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 247 | if (ains == null && aout == null) { |
| 248 | throw new RSIllegalArgumentException( |
| 249 | "At least one of ain or aout is required to be non-null."); |
| 250 | } |
| 251 | |
Andreas Gampe | ad555f9 | 2015-03-17 20:05:46 -0700 | [diff] [blame] | 252 | long[] in_ids; |
| 253 | if (ains != null) { |
| 254 | in_ids = new long[ains.length]; |
| 255 | for (int index = 0; index < ains.length; ++index) { |
| 256 | in_ids[index] = ains[index].getID(mRS); |
| 257 | } |
| 258 | } else { |
| 259 | in_ids = null; |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | long out_id = 0; |
| 263 | if (aout != null) { |
| 264 | out_id = aout.getID(mRS); |
| 265 | } |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 266 | |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 267 | byte[] params = null; |
| 268 | if (v != null) { |
| 269 | params = v.getData(); |
| 270 | } |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 271 | |
| 272 | int[] limits = null; |
| 273 | if (sc != null) { |
| 274 | limits = new int[6]; |
| 275 | |
| 276 | limits[0] = sc.xstart; |
| 277 | limits[1] = sc.xend; |
| 278 | limits[2] = sc.ystart; |
| 279 | limits[3] = sc.yend; |
| 280 | limits[4] = sc.zstart; |
| 281 | limits[5] = sc.zend; |
| 282 | } |
| 283 | |
| 284 | mRS.nScriptForEach(getID(mRS), slot, in_ids, out_id, params, limits); |
Chris Wailes | 9496106 | 2014-06-11 12:01:28 -0700 | [diff] [blame] | 285 | } |
| 286 | |
Matt Wala | 36eb1f7 | 2015-07-20 15:35:27 -0700 | [diff] [blame] | 287 | /** |
David Gross | 26ef7a73 | 2016-01-12 12:19:15 -0800 | [diff] [blame] | 288 | * Only intended for use by generated reflected code. (General reduction) |
| 289 | * |
David Gross | 26ef7a73 | 2016-01-12 12:19:15 -0800 | [diff] [blame] | 290 | */ |
| 291 | protected void reduce(int slot, Allocation[] ains, Allocation aout, LaunchOptions sc) { |
| 292 | mRS.validate(); |
| 293 | if (ains == null || ains.length < 1) { |
| 294 | throw new RSIllegalArgumentException( |
| 295 | "At least one input is required."); |
| 296 | } |
| 297 | if (aout == null) { |
| 298 | throw new RSIllegalArgumentException( |
| 299 | "aout is required to be non-null."); |
| 300 | } |
| 301 | for (Allocation ain : ains) { |
| 302 | mRS.validateObject(ain); |
| 303 | } |
| 304 | |
| 305 | long[] in_ids = new long[ains.length]; |
| 306 | for (int index = 0; index < ains.length; ++index) { |
| 307 | in_ids[index] = ains[index].getID(mRS); |
| 308 | } |
| 309 | long out_id = aout.getID(mRS); |
| 310 | |
| 311 | int[] limits = null; |
| 312 | if (sc != null) { |
| 313 | limits = new int[6]; |
| 314 | |
| 315 | limits[0] = sc.xstart; |
| 316 | limits[1] = sc.xend; |
| 317 | limits[2] = sc.ystart; |
| 318 | limits[3] = sc.yend; |
| 319 | limits[4] = sc.zstart; |
| 320 | limits[5] = sc.zend; |
| 321 | } |
| 322 | |
David Gross | 4a45785 | 2016-06-02 14:46:55 -0700 | [diff] [blame] | 323 | mRS.nScriptReduce(getID(mRS), slot, in_ids, out_id, limits); |
David Gross | 26ef7a73 | 2016-01-12 12:19:15 -0800 | [diff] [blame] | 324 | } |
| 325 | |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 326 | long[] mInIdsBuffer; |
| 327 | |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 328 | Script(long id, RenderScript rs) { |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 329 | super(id, rs); |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 330 | |
| 331 | mInIdsBuffer = new long[1]; |
Yang Ni | 6484b6b | 2016-03-24 09:40:32 -0700 | [diff] [blame] | 332 | |
| 333 | /* The constructors for the derived classes (including ScriptIntrinsic |
| 334 | * derived classes and ScriptC derived classes generated by Slang |
| 335 | * reflection) seem to be simple enough, so we just put the guard.open() |
| 336 | * call here, rather than in the end of the constructor for the derived |
| 337 | * class. This, of course, assumes the derived constructor would not |
| 338 | * throw any exception after calling this constructor. |
| 339 | * |
| 340 | * If new derived classes are added with more complicated constructors |
| 341 | * that throw exceptions, this call has to be (duplicated and) moved |
| 342 | * to the end of each derived class constructor. |
| 343 | */ |
| 344 | guard.open("destroy"); |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 345 | } |
| 346 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 347 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 348 | * Only intended for use by generated reflected code. |
| 349 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 350 | */ |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 351 | public void bindAllocation(Allocation va, int slot) { |
Jason Sams | 771bebb | 2009-12-07 12:40:12 -0800 | [diff] [blame] | 352 | mRS.validate(); |
Jason Sams | 678cc7f | 2014-03-05 16:09:02 -0800 | [diff] [blame] | 353 | mRS.validateObject(va); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 354 | if (va != null) { |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 355 | |
| 356 | android.content.Context context = mRS.getApplicationContext(); |
| 357 | |
| 358 | if (context.getApplicationInfo().targetSdkVersion >= 20) { |
Jason Sams | cf9c894 | 2014-01-14 16:18:14 -0800 | [diff] [blame] | 359 | final Type t = va.mType; |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 360 | if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) || |
| 361 | (t.getZ() != 0)) { |
| 362 | |
Jason Sams | cf9c894 | 2014-01-14 16:18:14 -0800 | [diff] [blame] | 363 | throw new RSIllegalArgumentException( |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 364 | "API 20+ only allows simple 1D allocations to be " + |
| 365 | "used with bind."); |
Jason Sams | cf9c894 | 2014-01-14 16:18:14 -0800 | [diff] [blame] | 366 | } |
| 367 | } |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 368 | mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 369 | } else { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 370 | mRS.nScriptBindAllocation(getID(mRS), 0, slot); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 371 | } |
| 372 | } |
| 373 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 374 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 375 | * Only intended for use by generated reflected code. |
| 376 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 377 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 378 | public void setVar(int index, float v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 379 | mRS.nScriptSetVarF(getID(mRS), index, v); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 380 | } |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 381 | public float getVarF(int index) { |
| 382 | return mRS.nScriptGetVarF(getID(mRS), index); |
| 383 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 384 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 385 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 386 | * Only intended for use by generated reflected code. |
| 387 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 388 | */ |
Stephen Hines | ca54ec3 | 2010-09-20 17:20:30 -0700 | [diff] [blame] | 389 | public void setVar(int index, double v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 390 | mRS.nScriptSetVarD(getID(mRS), index, v); |
Stephen Hines | ca54ec3 | 2010-09-20 17:20:30 -0700 | [diff] [blame] | 391 | } |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 392 | public double getVarD(int index) { |
| 393 | return mRS.nScriptGetVarD(getID(mRS), index); |
| 394 | } |
Stephen Hines | ca54ec3 | 2010-09-20 17:20:30 -0700 | [diff] [blame] | 395 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 396 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 397 | * Only intended for use by generated reflected code. |
| 398 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 399 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 400 | public void setVar(int index, int v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 401 | mRS.nScriptSetVarI(getID(mRS), index, v); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 402 | } |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 403 | public int getVarI(int index) { |
| 404 | return mRS.nScriptGetVarI(getID(mRS), index); |
| 405 | } |
| 406 | |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 407 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 408 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 409 | * Only intended for use by generated reflected code. |
| 410 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 411 | */ |
Stephen Hines | 031ec58c | 2010-10-11 10:54:21 -0700 | [diff] [blame] | 412 | public void setVar(int index, long v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 413 | mRS.nScriptSetVarJ(getID(mRS), index, v); |
Stephen Hines | 031ec58c | 2010-10-11 10:54:21 -0700 | [diff] [blame] | 414 | } |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 415 | public long getVarJ(int index) { |
| 416 | return mRS.nScriptGetVarJ(getID(mRS), index); |
| 417 | } |
| 418 | |
Stephen Hines | 031ec58c | 2010-10-11 10:54:21 -0700 | [diff] [blame] | 419 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 420 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 421 | * Only intended for use by generated reflected code. |
| 422 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 423 | */ |
Jason Sams | 0b9a22c | 2010-07-02 15:35:19 -0700 | [diff] [blame] | 424 | public void setVar(int index, boolean v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 425 | mRS.nScriptSetVarI(getID(mRS), index, v ? 1 : 0); |
Jason Sams | 0b9a22c | 2010-07-02 15:35:19 -0700 | [diff] [blame] | 426 | } |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 427 | public boolean getVarB(int index) { |
| 428 | return mRS.nScriptGetVarI(getID(mRS), index) > 0 ? true : false; |
| 429 | } |
Jason Sams | 0b9a22c | 2010-07-02 15:35:19 -0700 | [diff] [blame] | 430 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 431 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 432 | * Only intended for use by generated reflected code. |
| 433 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 434 | */ |
Jason Sams | 6f4cf0b | 2010-11-16 17:37:02 -0800 | [diff] [blame] | 435 | public void setVar(int index, BaseObj o) { |
Jason Sams | 678cc7f | 2014-03-05 16:09:02 -0800 | [diff] [blame] | 436 | mRS.validate(); |
| 437 | mRS.validateObject(o); |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 438 | mRS.nScriptSetVarObj(getID(mRS), index, (o == null) ? 0 : o.getID(mRS)); |
Jason Sams | 6f4cf0b | 2010-11-16 17:37:02 -0800 | [diff] [blame] | 439 | } |
| 440 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 441 | /** |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 442 | * Only intended for use by generated reflected code. |
| 443 | * |
Jason Sams | 67e3d20 | 2011-01-09 13:49:01 -0800 | [diff] [blame] | 444 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 445 | public void setVar(int index, FieldPacker v) { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 446 | mRS.nScriptSetVarV(getID(mRS), index, v.getData()); |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 447 | } |
| 448 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 449 | /** |
Stephen Hines | adeb809 | 2012-04-20 14:26:06 -0700 | [diff] [blame] | 450 | * Only intended for use by generated reflected code. |
| 451 | * |
Stephen Hines | adeb809 | 2012-04-20 14:26:06 -0700 | [diff] [blame] | 452 | */ |
| 453 | public void setVar(int index, FieldPacker v, Element e, int[] dims) { |
| 454 | mRS.nScriptSetVarVE(getID(mRS), index, v.getData(), e.getID(mRS), dims); |
| 455 | } |
| 456 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 457 | /** |
| 458 | * Only intended for use by generated reflected code. |
| 459 | * |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 460 | */ |
Tim Murray | 7c4caad | 2013-04-10 16:21:40 -0700 | [diff] [blame] | 461 | public void getVarV(int index, FieldPacker v) { |
| 462 | mRS.nScriptGetVarV(getID(mRS), index, v.getData()); |
| 463 | } |
| 464 | |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 465 | public void setTimeZone(String timeZone) { |
Jason Sams | 771bebb | 2009-12-07 12:40:12 -0800 | [diff] [blame] | 466 | mRS.validate(); |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 467 | try { |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 468 | mRS.nScriptSetTimeZone(getID(mRS), timeZone.getBytes("UTF-8")); |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 469 | } catch (java.io.UnsupportedEncodingException e) { |
| 470 | throw new RuntimeException(e); |
| 471 | } |
| 472 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 473 | |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 474 | /** |
| 475 | * Only intended for use by generated reflected code. |
| 476 | * |
| 477 | */ |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 478 | public static class Builder { |
Mathew Inwood | f0c90b1 | 2018-08-01 10:05:11 +0100 | [diff] [blame] | 479 | @UnsupportedAppUsage |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 480 | RenderScript mRS; |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 481 | |
Mathew Inwood | f0c90b1 | 2018-08-01 10:05:11 +0100 | [diff] [blame] | 482 | @UnsupportedAppUsage |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 483 | Builder(RenderScript rs) { |
| 484 | mRS = rs; |
| 485 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 488 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 489 | /** |
| 490 | * Only intended for use by generated reflected code. |
| 491 | * |
| 492 | */ |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 493 | public static class FieldBase { |
| 494 | protected Element mElement; |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 495 | protected Allocation mAllocation; |
| 496 | |
| 497 | protected void init(RenderScript rs, int dimx) { |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 498 | mAllocation = Allocation.createSized(rs, mElement, dimx, |
| 499 | Allocation.USAGE_SCRIPT); |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | protected void init(RenderScript rs, int dimx, int usages) { |
Chris Wailes | be7b1de | 2014-07-15 10:56:14 -0700 | [diff] [blame] | 503 | mAllocation = |
| 504 | Allocation.createSized(rs, mElement, dimx, |
| 505 | Allocation.USAGE_SCRIPT | usages); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | protected FieldBase() { |
| 509 | } |
| 510 | |
| 511 | public Element getElement() { |
| 512 | return mElement; |
| 513 | } |
| 514 | |
| 515 | public Type getType() { |
Jason Sams | 31a7e42 | 2010-10-26 13:09:17 -0700 | [diff] [blame] | 516 | return mAllocation.getType(); |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | public Allocation getAllocation() { |
| 520 | return mAllocation; |
| 521 | } |
| 522 | |
| 523 | //@Override |
| 524 | public void updateAllocation() { |
| 525 | } |
Jason Sams | 2d71bc7 | 2010-03-26 16:06:43 -0700 | [diff] [blame] | 526 | } |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 527 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 528 | |
| 529 | /** |
Jason Sams | 8610f83 | 2015-03-30 17:01:10 -0700 | [diff] [blame] | 530 | * Class for specifying the specifics about how a kernel will be |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 531 | * launched. |
Jason Sams | 8610f83 | 2015-03-30 17:01:10 -0700 | [diff] [blame] | 532 | * |
| 533 | * This class can specify a potential range of cells on which to |
| 534 | * run a kernel. If no set is called for a dimension then this |
| 535 | * class will have no impact on that dimension when the kernel |
| 536 | * is executed. |
| 537 | * |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 538 | * The forEach kernel launch will operate over the intersection of |
| 539 | * the dimensions. |
Jason Sams | 8610f83 | 2015-03-30 17:01:10 -0700 | [diff] [blame] | 540 | * |
| 541 | * Example: |
| 542 | * LaunchOptions with setX(5, 15) |
| 543 | * Allocation with dimension X=10, Y=10 |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 544 | * The resulting forEach run would execute over: |
| 545 | * x = 5 to 9 (inclusive) and |
| 546 | * y = 0 to 9 (inclusive). |
Jason Sams | 8610f83 | 2015-03-30 17:01:10 -0700 | [diff] [blame] | 547 | * |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 548 | * |
| 549 | */ |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 550 | public static final class LaunchOptions { |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 551 | private int xstart = 0; |
| 552 | private int ystart = 0; |
| 553 | private int xend = 0; |
| 554 | private int yend = 0; |
| 555 | private int zstart = 0; |
| 556 | private int zend = 0; |
| 557 | private int strategy; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 558 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 559 | /** |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 560 | * Set the X range. xstartArg is the lowest coordinate of the range, |
| 561 | * and xendArg-1 is the highest coordinate of the range. |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 562 | * |
| 563 | * @param xstartArg Must be >= 0 |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 564 | * @param xendArg Must be > xstartArg |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 565 | * |
| 566 | * @return LaunchOptions |
| 567 | */ |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 568 | public LaunchOptions setX(int xstartArg, int xendArg) { |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 569 | if (xstartArg < 0 || xendArg <= xstartArg) { |
| 570 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 571 | } |
| 572 | xstart = xstartArg; |
| 573 | xend = xendArg; |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 574 | return this; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 575 | } |
| 576 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 577 | /** |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 578 | * Set the Y range. ystartArg is the lowest coordinate of the range, |
| 579 | * and yendArg-1 is the highest coordinate of the range. |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 580 | * |
| 581 | * @param ystartArg Must be >= 0 |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 582 | * @param yendArg Must be > ystartArg |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 583 | * |
| 584 | * @return LaunchOptions |
| 585 | */ |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 586 | public LaunchOptions setY(int ystartArg, int yendArg) { |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 587 | if (ystartArg < 0 || yendArg <= ystartArg) { |
| 588 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 589 | } |
| 590 | ystart = ystartArg; |
| 591 | yend = yendArg; |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 592 | return this; |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 593 | } |
| 594 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 595 | /** |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 596 | * Set the Z range. zstartArg is the lowest coordinate of the range, |
| 597 | * and zendArg-1 is the highest coordinate of the range. |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 598 | * |
| 599 | * @param zstartArg Must be >= 0 |
Miao Wang | 53fdcfb | 2016-03-29 15:14:21 -0700 | [diff] [blame] | 600 | * @param zendArg Must be > zstartArg |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 601 | * |
| 602 | * @return LaunchOptions |
| 603 | */ |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 604 | public LaunchOptions setZ(int zstartArg, int zendArg) { |
| 605 | if (zstartArg < 0 || zendArg <= zstartArg) { |
| 606 | throw new RSIllegalArgumentException("Invalid dimensions"); |
| 607 | } |
| 608 | zstart = zstartArg; |
| 609 | zend = zendArg; |
| 610 | return this; |
| 611 | } |
| 612 | |
| 613 | |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 614 | /** |
| 615 | * Returns the current X start |
| 616 | * |
| 617 | * @return int current value |
| 618 | */ |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 619 | public int getXStart() { |
| 620 | return xstart; |
| 621 | } |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 622 | /** |
| 623 | * Returns the current X end |
| 624 | * |
| 625 | * @return int current value |
| 626 | */ |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 627 | public int getXEnd() { |
| 628 | return xend; |
| 629 | } |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 630 | /** |
| 631 | * Returns the current Y start |
| 632 | * |
| 633 | * @return int current value |
| 634 | */ |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 635 | public int getYStart() { |
| 636 | return ystart; |
| 637 | } |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 638 | /** |
| 639 | * Returns the current Y end |
| 640 | * |
| 641 | * @return int current value |
| 642 | */ |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 643 | public int getYEnd() { |
| 644 | return yend; |
| 645 | } |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 646 | /** |
| 647 | * Returns the current Z start |
| 648 | * |
| 649 | * @return int current value |
| 650 | */ |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 651 | public int getZStart() { |
| 652 | return zstart; |
| 653 | } |
Jason Sams | f64cca9 | 2013-04-19 12:56:37 -0700 | [diff] [blame] | 654 | /** |
| 655 | * Returns the current Z end |
| 656 | * |
| 657 | * @return int current value |
| 658 | */ |
Tim Murray | eb8c29c | 2013-02-07 12:16:41 -0800 | [diff] [blame] | 659 | public int getZEnd() { |
| 660 | return zend; |
| 661 | } |
Tim Murray | fbfaa85 | 2012-12-14 16:01:58 -0800 | [diff] [blame] | 662 | |
| 663 | } |
Jason Sams | 69f0d31 | 2009-08-03 18:11:17 -0700 | [diff] [blame] | 664 | } |