Jason Sams | 0835d42 | 2009-08-04 17:58:23 -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 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 19 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 20 | * Sampler object that defines how Allocations can be read as textures within a |
| 21 | * kernel. Samplers are used in conjunction with the {@code rsSample} runtime |
| 22 | * function to return values from normalized coordinates. |
| 23 | * |
| 24 | * Any Allocation used with a Sampler must have been created with {@link |
| 25 | * android.renderscript.Allocation#USAGE_GRAPHICS_TEXTURE}; using a Sampler on |
| 26 | * an {@link android.renderscript.Allocation} that was not created with {@link |
| 27 | * android.renderscript.Allocation#USAGE_GRAPHICS_TEXTURE} is undefined. |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 28 | **/ |
| 29 | public class Sampler extends BaseObj { |
| 30 | public enum Value { |
| 31 | NEAREST (0), |
| 32 | LINEAR (1), |
| 33 | LINEAR_MIP_LINEAR (2), |
Alex Sakhartchouk | 0857196 | 2010-12-15 09:59:58 -0800 | [diff] [blame] | 34 | LINEAR_MIP_NEAREST (5), |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 35 | WRAP (3), |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 36 | CLAMP (4), |
| 37 | MIRRORED_REPEAT (6); |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 38 | |
| 39 | int mID; |
| 40 | Value(int id) { |
| 41 | mID = id; |
| 42 | } |
| 43 | } |
| 44 | |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 45 | Value mMin; |
| 46 | Value mMag; |
| 47 | Value mWrapS; |
| 48 | Value mWrapT; |
| 49 | Value mWrapR; |
| 50 | float mAniso; |
| 51 | |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 52 | Sampler(int id, RenderScript rs) { |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 53 | super(id, rs); |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 56 | /** |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 57 | * @return minification setting for the sampler |
| 58 | */ |
| 59 | public Value getMinification() { |
| 60 | return mMin; |
| 61 | } |
| 62 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 63 | /** |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 64 | * @return magnification setting for the sampler |
| 65 | */ |
| 66 | public Value getMagnification() { |
| 67 | return mMag; |
| 68 | } |
| 69 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 70 | /** |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 71 | * @return S wrapping mode for the sampler |
| 72 | */ |
| 73 | public Value getWrapS() { |
| 74 | return mWrapS; |
| 75 | } |
| 76 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 77 | /** |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 78 | * @return T wrapping mode for the sampler |
| 79 | */ |
| 80 | public Value getWrapT() { |
| 81 | return mWrapT; |
| 82 | } |
| 83 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 84 | /** |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 85 | * @return anisotropy setting for the sampler |
| 86 | */ |
| 87 | public float getAnisotropy() { |
| 88 | return mAniso; |
| 89 | } |
| 90 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 91 | /** |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 92 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 93 | * clamp. |
| 94 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 95 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 96 | * |
| 97 | * @return Sampler |
| 98 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 99 | public static Sampler CLAMP_NEAREST(RenderScript rs) { |
| 100 | if(rs.mSampler_CLAMP_NEAREST == null) { |
| 101 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 102 | b.setMinification(Value.NEAREST); |
| 103 | b.setMagnification(Value.NEAREST); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 104 | b.setWrapS(Value.CLAMP); |
| 105 | b.setWrapT(Value.CLAMP); |
| 106 | rs.mSampler_CLAMP_NEAREST = b.create(); |
| 107 | } |
| 108 | return rs.mSampler_CLAMP_NEAREST; |
| 109 | } |
| 110 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 111 | /** |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 112 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 113 | * clamp. |
| 114 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 115 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 116 | * |
| 117 | * @return Sampler |
| 118 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 119 | public static Sampler CLAMP_LINEAR(RenderScript rs) { |
| 120 | if(rs.mSampler_CLAMP_LINEAR == null) { |
| 121 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 122 | b.setMinification(Value.LINEAR); |
| 123 | b.setMagnification(Value.LINEAR); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 124 | b.setWrapS(Value.CLAMP); |
| 125 | b.setWrapT(Value.CLAMP); |
| 126 | rs.mSampler_CLAMP_LINEAR = b.create(); |
| 127 | } |
| 128 | return rs.mSampler_CLAMP_LINEAR; |
| 129 | } |
| 130 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 131 | /** |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 132 | * Retrieve a sampler with mag set to linear, min linear mipmap linear, and |
| 133 | * wrap modes set to clamp. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 134 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 135 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 136 | * |
| 137 | * @return Sampler |
| 138 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 139 | public static Sampler CLAMP_LINEAR_MIP_LINEAR(RenderScript rs) { |
| 140 | if(rs.mSampler_CLAMP_LINEAR_MIP_LINEAR == null) { |
| 141 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 142 | b.setMinification(Value.LINEAR_MIP_LINEAR); |
| 143 | b.setMagnification(Value.LINEAR); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 144 | b.setWrapS(Value.CLAMP); |
| 145 | b.setWrapT(Value.CLAMP); |
| 146 | rs.mSampler_CLAMP_LINEAR_MIP_LINEAR = b.create(); |
| 147 | } |
| 148 | return rs.mSampler_CLAMP_LINEAR_MIP_LINEAR; |
| 149 | } |
| 150 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 151 | /** |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 152 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 153 | * wrap. |
| 154 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 155 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 156 | * |
| 157 | * @return Sampler |
| 158 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 159 | public static Sampler WRAP_NEAREST(RenderScript rs) { |
| 160 | if(rs.mSampler_WRAP_NEAREST == null) { |
| 161 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 162 | b.setMinification(Value.NEAREST); |
| 163 | b.setMagnification(Value.NEAREST); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 164 | b.setWrapS(Value.WRAP); |
| 165 | b.setWrapT(Value.WRAP); |
| 166 | rs.mSampler_WRAP_NEAREST = b.create(); |
| 167 | } |
| 168 | return rs.mSampler_WRAP_NEAREST; |
| 169 | } |
| 170 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 171 | /** |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 172 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 173 | * wrap. |
| 174 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 175 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 176 | * |
| 177 | * @return Sampler |
| 178 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 179 | public static Sampler WRAP_LINEAR(RenderScript rs) { |
| 180 | if(rs.mSampler_WRAP_LINEAR == null) { |
| 181 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 182 | b.setMinification(Value.LINEAR); |
| 183 | b.setMagnification(Value.LINEAR); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 184 | b.setWrapS(Value.WRAP); |
| 185 | b.setWrapT(Value.WRAP); |
| 186 | rs.mSampler_WRAP_LINEAR = b.create(); |
| 187 | } |
| 188 | return rs.mSampler_WRAP_LINEAR; |
| 189 | } |
| 190 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 191 | /** |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 192 | * Retrieve a sampler with mag set to linear, min linear mipmap linear, and |
| 193 | * wrap modes set to wrap. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 194 | * |
Alex Sakhartchouk | f5c876e | 2011-01-13 14:53:43 -0800 | [diff] [blame] | 195 | * @param rs Context to which the sampler will belong. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 196 | * |
| 197 | * @return Sampler |
| 198 | */ |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 199 | public static Sampler WRAP_LINEAR_MIP_LINEAR(RenderScript rs) { |
| 200 | if(rs.mSampler_WRAP_LINEAR_MIP_LINEAR == null) { |
| 201 | Builder b = new Builder(rs); |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 202 | b.setMinification(Value.LINEAR_MIP_LINEAR); |
| 203 | b.setMagnification(Value.LINEAR); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 204 | b.setWrapS(Value.WRAP); |
| 205 | b.setWrapT(Value.WRAP); |
| 206 | rs.mSampler_WRAP_LINEAR_MIP_LINEAR = b.create(); |
| 207 | } |
| 208 | return rs.mSampler_WRAP_LINEAR_MIP_LINEAR; |
| 209 | } |
| 210 | |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 211 | /** |
| 212 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 213 | * mirrored repeat. |
| 214 | * |
| 215 | * @param rs Context to which the sampler will belong. |
| 216 | * |
| 217 | * @return Sampler |
| 218 | */ |
| 219 | public static Sampler MIRRORED_REPEAT_NEAREST(RenderScript rs) { |
| 220 | if(rs.mSampler_MIRRORED_REPEAT_NEAREST == null) { |
| 221 | Builder b = new Builder(rs); |
| 222 | b.setMinification(Value.NEAREST); |
| 223 | b.setMagnification(Value.NEAREST); |
| 224 | b.setWrapS(Value.MIRRORED_REPEAT); |
| 225 | b.setWrapT(Value.MIRRORED_REPEAT); |
| 226 | rs.mSampler_MIRRORED_REPEAT_NEAREST = b.create(); |
| 227 | } |
| 228 | return rs.mSampler_MIRRORED_REPEAT_NEAREST; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 233 | * mirrored repeat. |
| 234 | * |
| 235 | * @param rs Context to which the sampler will belong. |
| 236 | * |
| 237 | * @return Sampler |
| 238 | */ |
| 239 | public static Sampler MIRRORED_REPEAT_LINEAR(RenderScript rs) { |
| 240 | if(rs.mSampler_MIRRORED_REPEAT_LINEAR == null) { |
| 241 | Builder b = new Builder(rs); |
| 242 | b.setMinification(Value.LINEAR); |
| 243 | b.setMagnification(Value.LINEAR); |
| 244 | b.setWrapS(Value.MIRRORED_REPEAT); |
| 245 | b.setWrapT(Value.MIRRORED_REPEAT); |
| 246 | rs.mSampler_MIRRORED_REPEAT_LINEAR = b.create(); |
| 247 | } |
| 248 | return rs.mSampler_MIRRORED_REPEAT_LINEAR; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 253 | * mirrored repeat. |
| 254 | * |
| 255 | * @param rs Context to which the sampler will belong. |
| 256 | * |
| 257 | * @return Sampler |
| 258 | */ |
| 259 | public static Sampler MIRRORED_REPEAT_LINEAR_MIP_LINEAR(RenderScript rs) { |
| 260 | if(rs.mSampler_MIRRORED_REPEAT_LINEAR_MIP_LINEAR == null) { |
| 261 | Builder b = new Builder(rs); |
| 262 | b.setMinification(Value.LINEAR_MIP_LINEAR); |
| 263 | b.setMagnification(Value.LINEAR); |
| 264 | b.setWrapS(Value.MIRRORED_REPEAT); |
| 265 | b.setWrapT(Value.MIRRORED_REPEAT); |
| 266 | rs.mSampler_MIRRORED_REPEAT_LINEAR_MIP_LINEAR = b.create(); |
| 267 | } |
| 268 | return rs.mSampler_MIRRORED_REPEAT_LINEAR_MIP_LINEAR; |
| 269 | } |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 270 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 271 | /** |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 272 | * Builder for creating non-standard samplers. This is only necessary if |
| 273 | * a Sampler with different min and mag modes is desired. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 274 | */ |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 275 | public static class Builder { |
| 276 | RenderScript mRS; |
| 277 | Value mMin; |
| 278 | Value mMag; |
| 279 | Value mWrapS; |
| 280 | Value mWrapT; |
| 281 | Value mWrapR; |
Alex Sakhartchouk | f5b3510 | 2010-09-30 11:36:37 -0700 | [diff] [blame] | 282 | float mAniso; |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 283 | |
| 284 | public Builder(RenderScript rs) { |
| 285 | mRS = rs; |
| 286 | mMin = Value.NEAREST; |
| 287 | mMag = Value.NEAREST; |
| 288 | mWrapS = Value.WRAP; |
| 289 | mWrapT = Value.WRAP; |
| 290 | mWrapR = Value.WRAP; |
Alex Sakhartchouk | f5b3510 | 2010-09-30 11:36:37 -0700 | [diff] [blame] | 291 | mAniso = 1.0f; |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 292 | } |
| 293 | |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 294 | public void setMinification(Value v) { |
Jason Sams | 8bb41dd | 2009-12-16 15:59:59 -0800 | [diff] [blame] | 295 | if (v == Value.NEAREST || |
| 296 | v == Value.LINEAR || |
Alex Sakhartchouk | 0857196 | 2010-12-15 09:59:58 -0800 | [diff] [blame] | 297 | v == Value.LINEAR_MIP_LINEAR || |
| 298 | v == Value.LINEAR_MIP_NEAREST) { |
Jason Sams | 8bb41dd | 2009-12-16 15:59:59 -0800 | [diff] [blame] | 299 | mMin = v; |
| 300 | } else { |
| 301 | throw new IllegalArgumentException("Invalid value"); |
| 302 | } |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 303 | } |
| 304 | |
Alex Sakhartchouk | b4d7bb6 | 2010-12-21 14:42:26 -0800 | [diff] [blame] | 305 | public void setMagnification(Value v) { |
Jason Sams | 8bb41dd | 2009-12-16 15:59:59 -0800 | [diff] [blame] | 306 | if (v == Value.NEAREST || v == Value.LINEAR) { |
| 307 | mMag = v; |
| 308 | } else { |
| 309 | throw new IllegalArgumentException("Invalid value"); |
| 310 | } |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | public void setWrapS(Value v) { |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 314 | if (v == Value.WRAP || v == Value.CLAMP || v == Value.MIRRORED_REPEAT) { |
Jason Sams | 8bb41dd | 2009-12-16 15:59:59 -0800 | [diff] [blame] | 315 | mWrapS = v; |
| 316 | } else { |
| 317 | throw new IllegalArgumentException("Invalid value"); |
| 318 | } |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | public void setWrapT(Value v) { |
Tim Murray | 6b9b2ca | 2013-02-15 13:25:55 -0800 | [diff] [blame] | 322 | if (v == Value.WRAP || v == Value.CLAMP || v == Value.MIRRORED_REPEAT) { |
Jason Sams | 8bb41dd | 2009-12-16 15:59:59 -0800 | [diff] [blame] | 323 | mWrapT = v; |
| 324 | } else { |
| 325 | throw new IllegalArgumentException("Invalid value"); |
| 326 | } |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 327 | } |
| 328 | |
Alex Sakhartchouk | f5b3510 | 2010-09-30 11:36:37 -0700 | [diff] [blame] | 329 | public void setAnisotropy(float v) { |
| 330 | if(v >= 0.0f) { |
| 331 | mAniso = v; |
| 332 | } else { |
| 333 | throw new IllegalArgumentException("Invalid value"); |
| 334 | } |
| 335 | } |
| 336 | |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 337 | public Sampler create() { |
Jason Sams | 771bebb | 2009-12-07 12:40:12 -0800 | [diff] [blame] | 338 | mRS.validate(); |
Alex Sakhartchouk | 918e840 | 2012-04-11 14:04:23 -0700 | [diff] [blame] | 339 | int id = mRS.nSamplerCreate(mMag.mID, mMin.mID, |
Alex Sakhartchouk | 7d5f5e7 | 2011-10-18 11:08:31 -0700 | [diff] [blame] | 340 | mWrapS.mID, mWrapT.mID, mWrapR.mID, mAniso); |
| 341 | Sampler sampler = new Sampler(id, mRS); |
| 342 | sampler.mMin = mMin; |
| 343 | sampler.mMag = mMag; |
| 344 | sampler.mWrapS = mWrapS; |
| 345 | sampler.mWrapT = mWrapT; |
| 346 | sampler.mWrapR = mWrapR; |
| 347 | sampler.mAniso = mAniso; |
| 348 | return sampler; |
Jason Sams | 0835d42 | 2009-08-04 17:58:23 -0700 | [diff] [blame] | 349 | } |
| 350 | } |
| 351 | |
| 352 | } |
| 353 | |