Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 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 | |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 19 | |
Jason Sams | 43ee0685 | 2009-08-12 17:54:11 -0700 | [diff] [blame] | 20 | import java.lang.reflect.Field; |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 21 | |
| 22 | import android.graphics.ImageFormat; |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 23 | import android.util.Log; |
Jason Sams | 43ee0685 | 2009-08-12 17:54:11 -0700 | [diff] [blame] | 24 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 25 | /** |
Robert Ly | 11518ac | 2011-02-09 13:57:06 -0800 | [diff] [blame] | 26 | * <p>Type is an allocation template. It consists of an Element and one or more |
| 27 | * dimensions. It describes only the layout of memory but does not allocate any |
| 28 | * storage for the data that is described.</p> |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 29 | * |
Robert Ly | 11518ac | 2011-02-09 13:57:06 -0800 | [diff] [blame] | 30 | * <p>A Type consists of several dimensions. Those are X, Y, Z, LOD (level of |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 31 | * detail), Faces (faces of a cube map). The X,Y,Z dimensions can be assigned |
| 32 | * any positive integral value within the constraints of available memory. A |
| 33 | * single dimension allocation would have an X dimension of greater than zero |
| 34 | * while the Y and Z dimensions would be zero to indicate not present. In this |
| 35 | * regard an allocation of x=10, y=1 would be considered 2 dimensionsal while |
Robert Ly | 11518ac | 2011-02-09 13:57:06 -0800 | [diff] [blame] | 36 | * x=10, y=0 would be considered 1 dimensional.</p> |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 37 | * |
Robert Ly | 11518ac | 2011-02-09 13:57:06 -0800 | [diff] [blame] | 38 | * <p>The LOD and Faces dimensions are booleans to indicate present or not present.</p> |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 39 | * |
Joe Fernandez | 3aef8e1d | 2011-12-20 10:38:34 -0800 | [diff] [blame] | 40 | * <div class="special reference"> |
| 41 | * <h3>Developer Guides</h3> |
| 42 | * <p>For more information about creating an application that uses Renderscript, read the |
| 43 | * <a href="{@docRoot}guide/topics/graphics/renderscript.html">Renderscript</a> developer guide.</p> |
| 44 | * </div> |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 45 | **/ |
| 46 | public class Type extends BaseObj { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 47 | int mDimX; |
| 48 | int mDimY; |
| 49 | int mDimZ; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 50 | boolean mDimMipmaps; |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 51 | boolean mDimFaces; |
Jason Sams | 8140d7b | 2012-12-13 17:01:09 -0800 | [diff] [blame] | 52 | int mDimYuv; |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 53 | int mElementCount; |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 54 | Element mElement; |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 55 | |
Jason Sams | 49a05d7 | 2010-12-29 14:31:29 -0800 | [diff] [blame] | 56 | public enum CubemapFace { |
Stephen Hines | 20fbd01 | 2011-06-16 17:44:53 -0700 | [diff] [blame] | 57 | POSITIVE_X (0), |
Jason Sams | 49a05d7 | 2010-12-29 14:31:29 -0800 | [diff] [blame] | 58 | NEGATIVE_X (1), |
Stephen Hines | 20fbd01 | 2011-06-16 17:44:53 -0700 | [diff] [blame] | 59 | POSITIVE_Y (2), |
Jason Sams | 49a05d7 | 2010-12-29 14:31:29 -0800 | [diff] [blame] | 60 | NEGATIVE_Y (3), |
Stephen Hines | 20fbd01 | 2011-06-16 17:44:53 -0700 | [diff] [blame] | 61 | POSITIVE_Z (4), |
| 62 | NEGATIVE_Z (5), |
| 63 | @Deprecated |
| 64 | POSITVE_X (0), |
| 65 | @Deprecated |
| 66 | POSITVE_Y (2), |
| 67 | @Deprecated |
| 68 | POSITVE_Z (4); |
Jason Sams | 49a05d7 | 2010-12-29 14:31:29 -0800 | [diff] [blame] | 69 | |
| 70 | int mID; |
| 71 | CubemapFace(int id) { |
| 72 | mID = id; |
| 73 | } |
| 74 | } |
| 75 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 76 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 77 | * Return the element associated with this Type. |
| 78 | * |
| 79 | * @return Element |
| 80 | */ |
Jason Sams | e17964e | 2010-01-04 16:52:27 -0800 | [diff] [blame] | 81 | public Element getElement() { |
| 82 | return mElement; |
| 83 | } |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 84 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 85 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 86 | * Return the value of the X dimension. |
| 87 | * |
| 88 | * @return int |
| 89 | */ |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 90 | public int getX() { |
| 91 | return mDimX; |
| 92 | } |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 93 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 94 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 95 | * Return the value of the Y dimension or 0 for a 1D allocation. |
| 96 | * |
| 97 | * @return int |
| 98 | */ |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 99 | public int getY() { |
| 100 | return mDimY; |
| 101 | } |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 102 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 103 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 104 | * Return the value of the Z dimension or 0 for a 1D or 2D allocation. |
| 105 | * |
| 106 | * @return int |
| 107 | */ |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 108 | public int getZ() { |
| 109 | return mDimZ; |
| 110 | } |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 111 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 112 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 113 | * Return if the Type has a mipmap chain. |
| 114 | * |
| 115 | * @return boolean |
| 116 | */ |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 117 | public boolean hasMipmaps() { |
| 118 | return mDimMipmaps; |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 119 | } |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 120 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 121 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 122 | * Return if the Type is a cube map. |
| 123 | * |
| 124 | * @return boolean |
| 125 | */ |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 126 | public boolean hasFaces() { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 127 | return mDimFaces; |
| 128 | } |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 129 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 130 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 131 | * Return the total number of accessable cells in the Type. |
| 132 | * |
| 133 | * @return int |
| 134 | */ |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 135 | public int getCount() { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 136 | return mElementCount; |
| 137 | } |
| 138 | |
| 139 | void calcElementCount() { |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 140 | boolean hasLod = hasMipmaps(); |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 141 | int x = getX(); |
| 142 | int y = getY(); |
| 143 | int z = getZ(); |
| 144 | int faces = 1; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 145 | if (hasFaces()) { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 146 | faces = 6; |
| 147 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 148 | if (x == 0) { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 149 | x = 1; |
| 150 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 151 | if (y == 0) { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 152 | y = 1; |
| 153 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 154 | if (z == 0) { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 155 | z = 1; |
| 156 | } |
| 157 | |
| 158 | int count = x * y * z * faces; |
Alex Sakhartchouk | 9ea30a6 | 2011-03-02 12:33:50 -0800 | [diff] [blame] | 159 | |
| 160 | while (hasLod && ((x > 1) || (y > 1) || (z > 1))) { |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 161 | if(x > 1) { |
| 162 | x >>= 1; |
| 163 | } |
| 164 | if(y > 1) { |
| 165 | y >>= 1; |
| 166 | } |
| 167 | if(z > 1) { |
| 168 | z >>= 1; |
| 169 | } |
| 170 | |
| 171 | count += x * y * z * faces; |
| 172 | } |
| 173 | mElementCount = count; |
| 174 | } |
| 175 | |
| 176 | |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 177 | Type(int id, RenderScript rs) { |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 178 | super(id, rs); |
Jason Sams | 43ee0685 | 2009-08-12 17:54:11 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 181 | @Override |
| 182 | void updateFromNative() { |
| 183 | // We have 6 integer to obtain mDimX; mDimY; mDimZ; |
| 184 | // mDimLOD; mDimFaces; mElement; |
| 185 | int[] dataBuffer = new int[6]; |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 186 | mRS.nTypeGetNativeData(getID(mRS), dataBuffer); |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 187 | |
| 188 | mDimX = dataBuffer[0]; |
| 189 | mDimY = dataBuffer[1]; |
| 190 | mDimZ = dataBuffer[2]; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 191 | mDimMipmaps = dataBuffer[3] == 1 ? true : false; |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 192 | mDimFaces = dataBuffer[4] == 1 ? true : false; |
| 193 | |
| 194 | int elementID = dataBuffer[5]; |
| 195 | if(elementID != 0) { |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 196 | mElement = new Element(elementID, mRS); |
Alex Sakhartchouk | dfac814 | 2010-07-15 11:33:03 -0700 | [diff] [blame] | 197 | mElement.updateFromNative(); |
| 198 | } |
| 199 | calcElementCount(); |
| 200 | } |
| 201 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 202 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 203 | * Builder class for Type. |
| 204 | * |
| 205 | */ |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 206 | public static class Builder { |
| 207 | RenderScript mRS; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 208 | int mDimX = 1; |
| 209 | int mDimY; |
| 210 | int mDimZ; |
| 211 | boolean mDimMipmaps; |
| 212 | boolean mDimFaces; |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 213 | int mYuv; |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 214 | |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 215 | Element mElement; |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 216 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 217 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 218 | * Create a new builder object. |
| 219 | * |
| 220 | * @param rs |
| 221 | * @param e The element for the type to be created. |
| 222 | */ |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 223 | public Builder(RenderScript rs, Element e) { |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 224 | e.checkValid(); |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 225 | mRS = rs; |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 226 | mElement = e; |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 229 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 230 | * Add a dimension to the Type. |
| 231 | * |
| 232 | * |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 233 | * @param value |
| 234 | */ |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 235 | public Builder setX(int value) { |
Jason Sams | 3c0dfba | 2009-09-27 17:50:38 -0700 | [diff] [blame] | 236 | if(value < 1) { |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 237 | throw new RSIllegalArgumentException("Values of less than 1 for Dimension X are not valid."); |
Jason Sams | 3c0dfba | 2009-09-27 17:50:38 -0700 | [diff] [blame] | 238 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 239 | mDimX = value; |
| 240 | return this; |
Jason Sams | 2253417 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 243 | public Builder setY(int value) { |
| 244 | if(value < 1) { |
| 245 | throw new RSIllegalArgumentException("Values of less than 1 for Dimension Y are not valid."); |
| 246 | } |
| 247 | mDimY = value; |
| 248 | return this; |
| 249 | } |
| 250 | |
Jason Sams | d1c306a | 2012-12-27 20:26:41 -0800 | [diff] [blame] | 251 | public Builder setZ(int value) { |
| 252 | if(value < 1) { |
| 253 | throw new RSIllegalArgumentException("Values of less than 1 for Dimension Z are not valid."); |
| 254 | } |
| 255 | mDimZ = value; |
| 256 | return this; |
| 257 | } |
| 258 | |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 259 | public Builder setMipmaps(boolean value) { |
| 260 | mDimMipmaps = value; |
| 261 | return this; |
| 262 | } |
| 263 | |
| 264 | public Builder setFaces(boolean value) { |
| 265 | mDimFaces = value; |
| 266 | return this; |
| 267 | } |
| 268 | |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 269 | /** |
| 270 | * @hide |
| 271 | * |
| 272 | * only NV21, YV12. Enums from ImageFormat |
| 273 | */ |
| 274 | public Builder setYuvFormat(int yuvFormat) { |
| 275 | switch (yuvFormat) { |
| 276 | case android.graphics.ImageFormat.NV21: |
| 277 | case android.graphics.ImageFormat.YV12: |
| 278 | break; |
| 279 | |
| 280 | default: |
| 281 | throw new RSIllegalArgumentException("Only NV21 and YV12 are supported.."); |
| 282 | } |
| 283 | |
| 284 | mYuv = yuvFormat; |
| 285 | return this; |
| 286 | } |
| 287 | |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 288 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 289 | /** |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 290 | * Validate structure and create a new type. |
| 291 | * |
| 292 | * @return Type |
| 293 | */ |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 294 | public Type create() { |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 295 | if (mDimZ > 0) { |
| 296 | if ((mDimX < 1) || (mDimY < 1)) { |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 297 | throw new RSInvalidStateException("Both X and Y dimension required when Z is present."); |
| 298 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 299 | if (mDimFaces) { |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 300 | throw new RSInvalidStateException("Cube maps not supported with 3D types."); |
| 301 | } |
| 302 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 303 | if (mDimY > 0) { |
| 304 | if (mDimX < 1) { |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 305 | throw new RSInvalidStateException("X dimension required when Y is present."); |
| 306 | } |
| 307 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 308 | if (mDimFaces) { |
| 309 | if (mDimY < 1) { |
Jason Sams | a1b13ed | 2010-11-12 14:58:37 -0800 | [diff] [blame] | 310 | throw new RSInvalidStateException("Cube maps require 2D Types."); |
| 311 | } |
| 312 | } |
| 313 | |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 314 | if (mYuv != 0) { |
| 315 | if ((mDimZ != 0) || mDimFaces || mDimMipmaps) { |
| 316 | throw new RSInvalidStateException("YUV only supports basic 2D."); |
| 317 | } |
| 318 | } |
| 319 | |
Jason Sams | e07694b | 2012-04-03 15:36:36 -0700 | [diff] [blame] | 320 | int id = mRS.nTypeCreate(mElement.getID(mRS), |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 321 | mDimX, mDimY, mDimZ, mDimMipmaps, mDimFaces, mYuv); |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 322 | Type t = new Type(id, mRS); |
| 323 | t.mElement = mElement; |
| 324 | t.mDimX = mDimX; |
| 325 | t.mDimY = mDimY; |
| 326 | t.mDimZ = mDimZ; |
| 327 | t.mDimMipmaps = mDimMipmaps; |
| 328 | t.mDimFaces = mDimFaces; |
Jason Sams | b109cc7 | 2013-01-07 18:20:12 -0800 | [diff] [blame^] | 329 | t.mDimYuv = mYuv; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 330 | |
Jason Sams | 768bc02 | 2009-09-21 19:41:04 -0700 | [diff] [blame] | 331 | t.calcElementCount(); |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 332 | return t; |
Jason Sams | b8c5a84 | 2009-07-31 20:40:47 -0700 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | |
| 336 | } |