Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [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 | |
| 19 | import java.lang.reflect.Field; |
| 20 | |
Shih-wei Liao | 6b32fab | 2010-12-10 01:03:59 -0800 | [diff] [blame] | 21 | import android.content.Context; |
Jason Sams | 11c8af9 | 2010-10-13 15:31:10 -0700 | [diff] [blame] | 22 | import android.graphics.PixelFormat; |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 23 | import android.graphics.Bitmap; |
| 24 | import android.graphics.BitmapFactory; |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 25 | import android.graphics.SurfaceTexture; |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 26 | import android.util.Log; |
| 27 | import android.view.Surface; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 28 | import android.view.SurfaceHolder; |
| 29 | import android.view.SurfaceView; |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 30 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 31 | /** |
Tim Murray | a908422 | 2013-04-05 22:06:43 +0000 | [diff] [blame] | 32 | * @hide |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 33 | * @deprecated in API 16 |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 34 | * The Graphics derivitive of RenderScript. Extends the basic context to add a |
Jason Sams | 27676fe | 2010-11-10 17:00:59 -0800 | [diff] [blame] | 35 | * root script which is the display window for graphical output. When the |
| 36 | * system needs to update the display the currently bound root script will be |
| 37 | * called. This script is expected to issue the rendering commands to repaint |
| 38 | * the screen. |
Joe Fernandez | 3aef8e1d | 2011-12-20 10:38:34 -0800 | [diff] [blame] | 39 | * |
| 40 | * <div class="special reference"> |
| 41 | * <h3>Developer Guides</h3> |
Tim Murray | c11e25c | 2013-04-09 11:01:01 -0700 | [diff] [blame] | 42 | * <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 Fernandez | 3aef8e1d | 2011-12-20 10:38:34 -0800 | [diff] [blame] | 44 | * </div> |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 45 | **/ |
| 46 | public class RenderScriptGL extends RenderScript { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 47 | int mWidth; |
| 48 | int mHeight; |
| 49 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 50 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 51 | * @deprecated in API 16 |
Jason Sams | 27676fe | 2010-11-10 17:00:59 -0800 | [diff] [blame] | 52 | * Class which is used to describe a pixel format for a graphical buffer. |
| 53 | * This is used to describe the intended format of the display surface. |
| 54 | * |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 55 | * The configuration is described by pairs of minimum and preferred bit |
| 56 | * depths for each component within the config and additional structural |
| 57 | * information. |
Jason Sams | 27676fe | 2010-11-10 17:00:59 -0800 | [diff] [blame] | 58 | */ |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 59 | public static class SurfaceConfig { |
| 60 | int mDepthMin = 0; |
| 61 | int mDepthPref = 0; |
| 62 | int mStencilMin = 0; |
| 63 | int mStencilPref = 0; |
| 64 | int mColorMin = 8; |
| 65 | int mColorPref = 8; |
| 66 | int mAlphaMin = 0; |
| 67 | int mAlphaPref = 0; |
| 68 | int mSamplesMin = 1; |
| 69 | int mSamplesPref = 1; |
| 70 | float mSamplesQ = 1.f; |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 71 | |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 72 | /** |
| 73 | * @deprecated in API 16 |
| 74 | */ |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 75 | public SurfaceConfig() { |
| 76 | } |
| 77 | |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 78 | /** |
| 79 | * @deprecated in API 16 |
| 80 | */ |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 81 | public SurfaceConfig(SurfaceConfig sc) { |
| 82 | mDepthMin = sc.mDepthMin; |
| 83 | mDepthPref = sc.mDepthPref; |
| 84 | mStencilMin = sc.mStencilMin; |
| 85 | mStencilPref = sc.mStencilPref; |
| 86 | mColorMin = sc.mColorMin; |
| 87 | mColorPref = sc.mColorPref; |
| 88 | mAlphaMin = sc.mAlphaMin; |
| 89 | mAlphaPref = sc.mAlphaPref; |
| 90 | mSamplesMin = sc.mSamplesMin; |
| 91 | mSamplesPref = sc.mSamplesPref; |
| 92 | mSamplesQ = sc.mSamplesQ; |
| 93 | } |
| 94 | |
| 95 | private void validateRange(int umin, int upref, int rmin, int rmax) { |
| 96 | if (umin < rmin || umin > rmax) { |
Jason Sams | c1d6210 | 2010-11-04 14:32:19 -0700 | [diff] [blame] | 97 | throw new RSIllegalArgumentException("Minimum value provided out of range."); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 98 | } |
| 99 | if (upref < umin) { |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 100 | throw new RSIllegalArgumentException("preferred must be >= Minimum."); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 104 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 105 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 106 | * Set the per-component bit depth for color (red, green, blue). This |
| 107 | * configures the surface for an unsigned integer buffer type. |
| 108 | * |
| 109 | * @param minimum |
| 110 | * @param preferred |
| 111 | */ |
| 112 | public void setColor(int minimum, int preferred) { |
| 113 | validateRange(minimum, preferred, 5, 8); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 114 | mColorMin = minimum; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 115 | mColorPref = preferred; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 116 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 117 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 118 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 119 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 120 | * Set the bit depth for alpha. This configures the surface for |
| 121 | * an unsigned integer buffer type. |
| 122 | * |
| 123 | * @param minimum |
| 124 | * @param preferred |
| 125 | */ |
| 126 | public void setAlpha(int minimum, int preferred) { |
| 127 | validateRange(minimum, preferred, 0, 8); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 128 | mAlphaMin = minimum; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 129 | mAlphaPref = preferred; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 130 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 131 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 132 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 133 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 134 | * Set the bit depth for the depth buffer. This configures the |
| 135 | * surface for an unsigned integer buffer type. If a minimum of 0 |
| 136 | * is specified then its possible no depth buffer will be |
| 137 | * allocated. |
| 138 | * |
| 139 | * @param minimum |
| 140 | * @param preferred |
| 141 | */ |
| 142 | public void setDepth(int minimum, int preferred) { |
| 143 | validateRange(minimum, preferred, 0, 24); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 144 | mDepthMin = minimum; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 145 | mDepthPref = preferred; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 146 | } |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 147 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 148 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 149 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 150 | * Configure the multisample rendering. |
| 151 | * |
| 152 | * @param minimum The required number of samples, must be at least 1. |
| 153 | * @param preferred The targe number of samples, must be at least |
| 154 | * minimum |
| 155 | * @param Q The quality of samples, range 0-1. Used to decide between |
| 156 | * different formats which have the same number of samples but |
| 157 | * different rendering quality. |
| 158 | */ |
| 159 | public void setSamples(int minimum, int preferred, float Q) { |
| 160 | validateRange(minimum, preferred, 1, 32); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 161 | if (Q < 0.0f || Q > 1.0f) { |
Jason Sams | c1d6210 | 2010-11-04 14:32:19 -0700 | [diff] [blame] | 162 | throw new RSIllegalArgumentException("Quality out of 0-1 range."); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 163 | } |
| 164 | mSamplesMin = minimum; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 165 | mSamplesPref = preferred; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 166 | mSamplesQ = Q; |
| 167 | } |
| 168 | }; |
| 169 | |
| 170 | SurfaceConfig mSurfaceConfig; |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 171 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 172 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 173 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 174 | * Construct a new RenderScriptGL context. |
| 175 | * |
Shih-wei Liao | 6b32fab | 2010-12-10 01:03:59 -0800 | [diff] [blame] | 176 | * @param ctx The context. |
Stephen Hines | 8cecbb5 | 2011-02-28 18:20:34 -0800 | [diff] [blame] | 177 | * @param sc The desired format of the primary rendering surface. |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 178 | */ |
Shih-wei Liao | 6b32fab | 2010-12-10 01:03:59 -0800 | [diff] [blame] | 179 | public RenderScriptGL(Context ctx, SurfaceConfig sc) { |
| 180 | super(ctx); |
Jason Sams | 2222aa9 | 2010-10-10 17:58:25 -0700 | [diff] [blame] | 181 | mSurfaceConfig = new SurfaceConfig(sc); |
| 182 | |
Jason Sams | 1a4e1f3 | 2012-02-24 17:51:24 -0800 | [diff] [blame] | 183 | int sdkVersion = ctx.getApplicationInfo().targetSdkVersion; |
Stephen Hines | 4382467a | 2011-08-01 15:02:34 -0700 | [diff] [blame] | 184 | |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 185 | mWidth = 0; |
| 186 | mHeight = 0; |
| 187 | mDev = nDeviceCreate(); |
Alex Sakhartchouk | 2c74ad9 | 2011-03-16 19:28:25 -0700 | [diff] [blame] | 188 | int dpi = ctx.getResources().getDisplayMetrics().densityDpi; |
Stephen Hines | 4382467a | 2011-08-01 15:02:34 -0700 | [diff] [blame] | 189 | mContext = nContextCreateGL(mDev, 0, sdkVersion, |
Jason Sams | 11c8af9 | 2010-10-13 15:31:10 -0700 | [diff] [blame] | 190 | mSurfaceConfig.mColorMin, mSurfaceConfig.mColorPref, |
| 191 | mSurfaceConfig.mAlphaMin, mSurfaceConfig.mAlphaPref, |
| 192 | mSurfaceConfig.mDepthMin, mSurfaceConfig.mDepthPref, |
| 193 | mSurfaceConfig.mStencilMin, mSurfaceConfig.mStencilPref, |
| 194 | mSurfaceConfig.mSamplesMin, mSurfaceConfig.mSamplesPref, |
Alex Sakhartchouk | 2c74ad9 | 2011-03-16 19:28:25 -0700 | [diff] [blame] | 195 | mSurfaceConfig.mSamplesQ, dpi); |
Jason Sams | d5f0630 | 2010-11-03 14:27:11 -0700 | [diff] [blame] | 196 | if (mContext == 0) { |
| 197 | throw new RSDriverException("Failed to create RS context."); |
| 198 | } |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 199 | mMessageThread = new MessageThread(this); |
| 200 | mMessageThread.start(); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 201 | } |
| 202 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 203 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 204 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 205 | * Bind an os surface |
| 206 | * |
| 207 | * |
| 208 | * @param w |
| 209 | * @param h |
| 210 | * @param sur |
| 211 | */ |
| 212 | public void setSurface(SurfaceHolder sur, int w, int h) { |
| 213 | validate(); |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 214 | Surface s = null; |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 215 | if (sur != null) { |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 216 | s = sur.getSurface(); |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 217 | } |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 218 | mWidth = w; |
| 219 | mHeight = h; |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 220 | nContextSetSurface(w, h, s); |
| 221 | } |
| 222 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 223 | /** |
Jason Sams | e619de6 | 2012-05-08 18:40:58 -0700 | [diff] [blame] | 224 | * @deprecated in API 16 |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 225 | * Bind an os surface |
| 226 | * |
Jason Sams | faa32b3 | 2011-06-20 16:58:04 -0700 | [diff] [blame] | 227 | * @param w |
| 228 | * @param h |
| 229 | * @param sur |
| 230 | */ |
| 231 | public void setSurfaceTexture(SurfaceTexture sur, int w, int h) { |
| 232 | validate(); |
| 233 | //android.util.Log.v("rs", "set surface " + sur + " w=" + w + ", h=" + h); |
| 234 | |
| 235 | mWidth = w; |
| 236 | mHeight = h; |
| 237 | nContextSetSurfaceTexture(w, h, sur); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 238 | } |
| 239 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 240 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 241 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 242 | * return the height of the last set surface. |
| 243 | * |
| 244 | * @return int |
| 245 | */ |
Jason Sams | 5585e36 | 2010-10-29 10:19:21 -0700 | [diff] [blame] | 246 | public int getHeight() { |
| 247 | return mHeight; |
| 248 | } |
| 249 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 250 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 251 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 252 | * return the width of the last set surface. |
| 253 | * |
| 254 | * @return int |
| 255 | */ |
Jason Sams | 5585e36 | 2010-10-29 10:19:21 -0700 | [diff] [blame] | 256 | public int getWidth() { |
| 257 | return mWidth; |
| 258 | } |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 259 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 260 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 261 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 262 | * Temporarly halt calls to the root rendering script. |
| 263 | * |
| 264 | */ |
| 265 | public void pause() { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 266 | validate(); |
| 267 | nContextPause(); |
| 268 | } |
| 269 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 270 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 271 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 272 | * Resume calls to the root rendering script. |
| 273 | * |
| 274 | */ |
| 275 | public void resume() { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 276 | validate(); |
| 277 | nContextResume(); |
| 278 | } |
| 279 | |
| 280 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 281 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 282 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 283 | * Set the script to handle calls to render the primary surface. |
| 284 | * |
| 285 | * @param s Graphics script to process rendering requests. |
| 286 | */ |
| 287 | public void bindRootScript(Script s) { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 288 | validate(); |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 289 | nContextBindRootScript((int)safeID(s)); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 290 | } |
| 291 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 292 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 293 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 294 | * Set the default ProgramStore object seen as the parent state by the root |
| 295 | * rendering script. |
| 296 | * |
| 297 | * @param p |
| 298 | */ |
| 299 | public void bindProgramStore(ProgramStore p) { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 300 | validate(); |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 301 | nContextBindProgramStore((int)safeID(p)); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 302 | } |
| 303 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 304 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 305 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 306 | * Set the default ProgramFragment object seen as the parent state by the |
| 307 | * root rendering script. |
| 308 | * |
| 309 | * @param p |
| 310 | */ |
| 311 | public void bindProgramFragment(ProgramFragment p) { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 312 | validate(); |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 313 | nContextBindProgramFragment((int)safeID(p)); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 314 | } |
| 315 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 316 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 317 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 318 | * Set the default ProgramRaster object seen as the parent state by the |
| 319 | * root rendering script. |
| 320 | * |
| 321 | * @param p |
| 322 | */ |
| 323 | public void bindProgramRaster(ProgramRaster p) { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 324 | validate(); |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 325 | nContextBindProgramRaster((int)safeID(p)); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 326 | } |
| 327 | |
Stephen Hines | 9c9ad3f8c2 | 2012-05-07 15:34:29 -0700 | [diff] [blame] | 328 | /** |
Jason Sams | d4ca991 | 2012-05-08 19:02:07 -0700 | [diff] [blame] | 329 | * @deprecated in API 16 |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 330 | * Set the default ProgramVertex object seen as the parent state by the |
| 331 | * root rendering script. |
| 332 | * |
| 333 | * @param p |
| 334 | */ |
| 335 | public void bindProgramVertex(ProgramVertex p) { |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 336 | validate(); |
Tim Murray | 7a629fa | 2013-11-19 12:45:54 -0800 | [diff] [blame] | 337 | nContextBindProgramVertex((int)safeID(p)); |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 338 | } |
| 339 | |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 340 | } |