blob: dc2378596d00218a09f8306724555add61a9fd39 [file] [log] [blame]
Jason Samsb8c5a842009-07-31 20:40:47 -07001/*
Jason Samsdd6c8b32013-02-15 17:27:24 -08002 * Copyright (C) 2013 The Android Open Source Project
Jason Samsb8c5a842009-07-31 20:40:47 -07003 *
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
17package android.renderscript;
18
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -070019/**
Tim Murrayc11e25c2013-04-09 11:01:01 -070020 * <p>A Type describes the {@link android.renderscript.Element} and dimensions used for an {@link
21 * android.renderscript.Allocation} or a parallel operation. Types are created through {@link
22 * android.renderscript.Type.Builder}.</p>
Jason Samsa1b13ed2010-11-12 14:58:37 -080023 *
Tim Murrayc11e25c2013-04-09 11:01:01 -070024 * <p>A Type always includes an {@link android.renderscript.Element} and an X
25 * dimension. A Type may be multidimensional, up to three dimensions. A nonzero
26 * value in the Y or Z dimensions indicates that the dimension is present. Note
27 * that a Type with only a given X dimension and a Type with the same X
28 * dimension but Y = 1 are not equivalent.</p>
Jason Samsa1b13ed2010-11-12 14:58:37 -080029 *
Tim Murrayc11e25c2013-04-09 11:01:01 -070030 * <p>A Type also supports inclusion of level of detail (LOD) or cube map
31 * faces. LOD and cube map faces are booleans to indicate present or not
32 * present. </p>
33 *
Eino-Ville Talvalaccadaf12013-08-14 10:36:30 -070034 * <p>A Type also supports YUV format information to support an
35 * {@link android.renderscript.Allocation} in a YUV format. The YUV formats
36 * supported are {@link android.graphics.ImageFormat#YV12},
37 * {@link android.graphics.ImageFormat#NV21}, and
38 * {@link android.graphics.ImageFormat#YUV_420_888}</p>
Jason Samsa1b13ed2010-11-12 14:58:37 -080039 *
Joe Fernandez3aef8e1d2011-12-20 10:38:34 -080040 * <div class="special reference">
41 * <h3>Developer Guides</h3>
Tim Murrayc11e25c2013-04-09 11:01:01 -070042 * <p>For more information about creating an application that uses RenderScript, read the
43 * <a href="{@docRoot}guide/topics/renderscript/index.html">RenderScript</a> developer guide.</p>
Joe Fernandez3aef8e1d2011-12-20 10:38:34 -080044 * </div>
Jason Samsb8c5a842009-07-31 20:40:47 -070045 **/
46public class Type extends BaseObj {
Jason Sams768bc022009-09-21 19:41:04 -070047 int mDimX;
48 int mDimY;
49 int mDimZ;
Jason Samsbf6ef8d2010-12-06 15:59:59 -080050 boolean mDimMipmaps;
Jason Sams768bc022009-09-21 19:41:04 -070051 boolean mDimFaces;
Jason Sams8140d7b2012-12-13 17:01:09 -080052 int mDimYuv;
Jason Sams768bc022009-09-21 19:41:04 -070053 int mElementCount;
Jason Sams1bada8c2009-08-09 17:01:55 -070054 Element mElement;
Jason Sams46ba27e32015-02-06 17:45:15 -080055 int mArrays[];
56
57 static final int mMaxArrays = 4;
Jason Sams768bc022009-09-21 19:41:04 -070058
Jason Sams49a05d72010-12-29 14:31:29 -080059 public enum CubemapFace {
Stephen Hines20fbd012011-06-16 17:44:53 -070060 POSITIVE_X (0),
Jason Sams49a05d72010-12-29 14:31:29 -080061 NEGATIVE_X (1),
Stephen Hines20fbd012011-06-16 17:44:53 -070062 POSITIVE_Y (2),
Jason Sams49a05d72010-12-29 14:31:29 -080063 NEGATIVE_Y (3),
Stephen Hines20fbd012011-06-16 17:44:53 -070064 POSITIVE_Z (4),
65 NEGATIVE_Z (5),
66 @Deprecated
67 POSITVE_X (0),
68 @Deprecated
69 POSITVE_Y (2),
70 @Deprecated
71 POSITVE_Z (4);
Jason Sams49a05d72010-12-29 14:31:29 -080072
73 int mID;
74 CubemapFace(int id) {
75 mID = id;
76 }
77 }
78
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -070079 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -080080 * Return the element associated with this Type.
81 *
82 * @return Element
83 */
Jason Samse17964e2010-01-04 16:52:27 -080084 public Element getElement() {
85 return mElement;
86 }
Jason Sams1bada8c2009-08-09 17:01:55 -070087
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -070088 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -080089 * Return the value of the X dimension.
90 *
91 * @return int
92 */
Jason Sams768bc022009-09-21 19:41:04 -070093 public int getX() {
94 return mDimX;
95 }
Jason Samsa1b13ed2010-11-12 14:58:37 -080096
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -070097 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -080098 * Return the value of the Y dimension or 0 for a 1D allocation.
99 *
100 * @return int
101 */
Jason Sams768bc022009-09-21 19:41:04 -0700102 public int getY() {
103 return mDimY;
104 }
Jason Samsa1b13ed2010-11-12 14:58:37 -0800105
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700106 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800107 * Return the value of the Z dimension or 0 for a 1D or 2D allocation.
108 *
109 * @return int
110 */
Jason Sams768bc022009-09-21 19:41:04 -0700111 public int getZ() {
112 return mDimZ;
113 }
Jason Samsa1b13ed2010-11-12 14:58:37 -0800114
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700115 /**
Jason Sams5a722cf2013-03-26 13:27:37 -0700116 * Get the YUV format
117 *
Jason Sams02d56d92013-04-12 16:40:50 -0700118 *
Jason Sams5a722cf2013-03-26 13:27:37 -0700119 * @return int
120 */
121 public int getYuv() {
122 return mDimYuv;
123 }
124
125 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800126 * Return if the Type has a mipmap chain.
127 *
128 * @return boolean
129 */
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800130 public boolean hasMipmaps() {
131 return mDimMipmaps;
Jason Sams768bc022009-09-21 19:41:04 -0700132 }
Jason Samsa1b13ed2010-11-12 14:58:37 -0800133
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700134 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800135 * Return if the Type is a cube map.
136 *
137 * @return boolean
138 */
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800139 public boolean hasFaces() {
Jason Sams768bc022009-09-21 19:41:04 -0700140 return mDimFaces;
141 }
Jason Samsa1b13ed2010-11-12 14:58:37 -0800142
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700143 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800144 * Return the total number of accessable cells in the Type.
145 *
146 * @return int
147 */
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800148 public int getCount() {
Jason Sams768bc022009-09-21 19:41:04 -0700149 return mElementCount;
150 }
151
Jason Sams46ba27e32015-02-06 17:45:15 -0800152 /**
Jason Samsd0162662015-04-15 17:18:10 -0700153 * @hide
Jason Sams6a420b52015-03-30 15:31:26 -0700154 * Return the dimension of the specified array.
155 *
156 * @param arrayNum The array dimension to query
157 * @return int
158 */
159 public int getArray(int arrayNum) {
160 if ((arrayNum < 0) || (arrayNum >= mMaxArrays)) {
Jason Sams46ba27e32015-02-06 17:45:15 -0800161 throw new RSIllegalArgumentException("Array dimension out of range.");
162 }
163
Jason Sams6a420b52015-03-30 15:31:26 -0700164 if (mArrays == null || arrayNum >= mArrays.length) {
Jason Sams46ba27e32015-02-06 17:45:15 -0800165 // Dimension in range but no array for that dimension allocated
166 return 0;
167 }
168
Jason Sams6a420b52015-03-30 15:31:26 -0700169 return mArrays[arrayNum];
Jason Sams46ba27e32015-02-06 17:45:15 -0800170 }
171
172 /**
Jason Samsd0162662015-04-15 17:18:10 -0700173 * @hide
Jason Sams6a420b52015-03-30 15:31:26 -0700174 * Return the number of array dimensions.
175 *
176 * @return int
177 */
Jason Sams46ba27e32015-02-06 17:45:15 -0800178 public int getArrayCount() {
179 if (mArrays != null) return mArrays.length;
180 return 0;
181 }
182
Jason Sams768bc022009-09-21 19:41:04 -0700183 void calcElementCount() {
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800184 boolean hasLod = hasMipmaps();
Jason Sams768bc022009-09-21 19:41:04 -0700185 int x = getX();
186 int y = getY();
187 int z = getZ();
188 int faces = 1;
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800189 if (hasFaces()) {
Jason Sams768bc022009-09-21 19:41:04 -0700190 faces = 6;
191 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800192 if (x == 0) {
Jason Sams768bc022009-09-21 19:41:04 -0700193 x = 1;
194 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800195 if (y == 0) {
Jason Sams768bc022009-09-21 19:41:04 -0700196 y = 1;
197 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800198 if (z == 0) {
Jason Sams768bc022009-09-21 19:41:04 -0700199 z = 1;
200 }
201
202 int count = x * y * z * faces;
Alex Sakhartchouk9ea30a62011-03-02 12:33:50 -0800203
204 while (hasLod && ((x > 1) || (y > 1) || (z > 1))) {
Jason Sams768bc022009-09-21 19:41:04 -0700205 if(x > 1) {
206 x >>= 1;
207 }
208 if(y > 1) {
209 y >>= 1;
210 }
211 if(z > 1) {
212 z >>= 1;
213 }
214
215 count += x * y * z * faces;
216 }
Jason Sams46ba27e32015-02-06 17:45:15 -0800217
218 if (mArrays != null) {
219 for (int ct = 0; ct < mArrays.length; ct++) {
220 count *= mArrays[ct];
221 }
222 }
223
Jason Sams768bc022009-09-21 19:41:04 -0700224 mElementCount = count;
225 }
226
227
Tim Murray460a0492013-11-19 12:45:54 -0800228 Type(long id, RenderScript rs) {
Alex Sakhartchouk0de94442010-08-11 14:41:28 -0700229 super(id, rs);
Jason Sams43ee06852009-08-12 17:54:11 -0700230 }
231
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700232 @Override
233 void updateFromNative() {
Ashok Bhat98071552014-02-12 09:54:43 +0000234 // We have 6 integer/long to obtain mDimX; mDimY; mDimZ;
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700235 // mDimLOD; mDimFaces; mElement;
Ashok Bhat98071552014-02-12 09:54:43 +0000236 long[] dataBuffer = new long[6];
237 mRS.nTypeGetNativeData(getID(mRS), dataBuffer);
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700238
Ashok Bhat98071552014-02-12 09:54:43 +0000239 mDimX = (int)dataBuffer[0];
240 mDimY = (int)dataBuffer[1];
241 mDimZ = (int)dataBuffer[2];
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800242 mDimMipmaps = dataBuffer[3] == 1 ? true : false;
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700243 mDimFaces = dataBuffer[4] == 1 ? true : false;
244
Ashok Bhat98071552014-02-12 09:54:43 +0000245 long elementID = dataBuffer[5];
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700246 if(elementID != 0) {
Alex Sakhartchouk0de94442010-08-11 14:41:28 -0700247 mElement = new Element(elementID, mRS);
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700248 mElement.updateFromNative();
249 }
250 calcElementCount();
251 }
252
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700253 /**
Jason Samsec44e5d2013-10-09 17:15:36 -0700254 * Utility function for creating basic 1D types. The type is
255 * created without mipmaps enabled.
256 *
257 * @param rs The RenderScript context
258 * @param e The Element for the Type
259 * @param dimX The X dimension, must be > 0
260 *
261 * @return Type
262 */
263 static public Type createX(RenderScript rs, Element e, int dimX) {
264 if (dimX < 1) {
265 throw new RSInvalidStateException("Dimension must be >= 1.");
266 }
267
Tim Murray460a0492013-11-19 12:45:54 -0800268 long id = rs.nTypeCreate(e.getID(rs), dimX, 0, 0, false, false, 0);
Jason Samsec44e5d2013-10-09 17:15:36 -0700269 Type t = new Type(id, rs);
270 t.mElement = e;
271 t.mDimX = dimX;
272 t.calcElementCount();
273 return t;
274 }
275
276 /**
277 * Utility function for creating basic 2D types. The type is
278 * created without mipmaps or cubemaps.
279 *
280 * @param rs The RenderScript context
281 * @param e The Element for the Type
282 * @param dimX The X dimension, must be > 0
283 * @param dimY The Y dimension, must be > 0
284 *
285 * @return Type
286 */
287 static public Type createXY(RenderScript rs, Element e, int dimX, int dimY) {
288 if ((dimX < 1) || (dimY < 1)) {
289 throw new RSInvalidStateException("Dimension must be >= 1.");
290 }
291
Tim Murray460a0492013-11-19 12:45:54 -0800292 long id = rs.nTypeCreate(e.getID(rs), dimX, dimY, 0, false, false, 0);
Jason Samsec44e5d2013-10-09 17:15:36 -0700293 Type t = new Type(id, rs);
294 t.mElement = e;
295 t.mDimX = dimX;
296 t.mDimY = dimY;
297 t.calcElementCount();
298 return t;
299 }
300
301 /**
302 * Utility function for creating basic 3D types. The type is
303 * created without mipmaps.
304 *
305 * @param rs The RenderScript context
306 * @param e The Element for the Type
307 * @param dimX The X dimension, must be > 0
308 * @param dimY The Y dimension, must be > 0
309 * @param dimZ The Z dimension, must be > 0
310 *
311 * @return Type
312 */
313 static public Type createXYZ(RenderScript rs, Element e, int dimX, int dimY, int dimZ) {
314 if ((dimX < 1) || (dimY < 1) || (dimZ < 1)) {
315 throw new RSInvalidStateException("Dimension must be >= 1.");
316 }
317
Tim Murray460a0492013-11-19 12:45:54 -0800318 long id = rs.nTypeCreate(e.getID(rs), dimX, dimY, dimZ, false, false, 0);
Jason Samsec44e5d2013-10-09 17:15:36 -0700319 Type t = new Type(id, rs);
320 t.mElement = e;
321 t.mDimX = dimX;
322 t.mDimY = dimY;
323 t.mDimZ = dimZ;
324 t.calcElementCount();
325 return t;
326 }
327
328 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800329 * Builder class for Type.
330 *
331 */
Jason Samsb8c5a842009-07-31 20:40:47 -0700332 public static class Builder {
333 RenderScript mRS;
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800334 int mDimX = 1;
335 int mDimY;
336 int mDimZ;
337 boolean mDimMipmaps;
338 boolean mDimFaces;
Jason Samsb109cc72013-01-07 18:20:12 -0800339 int mYuv;
Jason Sams46ba27e32015-02-06 17:45:15 -0800340 int[] mArray = new int[mMaxArrays];
Jason Samsb8c5a842009-07-31 20:40:47 -0700341
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800342 Element mElement;
Jason Samsb8c5a842009-07-31 20:40:47 -0700343
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700344 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800345 * Create a new builder object.
346 *
347 * @param rs
348 * @param e The element for the type to be created.
349 */
Jason Sams22534172009-08-04 16:58:20 -0700350 public Builder(RenderScript rs, Element e) {
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800351 e.checkValid();
Jason Sams22534172009-08-04 16:58:20 -0700352 mRS = rs;
Jason Sams22534172009-08-04 16:58:20 -0700353 mElement = e;
Jason Samsb8c5a842009-07-31 20:40:47 -0700354 }
355
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700356 /**
Jason Samsa1b13ed2010-11-12 14:58:37 -0800357 * Add a dimension to the Type.
358 *
359 *
Jason Samsa1b13ed2010-11-12 14:58:37 -0800360 * @param value
361 */
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800362 public Builder setX(int value) {
Jason Sams3c0dfba2009-09-27 17:50:38 -0700363 if(value < 1) {
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800364 throw new RSIllegalArgumentException("Values of less than 1 for Dimension X are not valid.");
Jason Sams3c0dfba2009-09-27 17:50:38 -0700365 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800366 mDimX = value;
367 return this;
Jason Sams22534172009-08-04 16:58:20 -0700368 }
369
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800370 public Builder setY(int value) {
371 if(value < 1) {
372 throw new RSIllegalArgumentException("Values of less than 1 for Dimension Y are not valid.");
373 }
374 mDimY = value;
375 return this;
376 }
377
Jason Samsd1c306a2012-12-27 20:26:41 -0800378 public Builder setZ(int value) {
379 if(value < 1) {
380 throw new RSIllegalArgumentException("Values of less than 1 for Dimension Z are not valid.");
381 }
382 mDimZ = value;
383 return this;
384 }
385
Jason Sams46ba27e32015-02-06 17:45:15 -0800386 /**
Jason Samsd0162662015-04-15 17:18:10 -0700387 * @hide
Jason Sams6a420b52015-03-30 15:31:26 -0700388 * Adds an array dimension to the builder
Jason Sams46ba27e32015-02-06 17:45:15 -0800389 *
390 * @param dim
391 * @param value
392 *
393 * @return Builder
394 */
395 public Builder setArray(int dim, int value) {
396 if(dim < 0 || dim >= mMaxArrays) {
397 throw new RSIllegalArgumentException("Array dimension out of range.");
398 }
399 mArray[dim] = value;
400 return this;
401 }
402
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800403 public Builder setMipmaps(boolean value) {
404 mDimMipmaps = value;
405 return this;
406 }
407
408 public Builder setFaces(boolean value) {
409 mDimFaces = value;
410 return this;
411 }
412
Jason Samsb109cc72013-01-07 18:20:12 -0800413 /**
Tim Murrayc11e25c2013-04-09 11:01:01 -0700414 * Set the YUV layout for a Type.
Jason Samsb109cc72013-01-07 18:20:12 -0800415 *
Eino-Ville Talvalaccadaf12013-08-14 10:36:30 -0700416 * @param yuvFormat {@link android.graphics.ImageFormat#YV12}, {@link android.graphics.ImageFormat#NV21}, or
417 * {@link android.graphics.ImageFormat#YUV_420_888}.
Jason Samsb109cc72013-01-07 18:20:12 -0800418 */
419 public Builder setYuvFormat(int yuvFormat) {
420 switch (yuvFormat) {
421 case android.graphics.ImageFormat.NV21:
422 case android.graphics.ImageFormat.YV12:
Eino-Ville Talvalaccadaf12013-08-14 10:36:30 -0700423 case android.graphics.ImageFormat.YUV_420_888:
Jason Samsb109cc72013-01-07 18:20:12 -0800424 break;
425
426 default:
Eino-Ville Talvalaccadaf12013-08-14 10:36:30 -0700427 throw new RSIllegalArgumentException(
428 "Only ImageFormat.NV21, .YV12, and .YUV_420_888 are supported..");
Jason Samsb109cc72013-01-07 18:20:12 -0800429 }
430
431 mYuv = yuvFormat;
432 return this;
433 }
434
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800435
Stephen Hines9c9ad3f8c22012-05-07 15:34:29 -0700436 /**
Tim Murrayc11e25c2013-04-09 11:01:01 -0700437 * Validate structure and create a new Type.
Jason Samsa1b13ed2010-11-12 14:58:37 -0800438 *
439 * @return Type
440 */
Jason Samsb8c5a842009-07-31 20:40:47 -0700441 public Type create() {
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800442 if (mDimZ > 0) {
443 if ((mDimX < 1) || (mDimY < 1)) {
Jason Samsa1b13ed2010-11-12 14:58:37 -0800444 throw new RSInvalidStateException("Both X and Y dimension required when Z is present.");
445 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800446 if (mDimFaces) {
Jason Samsa1b13ed2010-11-12 14:58:37 -0800447 throw new RSInvalidStateException("Cube maps not supported with 3D types.");
448 }
449 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800450 if (mDimY > 0) {
451 if (mDimX < 1) {
Jason Samsa1b13ed2010-11-12 14:58:37 -0800452 throw new RSInvalidStateException("X dimension required when Y is present.");
453 }
454 }
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800455 if (mDimFaces) {
456 if (mDimY < 1) {
Jason Samsa1b13ed2010-11-12 14:58:37 -0800457 throw new RSInvalidStateException("Cube maps require 2D Types.");
458 }
459 }
460
Jason Samsb109cc72013-01-07 18:20:12 -0800461 if (mYuv != 0) {
462 if ((mDimZ != 0) || mDimFaces || mDimMipmaps) {
463 throw new RSInvalidStateException("YUV only supports basic 2D.");
464 }
465 }
466
Jason Sams46ba27e32015-02-06 17:45:15 -0800467 int[] arrays = null;
468 for (int ct = mMaxArrays - 1; ct >= 0; ct--) {
469 if (mArray[ct] != 0 && arrays == null) {
470 arrays = new int[ct];
471 }
472 if ((mArray[ct] == 0) && (arrays != null)) {
473 throw new RSInvalidStateException("Array dimensions must be contigous from 0.");
474 }
475 }
476
Tim Murray460a0492013-11-19 12:45:54 -0800477 long id = mRS.nTypeCreate(mElement.getID(mRS),
Jason Samsb109cc72013-01-07 18:20:12 -0800478 mDimX, mDimY, mDimZ, mDimMipmaps, mDimFaces, mYuv);
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800479 Type t = new Type(id, mRS);
480 t.mElement = mElement;
481 t.mDimX = mDimX;
482 t.mDimY = mDimY;
483 t.mDimZ = mDimZ;
484 t.mDimMipmaps = mDimMipmaps;
485 t.mDimFaces = mDimFaces;
Jason Samsb109cc72013-01-07 18:20:12 -0800486 t.mDimYuv = mYuv;
Jason Sams46ba27e32015-02-06 17:45:15 -0800487 t.mArrays = arrays;
Jason Samsbf6ef8d2010-12-06 15:59:59 -0800488
Jason Sams768bc022009-09-21 19:41:04 -0700489 t.calcElementCount();
Jason Sams1bada8c2009-08-09 17:01:55 -0700490 return t;
Jason Samsb8c5a842009-07-31 20:40:47 -0700491 }
492 }
493
494}