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